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 5533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5544 IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) { | 5544 IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) { |
5545 AllocationSiteUsageContext usage_context(isolate(), site, false); | 5545 AllocationSiteUsageContext usage_context(isolate(), site, false); |
5546 usage_context.EnterNewScope(); | 5546 usage_context.EnterNewScope(); |
5547 literal = BuildFastLiteral(boilerplate, &usage_context); | 5547 literal = BuildFastLiteral(boilerplate, &usage_context); |
5548 usage_context.ExitScope(site, boilerplate); | 5548 usage_context.ExitScope(site, boilerplate); |
5549 } else { | 5549 } else { |
5550 NoObservableSideEffectsScope no_effects(this); | 5550 NoObservableSideEffectsScope no_effects(this); |
5551 Handle<FixedArray> closure_literals(closure->literals(), isolate()); | 5551 Handle<FixedArray> closure_literals(closure->literals(), isolate()); |
5552 Handle<FixedArray> constant_properties = expr->constant_properties(); | 5552 Handle<FixedArray> constant_properties = expr->constant_properties(); |
5553 int literal_index = expr->literal_index(); | 5553 int literal_index = expr->literal_index(); |
5554 int flags = expr->fast_elements() | 5554 int flags = expr->ComputeFlags(true); |
5555 ? ObjectLiteral::kFastElements : ObjectLiteral::kNoFlags; | |
5556 flags |= expr->has_function() | |
5557 ? ObjectLiteral::kHasFunction : ObjectLiteral::kNoFlags; | |
5558 | 5555 |
5559 Add<HPushArguments>(Add<HConstant>(closure_literals), | 5556 Add<HPushArguments>(Add<HConstant>(closure_literals), |
5560 Add<HConstant>(literal_index), | 5557 Add<HConstant>(literal_index), |
5561 Add<HConstant>(constant_properties), | 5558 Add<HConstant>(constant_properties), |
5562 Add<HConstant>(flags)); | 5559 Add<HConstant>(flags)); |
5563 | 5560 |
5564 // TODO(mvstanton): Add a flag to turn off creation of any | |
5565 // AllocationMementos for this call: we are in crankshaft and should have | |
5566 // learned enough about transition behavior to stop emitting mementos. | |
5567 Runtime::FunctionId function_id = Runtime::kCreateObjectLiteral; | 5561 Runtime::FunctionId function_id = Runtime::kCreateObjectLiteral; |
5568 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), | 5562 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), |
5569 Runtime::FunctionForId(function_id), | 5563 Runtime::FunctionForId(function_id), |
5570 4); | 5564 4); |
5571 } | 5565 } |
5572 | 5566 |
5573 // The object is expected in the bailout environment during computation | 5567 // The object is expected in the bailout environment during computation |
5574 // of the property values and is the value of the entire expression. | 5568 // of the property values and is the value of the entire expression. |
5575 Push(literal); | 5569 Push(literal); |
5576 | 5570 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5715 AllocationSiteUsageContext usage_context(isolate(), site, false); | 5709 AllocationSiteUsageContext usage_context(isolate(), site, false); |
5716 usage_context.EnterNewScope(); | 5710 usage_context.EnterNewScope(); |
5717 literal = BuildFastLiteral(boilerplate_object, &usage_context); | 5711 literal = BuildFastLiteral(boilerplate_object, &usage_context); |
5718 usage_context.ExitScope(site, boilerplate_object); | 5712 usage_context.ExitScope(site, boilerplate_object); |
5719 } else { | 5713 } else { |
5720 NoObservableSideEffectsScope no_effects(this); | 5714 NoObservableSideEffectsScope no_effects(this); |
5721 // Boilerplate already exists and constant elements are never accessed, | 5715 // Boilerplate already exists and constant elements are never accessed, |
5722 // pass an empty fixed array to the runtime function instead. | 5716 // pass an empty fixed array to the runtime function instead. |
5723 Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array(); | 5717 Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array(); |
5724 int literal_index = expr->literal_index(); | 5718 int literal_index = expr->literal_index(); |
5725 int flags = expr->depth() == 1 | 5719 int flags = expr->ComputeFlags(true); |
5726 ? ArrayLiteral::kShallowElements | |
5727 : ArrayLiteral::kNoFlags; | |
5728 flags |= ArrayLiteral::kDisableMementos; | |
5729 | 5720 |
5730 Add<HPushArguments>(Add<HConstant>(literals), | 5721 Add<HPushArguments>(Add<HConstant>(literals), |
5731 Add<HConstant>(literal_index), | 5722 Add<HConstant>(literal_index), |
5732 Add<HConstant>(constants), | 5723 Add<HConstant>(constants), |
5733 Add<HConstant>(flags)); | 5724 Add<HConstant>(flags)); |
5734 | 5725 |
5735 Runtime::FunctionId function_id = Runtime::kCreateArrayLiteral; | 5726 Runtime::FunctionId function_id = Runtime::kCreateArrayLiteral; |
5736 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), | 5727 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), |
5737 Runtime::FunctionForId(function_id), | 5728 Runtime::FunctionForId(function_id), |
5738 4); | 5729 4); |
(...skipping 7684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13423 if (ShouldProduceTraceOutput()) { | 13414 if (ShouldProduceTraceOutput()) { |
13424 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13415 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13425 } | 13416 } |
13426 | 13417 |
13427 #ifdef DEBUG | 13418 #ifdef DEBUG |
13428 graph_->Verify(false); // No full verify. | 13419 graph_->Verify(false); // No full verify. |
13429 #endif | 13420 #endif |
13430 } | 13421 } |
13431 | 13422 |
13432 } } // namespace v8::internal | 13423 } } // namespace v8::internal |
OLD | NEW |