OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4328 | 4328 |
4329 void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { | 4329 void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
4330 ASSERT(!HasStackOverflow()); | 4330 ASSERT(!HasStackOverflow()); |
4331 ASSERT(current_block() != NULL); | 4331 ASSERT(current_block() != NULL); |
4332 ASSERT(current_block()->HasPredecessor()); | 4332 ASSERT(current_block()->HasPredecessor()); |
4333 Handle<JSFunction> closure = function_state()->compilation_info()->closure(); | 4333 Handle<JSFunction> closure = function_state()->compilation_info()->closure(); |
4334 HInstruction* literal; | 4334 HInstruction* literal; |
4335 | 4335 |
4336 // Check whether to use fast or slow deep-copying for boilerplate. | 4336 // Check whether to use fast or slow deep-copying for boilerplate. |
4337 int max_properties = kMaxFastLiteralProperties; | 4337 int max_properties = kMaxFastLiteralProperties; |
4338 Handle<Object> boilerplate(closure->literals()->get( | 4338 Handle<Object> literals_cell(closure->literals()->get(expr->literal_index()), |
4339 expr->literal_index()), isolate()); | 4339 isolate()); |
4340 if (boilerplate->IsJSObject() && | 4340 Handle<AllocationSite> site; |
4341 IsFastLiteral(Handle<JSObject>::cast(boilerplate), | 4341 Handle<JSObject> boilerplate; |
4342 if (!literals_cell->IsUndefined()) { | |
4343 // Retrieve the boilerplate | |
4344 ASSERT(literals_cell->IsAllocationSite()); | |
Michael Starzinger
2013/10/11 07:49:37
nit: Assert is not needed, the cast below will do
mvstanton
2013/10/11 09:23:47
Done.
| |
4345 site = Handle<AllocationSite>::cast(literals_cell); | |
4346 boilerplate = Handle<JSObject>(JSObject::cast(site->transition_info()), | |
4347 isolate()); | |
4348 } | |
4349 | |
4350 if (!boilerplate.is_null() && | |
4351 IsFastLiteral(boilerplate, | |
Michael Starzinger
2013/10/11 07:49:37
nit: Second predicate should fit into one line now
mvstanton
2013/10/11 09:23:47
Done.
| |
4342 kMaxFastLiteralDepth, | 4352 kMaxFastLiteralDepth, |
4343 &max_properties)) { | 4353 &max_properties)) { |
4344 Handle<JSObject> boilerplate_object = Handle<JSObject>::cast(boilerplate); | 4354 literal = BuildFastLiteral(boilerplate); |
4345 | |
4346 literal = BuildFastLiteral(boilerplate_object); | |
4347 } else { | 4355 } else { |
4348 NoObservableSideEffectsScope no_effects(this); | 4356 NoObservableSideEffectsScope no_effects(this); |
4349 Handle<FixedArray> closure_literals(closure->literals(), isolate()); | 4357 Handle<FixedArray> closure_literals(closure->literals(), isolate()); |
4350 Handle<FixedArray> constant_properties = expr->constant_properties(); | 4358 Handle<FixedArray> constant_properties = expr->constant_properties(); |
4351 int literal_index = expr->literal_index(); | 4359 int literal_index = expr->literal_index(); |
4352 int flags = expr->fast_elements() | 4360 int flags = expr->fast_elements() |
4353 ? ObjectLiteral::kFastElements : ObjectLiteral::kNoFlags; | 4361 ? ObjectLiteral::kFastElements : ObjectLiteral::kNoFlags; |
4354 flags |= expr->has_function() | 4362 flags |= expr->has_function() |
4355 ? ObjectLiteral::kHasFunction : ObjectLiteral::kNoFlags; | 4363 ? ObjectLiteral::kHasFunction : ObjectLiteral::kNoFlags; |
4356 | 4364 |
(...skipping 5518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9875 if (ShouldProduceTraceOutput()) { | 9883 if (ShouldProduceTraceOutput()) { |
9876 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9884 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9877 } | 9885 } |
9878 | 9886 |
9879 #ifdef DEBUG | 9887 #ifdef DEBUG |
9880 graph_->Verify(false); // No full verify. | 9888 graph_->Verify(false); // No full verify. |
9881 #endif | 9889 #endif |
9882 } | 9890 } |
9883 | 9891 |
9884 } } // namespace v8::internal | 9892 } } // namespace v8::internal |
OLD | NEW |