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

added dom obj counting to decide sequential/parallel layout (#10110) #11713

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

gave up on debug and handed to mbrubeck

  • Loading branch information
avadacatavra committed Jun 30, 2016
commit d73fa5085da8bb84c98e6a5804b56f4ca666e3bc
@@ -32,7 +32,7 @@ range = {path = "../range"}
rustc-serialize = "0.3"
script = {path = "../script"}
script_traits = {path = "../script_traits"}
selectors = {version = "0.6", features = ["heap_size"]}
selectors = {git = "https://github.com/avadacatavra/rust-selectors.git", features = ["heap_size"]}
serde_json = "0.7"
serde_macros = "0.7"
smallvec = "0.1"
@@ -1131,6 +1131,8 @@ impl BlockFlow {
self.base.position = LogicalRect::from_point_size(self.base.writing_mode,
origin,
self.base.position.size);

debug!("{}", self.base.writing_mode);
}

pub fn explicit_block_containing_size(&self, layout_context: &LayoutContext) -> Option<Au> {
@@ -1345,6 +1347,7 @@ impl BlockFlow {

let mut inline_start_margin_edge = inline_start_content_edge;
let mut inline_end_margin_edge = inline_end_content_edge;


let mut iterator = self.base.child_iter_mut().enumerate().peekable();
while let Some((i, kid)) = iterator.next() {
@@ -1358,9 +1361,11 @@ impl BlockFlow {
if kid_base.flags.contains(INLINE_POSITION_IS_STATIC) {
kid_base.position.start.i =
if kid_mode.is_bidi_ltr() == containing_block_mode.is_bidi_ltr() {
debug!("Is LTR");
inline_start_content_edge
} else {
// The kid's inline 'start' is at the parent's 'end'
debug!("Is RTL");
inline_end_content_edge
};
}
@@ -2333,6 +2338,7 @@ pub trait ISizeAndMarginsComputer {

// FIXME (mbrubeck): Get correct containing block for positioned blocks?
let container_mode = block.base.block_container_writing_mode;
debug!("Flow {} is in container writing mode {}", block.base.debug_id(), container_mode);
let container_size = block.base.block_container_inline_size;

let fragment = block.fragment();
@@ -117,6 +117,12 @@ impl<'a> DoubleEndedIterator for FlowListIterator<'a> {
}
}

impl<'a> DoubleEndedIterator for MutFlowListIterator<'a> {
fn next_back(&mut self) -> Option<&'a mut Flow> {
self.it.next_back().map(flow_ref::deref_mut)
}
}

impl<'a> Iterator for MutFlowListIterator<'a> {
type Item = &'a mut Flow;
#[inline]
@@ -1008,7 +1008,9 @@ impl LayoutThread {

// Parallelize if there's more than 750 objects based on rzambre's suggestion
// https://github.com/servo/servo/issues/10110
self.parallel_flag = opts::get().layout_threads > 1 && data.dom_count > 750;
//self.parallel_flag = opts::get().layout_threads > 1;// && data.dom_count > 750;
self.parallel_flag = false;
//self.parallel_flag = true;
debug!("layout: received layout request for: {}", self.url);
debug!("Number of objects in DOM: {}", data.dom_count);
debug!("layout: parallel? {}", self.parallel_flag);
@@ -50,6 +50,7 @@ pub fn traverse_flow_tree_preorder(root: &mut FlowRef,
}

for kid in flow::child_iter_mut(flow) {
debug!("Assign sizes for KID"); //not called
doit(kid, assign_inline_sizes, assign_block_sizes);
}

@@ -54,7 +54,7 @@ ref_slice = "1.0"
regex = "0.1.43"
rustc-serialize = "0.3"
script_traits = {path = "../script_traits"}
selectors = {version = "0.6", features = ["heap_size"]}
selectors = {git = "https://github.com/avadacatavra/rust-selectors.git", features = ["heap_size"]}
serde = "0.7"
smallvec = "0.1"
string_cache = {version = "0.2.18", features = ["heap_size", "unstable"]}

Some generated files are not rendered by default. Learn more.

@@ -29,7 +29,7 @@ matches = "0.1"
num-traits = "0.1.32"
plugins = {path = "../plugins"}
rustc-serialize = "0.3"
selectors = {version = "0.6", features = ["heap_size", "unstable"]}
selectors = {git = "https://github.com/avadacatavra/rust-selectors.git", features = ["heap_size", "unstable"]}
serde = {version = "0.7", features = ["nightly"]}
serde_macros = "0.7"
smallvec = "0.1"
@@ -840,6 +840,7 @@ impl<T: Debug> Debug for LogicalRect<T> {
impl<T: Zero> LogicalRect<T> {
#[inline]
pub fn zero(mode: WritingMode) -> LogicalRect<T> {
debug!("LogicalRect(zero) with mode: {:?}", mode);
LogicalRect {
start: LogicalPoint::zero(mode),
size: LogicalSize::zero(mode),
@@ -852,6 +853,8 @@ impl<T: Copy> LogicalRect<T> {
#[inline]
pub fn new(mode: WritingMode, inline_start: T, block_start: T, inline: T, block: T)
-> LogicalRect<T> {
debug!("LogicalRect(new) with mode: {:?}", mode);

LogicalRect {
start: LogicalPoint::new(mode, inline_start, block_start),
size: LogicalSize::new(mode, inline, block),
@@ -862,6 +865,8 @@ impl<T: Copy> LogicalRect<T> {
#[inline]
pub fn from_point_size(mode: WritingMode, start: LogicalPoint<T>, size: LogicalSize<T>)
-> LogicalRect<T> {
debug!("LogicalRect(pt size) with mode: {:?}", mode);

start.debug_writing_mode.check(mode);
size.debug_writing_mode.check(mode);
LogicalRect {
@@ -922,6 +927,7 @@ impl<T: Copy + Add<T, Output=T> + Sub<T, Output=T>> LogicalRect<T> {

#[inline]
pub fn to_physical(&self, mode: WritingMode, container_size: Size2D<T>) -> Rect<T> {
debug!("To_physical: {:?} vs. debug {:?}", mode, self.debug_writing_mode);
self.debug_writing_mode.check(mode);
let x;
let y;
@@ -959,6 +965,7 @@ impl<T: Copy + Add<T, Output=T> + Sub<T, Output=T>> LogicalRect<T> {
#[inline]
pub fn convert(&self, mode_from: WritingMode, mode_to: WritingMode, container_size: Size2D<T>)
-> LogicalRect<T> {
debug!("Converted mode from {:?} to {:?}", mode_from, mode_to);
if mode_from == mode_to {
self.debug_writing_mode.check(mode_from);
*self
@@ -46,6 +46,7 @@ impl<'a> ParserContext<'a> {
error_reporter: Box<ParseErrorReporter + Send>,
extra_data: ParserContextExtraData)
-> ParserContext<'a> {
debug!("PARSER WITH EXTRA DATA");
let mut selector_context = SelectorParserContext::new();
selector_context.in_user_agent_stylesheet = stylesheet_origin == Origin::UserAgent;
ParserContext {
@@ -59,6 +60,7 @@ impl<'a> ParserContext<'a> {

pub fn new(stylesheet_origin: Origin, base_url: &'a Url, error_reporter: Box<ParseErrorReporter + Send>)
-> ParserContext<'a> {
debug!("I WANT MY PARSER");
let extra_data = ParserContextExtraData::default();
ParserContext::new_with_extra_data(stylesheet_origin, base_url, error_reporter, extra_data)
}
@@ -67,6 +69,7 @@ impl<'a> ParserContext<'a> {

impl<'a> ParserContext<'a> {
pub fn parse_url(&self, input: &str) -> Url {
debug!("parse city bitch");
self.base_url.join(input)
.unwrap_or_else(|_| Url::parse("about:invalid").unwrap())
}
@@ -592,6 +592,7 @@ fn deduplicate_property_declarations(declarations: Vec<PropertyDeclaration>)
seen_custom.push(name.clone())
}
}
debug!("Last declaration: {:?}", declaration);
deduplicated.push(declaration)
}
deduplicated
@@ -911,6 +912,7 @@ impl PropertyDeclaration {

pub fn parse(name: &str, context: &ParserContext, input: &mut Parser,
result_list: &mut Vec<PropertyDeclaration>) -> PropertyDeclarationParseResult {
debug!("parse: {}", name);
if let Ok(name) = ::custom_properties::parse_name(name) {
let value = match input.try(CSSWideKeyword::parse) {
Ok(CSSWideKeyword::UnsetKeyword) | // Custom properties are alawys inherited
@@ -921,6 +923,7 @@ impl PropertyDeclaration {
Err(()) => return PropertyDeclarationParseResult::InvalidValue,
}
};

result_list.push(PropertyDeclaration::Custom(Atom::from(name), value));
return PropertyDeclarationParseResult::ValidOrIgnoredDeclaration;
}
@@ -1509,12 +1512,14 @@ impl ServoComputedValues {

/// Return a WritingMode bitflags from the relevant CSS properties.
pub fn get_writing_mode<S: style_struct_traits::InheritedBox>(inheritedbox_style: &S) -> WritingMode {

use logical_geometry;
let mut flags = WritingMode::empty();
match inheritedbox_style.clone_direction() {
computed_values::direction::T::ltr => {},
computed_values::direction::T::rtl => {
flags.insert(logical_geometry::FLAG_RTL);
debug!("IS RTL");
},
}
match inheritedbox_style.clone_writing_mode() {
@@ -1849,6 +1854,7 @@ pub fn cascade<C: ComputedValues>(

let mut style = context.style;


let positioned = matches!(style.get_box().clone_position(),
longhands::position::SpecifiedValue::absolute |
longhands::position::SpecifiedValue::fixed);
@@ -1943,6 +1949,9 @@ pub fn cascade<C: ComputedValues>(
}

let mode = get_writing_mode(style.get_inheritedbox());

debug!("Mode: {}", mode); //get the property name!!!

style.set_writing_mode(mode);
(style, cacheable)
}
@@ -167,6 +167,7 @@ impl SelectorImpl for ServoSelectorImpl {

fn parse_non_ts_pseudo_class(context: &ParserContext,
name: &str) -> Result<NonTSPseudoClass, ()> {
debug!("parse non ts pseudo class, {}", name);
use self::NonTSPseudoClass::*;
let pseudo_class = match_ignore_ascii_case! { name,
"any-link" => AnyLink,
@@ -196,6 +197,7 @@ impl SelectorImpl for ServoSelectorImpl {

fn parse_pseudo_element(context: &ParserContext,
name: &str) -> Result<PseudoElement, ()> {
debug!("parse pseudo element: {}", name);
use self::PseudoElement::*;
let pseudo_element = match_ignore_ascii_case! { name,
"before" => Before,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.