| 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 4382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4393 } | 4393 } |
| 4394 } | 4394 } |
| 4395 | 4395 |
| 4396 | 4396 |
| 4397 bool HOptimizedGraphBuilder::BuildGraph() { | 4397 bool HOptimizedGraphBuilder::BuildGraph() { |
| 4398 if (IsSubclassConstructor(current_info()->literal()->kind())) { | 4398 if (IsSubclassConstructor(current_info()->literal()->kind())) { |
| 4399 Bailout(kSuperReference); | 4399 Bailout(kSuperReference); |
| 4400 return false; | 4400 return false; |
| 4401 } | 4401 } |
| 4402 | 4402 |
| 4403 Scope* scope = current_info()->scope(); | 4403 DeclarationScope* scope = current_info()->scope(); |
| 4404 SetUpScope(scope); | 4404 SetUpScope(scope); |
| 4405 | 4405 |
| 4406 // Add an edge to the body entry. This is warty: the graph's start | 4406 // Add an edge to the body entry. This is warty: the graph's start |
| 4407 // environment will be used by the Lithium translation as the initial | 4407 // environment will be used by the Lithium translation as the initial |
| 4408 // environment on graph entry, but it has now been mutated by the | 4408 // environment on graph entry, but it has now been mutated by the |
| 4409 // Hydrogen translation of the instructions in the start block. This | 4409 // Hydrogen translation of the instructions in the start block. This |
| 4410 // environment uses values which have not been defined yet. These | 4410 // environment uses values which have not been defined yet. These |
| 4411 // Hydrogen instructions will then be replayed by the Lithium | 4411 // Hydrogen instructions will then be replayed by the Lithium |
| 4412 // translation, so they cannot have an environment effect. The edge to | 4412 // translation, so they cannot have an environment effect. The edge to |
| 4413 // the body's entry block (along with some special logic for the start | 4413 // the body's entry block (along with some special logic for the start |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4598 AddInstruction(push_args); | 4598 AddInstruction(push_args); |
| 4599 } | 4599 } |
| 4600 | 4600 |
| 4601 | 4601 |
| 4602 template <class Instruction> | 4602 template <class Instruction> |
| 4603 HInstruction* HOptimizedGraphBuilder::PreProcessCall(Instruction* call) { | 4603 HInstruction* HOptimizedGraphBuilder::PreProcessCall(Instruction* call) { |
| 4604 PushArgumentsFromEnvironment(call->argument_count()); | 4604 PushArgumentsFromEnvironment(call->argument_count()); |
| 4605 return call; | 4605 return call; |
| 4606 } | 4606 } |
| 4607 | 4607 |
| 4608 | 4608 void HOptimizedGraphBuilder::SetUpScope(DeclarationScope* scope) { |
| 4609 void HOptimizedGraphBuilder::SetUpScope(Scope* scope) { | |
| 4610 HEnvironment* prolog_env = environment(); | 4609 HEnvironment* prolog_env = environment(); |
| 4611 int parameter_count = environment()->parameter_count(); | 4610 int parameter_count = environment()->parameter_count(); |
| 4612 ZoneList<HValue*> parameters(parameter_count, zone()); | 4611 ZoneList<HValue*> parameters(parameter_count, zone()); |
| 4613 for (int i = 0; i < parameter_count; ++i) { | 4612 for (int i = 0; i < parameter_count; ++i) { |
| 4614 HInstruction* parameter = Add<HParameter>(static_cast<unsigned>(i)); | 4613 HInstruction* parameter = Add<HParameter>(static_cast<unsigned>(i)); |
| 4615 parameters.Add(parameter, zone()); | 4614 parameters.Add(parameter, zone()); |
| 4616 environment()->Bind(i, parameter); | 4615 environment()->Bind(i, parameter); |
| 4617 } | 4616 } |
| 4618 | 4617 |
| 4619 HConstant* undefined_constant = graph()->GetConstantUndefined(); | 4618 HConstant* undefined_constant = graph()->GetConstantUndefined(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4685 DCHECK(current_block()->HasPredecessor()); | 4684 DCHECK(current_block()->HasPredecessor()); |
| 4686 | 4685 |
| 4687 Scope* outer_scope = scope(); | 4686 Scope* outer_scope = scope(); |
| 4688 Scope* scope = stmt->scope(); | 4687 Scope* scope = stmt->scope(); |
| 4689 BreakAndContinueInfo break_info(stmt, outer_scope); | 4688 BreakAndContinueInfo break_info(stmt, outer_scope); |
| 4690 | 4689 |
| 4691 { BreakAndContinueScope push(&break_info, this); | 4690 { BreakAndContinueScope push(&break_info, this); |
| 4692 if (scope != NULL) { | 4691 if (scope != NULL) { |
| 4693 if (scope->NeedsContext()) { | 4692 if (scope->NeedsContext()) { |
| 4694 // Load the function object. | 4693 // Load the function object. |
| 4695 Scope* declaration_scope = scope->DeclarationScope(); | 4694 DeclarationScope* declaration_scope = scope->GetDeclarationScope(); |
| 4696 HInstruction* function; | 4695 HInstruction* function; |
| 4697 HValue* outer_context = environment()->context(); | 4696 HValue* outer_context = environment()->context(); |
| 4698 if (declaration_scope->is_script_scope() || | 4697 if (declaration_scope->is_script_scope() || |
| 4699 declaration_scope->is_eval_scope()) { | 4698 declaration_scope->is_eval_scope()) { |
| 4700 function = new (zone()) | 4699 function = new (zone()) |
| 4701 HLoadContextSlot(outer_context, Context::CLOSURE_INDEX, | 4700 HLoadContextSlot(outer_context, Context::CLOSURE_INDEX, |
| 4702 HLoadContextSlot::kNoCheck); | 4701 HLoadContextSlot::kNoCheck); |
| 4703 } else { | 4702 } else { |
| 4704 function = New<HThisFunction>(); | 4703 function = New<HThisFunction>(); |
| 4705 } | 4704 } |
| (...skipping 8069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12775 frame_type_(JS_FUNCTION), | 12774 frame_type_(JS_FUNCTION), |
| 12776 parameter_count_(0), | 12775 parameter_count_(0), |
| 12777 specials_count_(1), | 12776 specials_count_(1), |
| 12778 local_count_(0), | 12777 local_count_(0), |
| 12779 outer_(outer), | 12778 outer_(outer), |
| 12780 entry_(NULL), | 12779 entry_(NULL), |
| 12781 pop_count_(0), | 12780 pop_count_(0), |
| 12782 push_count_(0), | 12781 push_count_(0), |
| 12783 ast_id_(BailoutId::None()), | 12782 ast_id_(BailoutId::None()), |
| 12784 zone_(zone) { | 12783 zone_(zone) { |
| 12785 Scope* declaration_scope = scope->DeclarationScope(); | 12784 DeclarationScope* declaration_scope = scope->GetDeclarationScope(); |
| 12786 Initialize(declaration_scope->num_parameters() + 1, | 12785 Initialize(declaration_scope->num_parameters() + 1, |
| 12787 declaration_scope->num_stack_slots(), 0); | 12786 declaration_scope->num_stack_slots(), 0); |
| 12788 } | 12787 } |
| 12789 | 12788 |
| 12790 | 12789 |
| 12791 HEnvironment::HEnvironment(Zone* zone, int parameter_count) | 12790 HEnvironment::HEnvironment(Zone* zone, int parameter_count) |
| 12792 : values_(0, zone), | 12791 : values_(0, zone), |
| 12793 frame_type_(STUB), | 12792 frame_type_(STUB), |
| 12794 parameter_count_(parameter_count), | 12793 parameter_count_(parameter_count), |
| 12795 specials_count_(1), | 12794 specials_count_(1), |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13421 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13420 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13422 } | 13421 } |
| 13423 | 13422 |
| 13424 #ifdef DEBUG | 13423 #ifdef DEBUG |
| 13425 graph_->Verify(false); // No full verify. | 13424 graph_->Verify(false); // No full verify. |
| 13426 #endif | 13425 #endif |
| 13427 } | 13426 } |
| 13428 | 13427 |
| 13429 } // namespace internal | 13428 } // namespace internal |
| 13430 } // namespace v8 | 13429 } // namespace v8 |
| OLD | NEW |