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