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

Side by Side Diff: src/hydrogen.cc

Issue 981203003: Stack allocate lexical locals + hoist stack slots (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Feedback + rebased Created 5 years, 8 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
« no previous file with comments | « src/full-codegen.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 4494 matching lines...) Expand 10 before | Expand all | Expand 10 after
4505 DCHECK(!HasStackOverflow()); 4505 DCHECK(!HasStackOverflow());
4506 DCHECK(current_block() != NULL); 4506 DCHECK(current_block() != NULL);
4507 DCHECK(current_block()->HasPredecessor()); 4507 DCHECK(current_block()->HasPredecessor());
4508 4508
4509 Scope* outer_scope = scope(); 4509 Scope* outer_scope = scope();
4510 Scope* scope = stmt->scope(); 4510 Scope* scope = stmt->scope();
4511 BreakAndContinueInfo break_info(stmt, outer_scope); 4511 BreakAndContinueInfo break_info(stmt, outer_scope);
4512 4512
4513 { BreakAndContinueScope push(&break_info, this); 4513 { BreakAndContinueScope push(&break_info, this);
4514 if (scope != NULL) { 4514 if (scope != NULL) {
4515 // Load the function object. 4515 if (scope->ContextLocalCount() > 0) {
4516 Scope* declaration_scope = scope->DeclarationScope(); 4516 // Load the function object.
4517 HInstruction* function; 4517 Scope* declaration_scope = scope->DeclarationScope();
4518 HValue* outer_context = environment()->context(); 4518 HInstruction* function;
4519 if (declaration_scope->is_script_scope() || 4519 HValue* outer_context = environment()->context();
4520 declaration_scope->is_eval_scope()) { 4520 if (declaration_scope->is_script_scope() ||
4521 function = new(zone()) HLoadContextSlot( 4521 declaration_scope->is_eval_scope()) {
4522 outer_context, Context::CLOSURE_INDEX, HLoadContextSlot::kNoCheck); 4522 function = new (zone())
4523 } else { 4523 HLoadContextSlot(outer_context, Context::CLOSURE_INDEX,
4524 function = New<HThisFunction>(); 4524 HLoadContextSlot::kNoCheck);
4525 } 4525 } else {
4526 AddInstruction(function); 4526 function = New<HThisFunction>();
4527 // Allocate a block context and store it to the stack frame. 4527 }
4528 HInstruction* inner_context = Add<HAllocateBlockContext>( 4528 AddInstruction(function);
4529 outer_context, function, scope->GetScopeInfo(isolate())); 4529 // Allocate a block context and store it to the stack frame.
4530 HInstruction* instr = Add<HStoreFrameContext>(inner_context); 4530 HInstruction* inner_context = Add<HAllocateBlockContext>(
4531 set_scope(scope); 4531 outer_context, function, scope->GetScopeInfo(isolate()));
4532 environment()->BindContext(inner_context); 4532 HInstruction* instr = Add<HStoreFrameContext>(inner_context);
4533 if (instr->HasObservableSideEffects()) { 4533 set_scope(scope);
4534 AddSimulate(stmt->EntryId(), REMOVABLE_SIMULATE); 4534 environment()->BindContext(inner_context);
4535 if (instr->HasObservableSideEffects()) {
4536 AddSimulate(stmt->EntryId(), REMOVABLE_SIMULATE);
4537 }
4535 } 4538 }
4536 VisitDeclarations(scope->declarations()); 4539 VisitDeclarations(scope->declarations());
4537 AddSimulate(stmt->DeclsId(), REMOVABLE_SIMULATE); 4540 AddSimulate(stmt->DeclsId(), REMOVABLE_SIMULATE);
4538 } 4541 }
4539 CHECK_BAILOUT(VisitStatements(stmt->statements())); 4542 CHECK_BAILOUT(VisitStatements(stmt->statements()));
4540 } 4543 }
4541 set_scope(outer_scope); 4544 set_scope(outer_scope);
4542 if (scope != NULL && current_block() != NULL) { 4545 if (scope != NULL && current_block() != NULL &&
4546 scope->ContextLocalCount() > 0) {
4543 HValue* inner_context = environment()->context(); 4547 HValue* inner_context = environment()->context();
4544 HValue* outer_context = Add<HLoadNamedField>( 4548 HValue* outer_context = Add<HLoadNamedField>(
4545 inner_context, nullptr, 4549 inner_context, nullptr,
4546 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); 4550 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX));
4547 4551
4548 HInstruction* instr = Add<HStoreFrameContext>(outer_context); 4552 HInstruction* instr = Add<HStoreFrameContext>(outer_context);
4549 environment()->BindContext(outer_context); 4553 environment()->BindContext(outer_context);
4550 if (instr->HasObservableSideEffects()) { 4554 if (instr->HasObservableSideEffects()) {
4551 AddSimulate(stmt->ExitId(), REMOVABLE_SIMULATE); 4555 AddSimulate(stmt->ExitId(), REMOVABLE_SIMULATE);
4552 } 4556 }
(...skipping 8470 matching lines...) Expand 10 before | Expand all | Expand 10 after
13023 if (ShouldProduceTraceOutput()) { 13027 if (ShouldProduceTraceOutput()) {
13024 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13028 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13025 } 13029 }
13026 13030
13027 #ifdef DEBUG 13031 #ifdef DEBUG
13028 graph_->Verify(false); // No full verify. 13032 graph_->Verify(false); // No full verify.
13029 #endif 13033 #endif
13030 } 13034 }
13031 13035
13032 } } // namespace v8::internal 13036 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698