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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 5433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5444 } | 5444 } |
5445 | 5445 |
5446 if (!boilerplate.is_null() && | 5446 if (!boilerplate.is_null() && |
5447 IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) { | 5447 IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) { |
5448 AllocationSiteUsageContext site_context(isolate(), site, false); | 5448 AllocationSiteUsageContext site_context(isolate(), site, false); |
5449 site_context.EnterNewScope(); | 5449 site_context.EnterNewScope(); |
5450 literal = BuildFastLiteral(boilerplate, &site_context); | 5450 literal = BuildFastLiteral(boilerplate, &site_context); |
5451 site_context.ExitScope(site, boilerplate); | 5451 site_context.ExitScope(site, boilerplate); |
5452 } else { | 5452 } else { |
5453 NoObservableSideEffectsScope no_effects(this); | 5453 NoObservableSideEffectsScope no_effects(this); |
5454 Handle<FixedArray> constant_properties = expr->constant_properties(); | 5454 Handle<FixedArray> constant_properties = |
| 5455 expr->GetOrBuildConstantProperties(isolate()); |
5455 int literal_index = expr->literal_index(); | 5456 int literal_index = expr->literal_index(); |
5456 int flags = expr->ComputeFlags(true); | 5457 int flags = expr->ComputeFlags(true); |
5457 | 5458 |
5458 Add<HPushArguments>(AddThisFunction(), Add<HConstant>(literal_index), | 5459 Add<HPushArguments>(AddThisFunction(), Add<HConstant>(literal_index), |
5459 Add<HConstant>(constant_properties), | 5460 Add<HConstant>(constant_properties), |
5460 Add<HConstant>(flags)); | 5461 Add<HConstant>(flags)); |
5461 | 5462 |
5462 Runtime::FunctionId function_id = Runtime::kCreateObjectLiteral; | 5463 Runtime::FunctionId function_id = Runtime::kCreateObjectLiteral; |
5463 literal = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 4); | 5464 literal = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 4); |
5464 } | 5465 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5567 if (!boilerplate_object.is_null() && | 5568 if (!boilerplate_object.is_null() && |
5568 IsFastLiteral(boilerplate_object, kMaxFastLiteralDepth, | 5569 IsFastLiteral(boilerplate_object, kMaxFastLiteralDepth, |
5569 &max_properties)) { | 5570 &max_properties)) { |
5570 DCHECK(site->SitePointsToLiteral()); | 5571 DCHECK(site->SitePointsToLiteral()); |
5571 AllocationSiteUsageContext site_context(isolate(), site, false); | 5572 AllocationSiteUsageContext site_context(isolate(), site, false); |
5572 site_context.EnterNewScope(); | 5573 site_context.EnterNewScope(); |
5573 literal = BuildFastLiteral(boilerplate_object, &site_context); | 5574 literal = BuildFastLiteral(boilerplate_object, &site_context); |
5574 site_context.ExitScope(site, boilerplate_object); | 5575 site_context.ExitScope(site, boilerplate_object); |
5575 } else { | 5576 } else { |
5576 NoObservableSideEffectsScope no_effects(this); | 5577 NoObservableSideEffectsScope no_effects(this); |
5577 Handle<ConstantElementsPair> constants = expr->constant_elements(); | 5578 Handle<ConstantElementsPair> constants = |
| 5579 expr->GetOrBuildConstantElements(isolate()); |
5578 int literal_index = expr->literal_index(); | 5580 int literal_index = expr->literal_index(); |
5579 int flags = expr->ComputeFlags(true); | 5581 int flags = expr->ComputeFlags(true); |
5580 | 5582 |
5581 Add<HPushArguments>(AddThisFunction(), Add<HConstant>(literal_index), | 5583 Add<HPushArguments>(AddThisFunction(), Add<HConstant>(literal_index), |
5582 Add<HConstant>(constants), Add<HConstant>(flags)); | 5584 Add<HConstant>(constants), Add<HConstant>(flags)); |
5583 | 5585 |
5584 Runtime::FunctionId function_id = Runtime::kCreateArrayLiteral; | 5586 Runtime::FunctionId function_id = Runtime::kCreateArrayLiteral; |
5585 literal = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 4); | 5587 literal = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 4); |
5586 | 5588 |
5587 // Register to deopt if the boilerplate ElementsKind changes. | 5589 // Register to deopt if the boilerplate ElementsKind changes. |
(...skipping 7349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12937 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12939 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12938 } | 12940 } |
12939 | 12941 |
12940 #ifdef DEBUG | 12942 #ifdef DEBUG |
12941 graph_->Verify(false); // No full verify. | 12943 graph_->Verify(false); // No full verify. |
12942 #endif | 12944 #endif |
12943 } | 12945 } |
12944 | 12946 |
12945 } // namespace internal | 12947 } // namespace internal |
12946 } // namespace v8 | 12948 } // namespace v8 |
OLD | NEW |