| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 5536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5547 IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) { | 5547 IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) { |
| 5548 AllocationSiteUsageContext usage_context(isolate(), site, false); | 5548 AllocationSiteUsageContext usage_context(isolate(), site, false); |
| 5549 usage_context.EnterNewScope(); | 5549 usage_context.EnterNewScope(); |
| 5550 literal = BuildFastLiteral(boilerplate, &usage_context); | 5550 literal = BuildFastLiteral(boilerplate, &usage_context); |
| 5551 usage_context.ExitScope(site, boilerplate); | 5551 usage_context.ExitScope(site, boilerplate); |
| 5552 } else { | 5552 } else { |
| 5553 NoObservableSideEffectsScope no_effects(this); | 5553 NoObservableSideEffectsScope no_effects(this); |
| 5554 Handle<FixedArray> closure_literals(closure->literals(), isolate()); | 5554 Handle<FixedArray> closure_literals(closure->literals(), isolate()); |
| 5555 Handle<FixedArray> constant_properties = expr->constant_properties(); | 5555 Handle<FixedArray> constant_properties = expr->constant_properties(); |
| 5556 int literal_index = expr->literal_index(); | 5556 int literal_index = expr->literal_index(); |
| 5557 int flags = expr->fast_elements() | 5557 int flags = expr->ComputeFlags(true); |
| 5558 ? ObjectLiteral::kFastElements : ObjectLiteral::kNoFlags; | |
| 5559 flags |= expr->has_function() | |
| 5560 ? ObjectLiteral::kHasFunction : ObjectLiteral::kNoFlags; | |
| 5561 | 5558 |
| 5562 Add<HPushArguments>(Add<HConstant>(closure_literals), | 5559 Add<HPushArguments>(Add<HConstant>(closure_literals), |
| 5563 Add<HConstant>(literal_index), | 5560 Add<HConstant>(literal_index), |
| 5564 Add<HConstant>(constant_properties), | 5561 Add<HConstant>(constant_properties), |
| 5565 Add<HConstant>(flags)); | 5562 Add<HConstant>(flags)); |
| 5566 | 5563 |
| 5567 // TODO(mvstanton): Add a flag to turn off creation of any | |
| 5568 // AllocationMementos for this call: we are in crankshaft and should have | |
| 5569 // learned enough about transition behavior to stop emitting mementos. | |
| 5570 Runtime::FunctionId function_id = Runtime::kCreateObjectLiteral; | 5564 Runtime::FunctionId function_id = Runtime::kCreateObjectLiteral; |
| 5571 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), | 5565 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), |
| 5572 Runtime::FunctionForId(function_id), | 5566 Runtime::FunctionForId(function_id), |
| 5573 4); | 5567 4); |
| 5574 } | 5568 } |
| 5575 | 5569 |
| 5576 // The object is expected in the bailout environment during computation | 5570 // The object is expected in the bailout environment during computation |
| 5577 // of the property values and is the value of the entire expression. | 5571 // of the property values and is the value of the entire expression. |
| 5578 Push(literal); | 5572 Push(literal); |
| 5579 | 5573 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5718 AllocationSiteUsageContext usage_context(isolate(), site, false); | 5712 AllocationSiteUsageContext usage_context(isolate(), site, false); |
| 5719 usage_context.EnterNewScope(); | 5713 usage_context.EnterNewScope(); |
| 5720 literal = BuildFastLiteral(boilerplate_object, &usage_context); | 5714 literal = BuildFastLiteral(boilerplate_object, &usage_context); |
| 5721 usage_context.ExitScope(site, boilerplate_object); | 5715 usage_context.ExitScope(site, boilerplate_object); |
| 5722 } else { | 5716 } else { |
| 5723 NoObservableSideEffectsScope no_effects(this); | 5717 NoObservableSideEffectsScope no_effects(this); |
| 5724 // Boilerplate already exists and constant elements are never accessed, | 5718 // Boilerplate already exists and constant elements are never accessed, |
| 5725 // pass an empty fixed array to the runtime function instead. | 5719 // pass an empty fixed array to the runtime function instead. |
| 5726 Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array(); | 5720 Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array(); |
| 5727 int literal_index = expr->literal_index(); | 5721 int literal_index = expr->literal_index(); |
| 5728 int flags = expr->depth() == 1 | 5722 int flags = expr->ComputeFlags(true); |
| 5729 ? ArrayLiteral::kShallowElements | |
| 5730 : ArrayLiteral::kNoFlags; | |
| 5731 flags |= ArrayLiteral::kDisableMementos; | |
| 5732 | 5723 |
| 5733 Add<HPushArguments>(Add<HConstant>(literals), | 5724 Add<HPushArguments>(Add<HConstant>(literals), |
| 5734 Add<HConstant>(literal_index), | 5725 Add<HConstant>(literal_index), |
| 5735 Add<HConstant>(constants), | 5726 Add<HConstant>(constants), |
| 5736 Add<HConstant>(flags)); | 5727 Add<HConstant>(flags)); |
| 5737 | 5728 |
| 5738 Runtime::FunctionId function_id = Runtime::kCreateArrayLiteral; | 5729 Runtime::FunctionId function_id = Runtime::kCreateArrayLiteral; |
| 5739 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), | 5730 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), |
| 5740 Runtime::FunctionForId(function_id), | 5731 Runtime::FunctionForId(function_id), |
| 5741 4); | 5732 4); |
| (...skipping 7660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13402 if (ShouldProduceTraceOutput()) { | 13393 if (ShouldProduceTraceOutput()) { |
| 13403 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13394 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13404 } | 13395 } |
| 13405 | 13396 |
| 13406 #ifdef DEBUG | 13397 #ifdef DEBUG |
| 13407 graph_->Verify(false); // No full verify. | 13398 graph_->Verify(false); // No full verify. |
| 13408 #endif | 13399 #endif |
| 13409 } | 13400 } |
| 13410 | 13401 |
| 13411 } } // namespace v8::internal | 13402 } } // namespace v8::internal |
| OLD | NEW |