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