Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Move all origin-specific cascade data to PerOriginCascadeData #18017

Merged
merged 12 commits into from Aug 10, 2017

Conversation

heycam
Copy link
Contributor

@heycam heycam commented Aug 9, 2017

This is a preliminary refactoring in preparation for only rebuilding cascade data for origins that have a change. https://bugzilla.mozilla.org/show_bug.cgi?id=1382925


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #__ (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

highfive commented Aug 9, 2017

Heads up! This PR modifies the following files:

  • @bholley: components/style/invalidation/element/invalidation_map.rs, components/style/invalidation/element/invalidator.rs, components/style/animation.rs, components/style/context.rs, components/style/stylist.rs
  • @canaltinova: components/style/invalidation/element/invalidation_map.rs, components/style/invalidation/element/invalidator.rs, components/style/animation.rs, components/style/context.rs, components/style/stylist.rs
  • @emilio: ports/geckolib/glue.rs, components/style/invalidation/element/invalidation_map.rs, components/style/invalidation/element/invalidator.rs, components/style/animation.rs, components/style/context.rs and 1 more

@highfive
Copy link

highfive commented Aug 9, 2017

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Aug 9, 2017
@heycam
Copy link
Contributor Author

heycam commented Aug 9, 2017

r? @emilio

Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty straight-forward. r=me with the nits addressed, thanks!

@@ -1635,6 +1635,8 @@ impl CascadeData {
}
}

/// Iterator over `PerOriginCascadeData`, from highest level (user) to lowest
/// (user agent).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment to note that we rely on that to get animations, and potentially other stuff?

}
}

pub struct BloomStorageU8 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs docs.


#[inline]
fn slot_is_empty(&self, index: usize) -> bool {
let bit = 1 << (index % 8);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe create a method for this? presumably not worth the effort.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I almost did, then decided it wasn't worth it.

*slot == 0xff
pub trait BloomStorage : Clone + Default {
fn slot_is_empty(&self, index: usize) -> bool;
fn adjust_slot(&mut self, index: usize, increment: bool);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you mention what are these functions expected to do?

I found adjust to be a little not too descriptive... But I can't think of a better name that isn't super-long, so, maybe something simple like:

Either increment or decrement the slot at `index`.

Would be helpful.

@@ -237,6 +291,10 @@ fn hash2(hash: u32) -> u32 {
fn create_and_insert_some_stuff() {
let mut bf = BloomFilter::new();

assert!(ARRAY_SIZE % 8 == 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can static-assert this with transmute or something like that...

transmute::<[u8; 1 + ARRAY_SIZE % 8], [u8; 1]>(..)

/// Returns the number of entries in invalidation maps.
pub fn num_invalidations(&self) -> usize {
self.cascade_data.iter_origins()
.map(|d| d.invalidation_map.len()).sum()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd move sum, and maybe iter_origins, to its own line, but no huge deal.

self.style_attribute_dependency
self.cascade_data
.iter_origins()
.map(|d| d.style_attribute_dependency)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: just any(|d| d.style_attribute_dependency).

d.attribute_dependencies
.might_contain_hash(local_name.get_hash())
})
.any(|b| b)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

self.cascade_data
.iter_origins()
.map(|d| d.state_dependencies.intersects(state))
.any(|b| b)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

self.cascade_data
.iter_origins()
.map(|d| d.mapped_ids.might_contain_hash(id.get_hash()))
.any(|b| b)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

#[inline]
fn adjust_slot(&mut self, index: usize, increment: bool) {
let slot = &mut self.counters[index];
if *slot == 0xff { // full
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Err, this needs to be !=. Travis is red because of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is probably why my try run is all orange. :-)

@heycam
Copy link
Contributor Author

heycam commented Aug 10, 2017

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

📌 Commit 6cbe552 has been approved by emilio

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 10, 2017
@bors-servo
Copy link
Contributor

⌛ Testing commit 6cbe552 with merge ca14848...

bors-servo pushed a commit that referenced this pull request Aug 10, 2017
style: Move all origin-specific cascade data to PerOriginCascadeData

<!-- Please describe your changes on the following line: -->

This is a preliminary refactoring in preparation for only rebuilding cascade data for origins that have a change. https://bugzilla.mozilla.org/show_bug.cgi?id=1382925

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18017)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: emilio
Pushing ca14848 to master...

@bors-servo bors-servo merged commit 6cbe552 into servo:master Aug 10, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Aug 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants