Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 2209573002: Separate Scope into DeclarationScope and Scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move has_simple_parameters_ to DeclarationScope Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 Scope* scope = current_info()->scope(); 4402 DeclarationScope* 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
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 4607 void HOptimizedGraphBuilder::SetUpScope(DeclarationScope* scope) {
4608 void HOptimizedGraphBuilder::SetUpScope(Scope* scope) {
4609 HEnvironment* prolog_env = environment(); 4608 HEnvironment* prolog_env = environment();
4610 int parameter_count = environment()->parameter_count(); 4609 int parameter_count = environment()->parameter_count();
4611 ZoneList<HValue*> parameters(parameter_count, zone()); 4610 ZoneList<HValue*> parameters(parameter_count, zone());
4612 for (int i = 0; i < parameter_count; ++i) { 4611 for (int i = 0; i < parameter_count; ++i) {
4613 HInstruction* parameter = Add<HParameter>(static_cast<unsigned>(i)); 4612 HInstruction* parameter = Add<HParameter>(static_cast<unsigned>(i));
4614 parameters.Add(parameter, zone()); 4613 parameters.Add(parameter, zone());
4615 environment()->Bind(i, parameter); 4614 environment()->Bind(i, parameter);
4616 } 4615 }
4617 4616
4618 HConstant* undefined_constant = graph()->GetConstantUndefined(); 4617 HConstant* undefined_constant = graph()->GetConstantUndefined();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
4684 DCHECK(current_block()->HasPredecessor()); 4683 DCHECK(current_block()->HasPredecessor());
4685 4684
4686 Scope* outer_scope = scope(); 4685 Scope* outer_scope = scope();
4687 Scope* scope = stmt->scope(); 4686 Scope* scope = stmt->scope();
4688 BreakAndContinueInfo break_info(stmt, outer_scope); 4687 BreakAndContinueInfo break_info(stmt, outer_scope);
4689 4688
4690 { BreakAndContinueScope push(&break_info, this); 4689 { BreakAndContinueScope push(&break_info, this);
4691 if (scope != NULL) { 4690 if (scope != NULL) {
4692 if (scope->NeedsContext()) { 4691 if (scope->NeedsContext()) {
4693 // Load the function object. 4692 // Load the function object.
4694 Scope* declaration_scope = scope->DeclarationScope(); 4693 DeclarationScope* declaration_scope = scope->GetDeclarationScope();
4695 HInstruction* function; 4694 HInstruction* function;
4696 HValue* outer_context = environment()->context(); 4695 HValue* outer_context = environment()->context();
4697 if (declaration_scope->is_script_scope() || 4696 if (declaration_scope->is_script_scope() ||
4698 declaration_scope->is_eval_scope()) { 4697 declaration_scope->is_eval_scope()) {
4699 function = new (zone()) 4698 function = new (zone())
4700 HLoadContextSlot(outer_context, Context::CLOSURE_INDEX, 4699 HLoadContextSlot(outer_context, Context::CLOSURE_INDEX,
4701 HLoadContextSlot::kNoCheck); 4700 HLoadContextSlot::kNoCheck);
4702 } else { 4701 } else {
4703 function = New<HThisFunction>(); 4702 function = New<HThisFunction>();
4704 } 4703 }
(...skipping 8069 matching lines...) Expand 10 before | Expand all | Expand 10 after
12774 frame_type_(JS_FUNCTION), 12773 frame_type_(JS_FUNCTION),
12775 parameter_count_(0), 12774 parameter_count_(0),
12776 specials_count_(1), 12775 specials_count_(1),
12777 local_count_(0), 12776 local_count_(0),
12778 outer_(outer), 12777 outer_(outer),
12779 entry_(NULL), 12778 entry_(NULL),
12780 pop_count_(0), 12779 pop_count_(0),
12781 push_count_(0), 12780 push_count_(0),
12782 ast_id_(BailoutId::None()), 12781 ast_id_(BailoutId::None()),
12783 zone_(zone) { 12782 zone_(zone) {
12784 Scope* declaration_scope = scope->DeclarationScope(); 12783 DeclarationScope* declaration_scope = scope->GetDeclarationScope();
12785 Initialize(declaration_scope->num_parameters() + 1, 12784 Initialize(declaration_scope->num_parameters() + 1,
12786 declaration_scope->num_stack_slots(), 0); 12785 declaration_scope->num_stack_slots(), 0);
12787 } 12786 }
12788 12787
12789 12788
12790 HEnvironment::HEnvironment(Zone* zone, int parameter_count) 12789 HEnvironment::HEnvironment(Zone* zone, int parameter_count)
12791 : values_(0, zone), 12790 : values_(0, zone),
12792 frame_type_(STUB), 12791 frame_type_(STUB),
12793 parameter_count_(parameter_count), 12792 parameter_count_(parameter_count),
12794 specials_count_(1), 12793 specials_count_(1),
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
13420 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13419 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13421 } 13420 }
13422 13421
13423 #ifdef DEBUG 13422 #ifdef DEBUG
13424 graph_->Verify(false); // No full verify. 13423 graph_->Verify(false); // No full verify.
13425 #endif 13424 #endif
13426 } 13425 }
13427 13426
13428 } // namespace internal 13427 } // namespace internal
13429 } // namespace v8 13428 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698