| 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 5432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5443 } | 5443 } |
| 5444 | 5444 |
| 5445 if (!boilerplate.is_null() && | 5445 if (!boilerplate.is_null() && |
| 5446 IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) { | 5446 IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) { |
| 5447 AllocationSiteUsageContext site_context(isolate(), site, false); | 5447 AllocationSiteUsageContext site_context(isolate(), site, false); |
| 5448 site_context.EnterNewScope(); | 5448 site_context.EnterNewScope(); |
| 5449 literal = BuildFastLiteral(boilerplate, &site_context); | 5449 literal = BuildFastLiteral(boilerplate, &site_context); |
| 5450 site_context.ExitScope(site, boilerplate); | 5450 site_context.ExitScope(site, boilerplate); |
| 5451 } else { | 5451 } else { |
| 5452 NoObservableSideEffectsScope no_effects(this); | 5452 NoObservableSideEffectsScope no_effects(this); |
| 5453 Handle<FixedArray> constant_properties = expr->constant_properties(); | 5453 Handle<FixedArray> constant_properties = |
| 5454 expr->GetOrBuildConstantProperties(isolate()); |
| 5454 int literal_index = expr->literal_index(); | 5455 int literal_index = expr->literal_index(); |
| 5455 int flags = expr->ComputeFlags(true); | 5456 int flags = expr->ComputeFlags(true); |
| 5456 | 5457 |
| 5457 Add<HPushArguments>(AddThisFunction(), Add<HConstant>(literal_index), | 5458 Add<HPushArguments>(AddThisFunction(), Add<HConstant>(literal_index), |
| 5458 Add<HConstant>(constant_properties), | 5459 Add<HConstant>(constant_properties), |
| 5459 Add<HConstant>(flags)); | 5460 Add<HConstant>(flags)); |
| 5460 | 5461 |
| 5461 Runtime::FunctionId function_id = Runtime::kCreateObjectLiteral; | 5462 Runtime::FunctionId function_id = Runtime::kCreateObjectLiteral; |
| 5462 literal = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 4); | 5463 literal = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 4); |
| 5463 } | 5464 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5566 if (!boilerplate_object.is_null() && | 5567 if (!boilerplate_object.is_null() && |
| 5567 IsFastLiteral(boilerplate_object, kMaxFastLiteralDepth, | 5568 IsFastLiteral(boilerplate_object, kMaxFastLiteralDepth, |
| 5568 &max_properties)) { | 5569 &max_properties)) { |
| 5569 DCHECK(site->SitePointsToLiteral()); | 5570 DCHECK(site->SitePointsToLiteral()); |
| 5570 AllocationSiteUsageContext site_context(isolate(), site, false); | 5571 AllocationSiteUsageContext site_context(isolate(), site, false); |
| 5571 site_context.EnterNewScope(); | 5572 site_context.EnterNewScope(); |
| 5572 literal = BuildFastLiteral(boilerplate_object, &site_context); | 5573 literal = BuildFastLiteral(boilerplate_object, &site_context); |
| 5573 site_context.ExitScope(site, boilerplate_object); | 5574 site_context.ExitScope(site, boilerplate_object); |
| 5574 } else { | 5575 } else { |
| 5575 NoObservableSideEffectsScope no_effects(this); | 5576 NoObservableSideEffectsScope no_effects(this); |
| 5576 Handle<ConstantElementsPair> constants = expr->constant_elements(); | 5577 Handle<ConstantElementsPair> constants = |
| 5578 expr->GetOrBuildConstantElements(isolate()); |
| 5577 int literal_index = expr->literal_index(); | 5579 int literal_index = expr->literal_index(); |
| 5578 int flags = expr->ComputeFlags(true); | 5580 int flags = expr->ComputeFlags(true); |
| 5579 | 5581 |
| 5580 Add<HPushArguments>(AddThisFunction(), Add<HConstant>(literal_index), | 5582 Add<HPushArguments>(AddThisFunction(), Add<HConstant>(literal_index), |
| 5581 Add<HConstant>(constants), Add<HConstant>(flags)); | 5583 Add<HConstant>(constants), Add<HConstant>(flags)); |
| 5582 | 5584 |
| 5583 Runtime::FunctionId function_id = Runtime::kCreateArrayLiteral; | 5585 Runtime::FunctionId function_id = Runtime::kCreateArrayLiteral; |
| 5584 literal = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 4); | 5586 literal = Add<HCallRuntime>(Runtime::FunctionForId(function_id), 4); |
| 5585 | 5587 |
| 5586 // Register to deopt if the boilerplate ElementsKind changes. | 5588 // Register to deopt if the boilerplate ElementsKind changes. |
| (...skipping 7382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12969 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12971 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12970 } | 12972 } |
| 12971 | 12973 |
| 12972 #ifdef DEBUG | 12974 #ifdef DEBUG |
| 12973 graph_->Verify(false); // No full verify. | 12975 graph_->Verify(false); // No full verify. |
| 12974 #endif | 12976 #endif |
| 12975 } | 12977 } |
| 12976 | 12978 |
| 12977 } // namespace internal | 12979 } // namespace internal |
| 12978 } // namespace v8 | 12980 } // namespace v8 |
| OLD | NEW |