aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlmediaelement.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2015-06-08 17:39:13 -0700
committerPatrick Walton <pcwalton@mimiga.net>2015-06-12 15:00:02 -0700
commit8c210e1a270fd8848d3ee8ed7ef84fb6e00af661 (patch)
treedb4a545a157b48d379035053cee79fcb396c3df6 /components/script/dom/htmlmediaelement.rs
parent41095c01a771c44f57da7f63b533741bf037918a (diff)
downloadservo-8c210e1a270fd8848d3ee8ed7ef84fb6e00af661.tar.gz
servo-8c210e1a270fd8848d3ee8ed7ef84fb6e00af661.zip
script: Make `PartialEq` on element type IDs generate a lot less code.
This makes the difference between selector matching scaling on the ARM Cortex-A9 and not, because the auto-derived `PartialEq` implementation blows out the 32KB I-cache. With this change, there is a 2x improvement in selector matching over sequential when using all 8 cores. (More work needs to be done; this is a start.)
Diffstat (limited to 'components/script/dom/htmlmediaelement.rs')
-rw-r--r--components/script/dom/htmlmediaelement.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs
index d56ea964f91..c9dcfd36ccd 100644
--- a/components/script/dom/htmlmediaelement.rs
+++ b/components/script/dom/htmlmediaelement.rs
@@ -42,10 +42,17 @@ impl HTMLMediaElement {
}
}
-#[derive(Copy, Clone, PartialEq, Debug)]
+#[derive(Copy, Clone, Debug)]
#[jstraceable]
pub enum HTMLMediaElementTypeId {
- HTMLAudioElement,
- HTMLVideoElement,
+ HTMLAudioElement = 0,
+ HTMLVideoElement = 1,
+}
+
+impl PartialEq for HTMLMediaElementTypeId {
+ #[inline]
+ fn eq(&self, other: &HTMLMediaElementTypeId) -> bool {
+ (*self as u8) == (*other as u8)
+ }
}