| 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/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 4478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4489 DCHECK(!HasStackOverflow()); | 4489 DCHECK(!HasStackOverflow()); |
| 4490 DCHECK(current_block() != NULL); | 4490 DCHECK(current_block() != NULL); |
| 4491 DCHECK(current_block()->HasPredecessor()); | 4491 DCHECK(current_block()->HasPredecessor()); |
| 4492 | 4492 |
| 4493 Scope* outer_scope = scope(); | 4493 Scope* outer_scope = scope(); |
| 4494 Scope* scope = stmt->scope(); | 4494 Scope* scope = stmt->scope(); |
| 4495 BreakAndContinueInfo break_info(stmt, outer_scope); | 4495 BreakAndContinueInfo break_info(stmt, outer_scope); |
| 4496 | 4496 |
| 4497 { BreakAndContinueScope push(&break_info, this); | 4497 { BreakAndContinueScope push(&break_info, this); |
| 4498 if (scope != NULL) { | 4498 if (scope != NULL) { |
| 4499 // Load the function object. | 4499 if (scope->ContextLocalCount() > 0) { |
| 4500 Scope* declaration_scope = scope->DeclarationScope(); | 4500 // Load the function object. |
| 4501 HInstruction* function; | 4501 Scope* declaration_scope = scope->DeclarationScope(); |
| 4502 HValue* outer_context = environment()->context(); | 4502 HInstruction* function; |
| 4503 if (declaration_scope->is_script_scope() || | 4503 HValue* outer_context = environment()->context(); |
| 4504 declaration_scope->is_eval_scope()) { | 4504 if (declaration_scope->is_script_scope() || |
| 4505 function = new(zone()) HLoadContextSlot( | 4505 declaration_scope->is_eval_scope()) { |
| 4506 outer_context, Context::CLOSURE_INDEX, HLoadContextSlot::kNoCheck); | 4506 function = new (zone()) |
| 4507 } else { | 4507 HLoadContextSlot(outer_context, Context::CLOSURE_INDEX, |
| 4508 function = New<HThisFunction>(); | 4508 HLoadContextSlot::kNoCheck); |
| 4509 } | 4509 } else { |
| 4510 AddInstruction(function); | 4510 function = New<HThisFunction>(); |
| 4511 // Allocate a block context and store it to the stack frame. | 4511 } |
| 4512 HInstruction* inner_context = Add<HAllocateBlockContext>( | 4512 AddInstruction(function); |
| 4513 outer_context, function, scope->GetScopeInfo(isolate())); | 4513 // Allocate a block context and store it to the stack frame. |
| 4514 HInstruction* instr = Add<HStoreFrameContext>(inner_context); | 4514 HInstruction* inner_context = Add<HAllocateBlockContext>( |
| 4515 set_scope(scope); | 4515 outer_context, function, scope->GetScopeInfo(isolate())); |
| 4516 environment()->BindContext(inner_context); | 4516 HInstruction* instr = Add<HStoreFrameContext>(inner_context); |
| 4517 if (instr->HasObservableSideEffects()) { | 4517 set_scope(scope); |
| 4518 AddSimulate(stmt->EntryId(), REMOVABLE_SIMULATE); | 4518 environment()->BindContext(inner_context); |
| 4519 if (instr->HasObservableSideEffects()) { |
| 4520 AddSimulate(stmt->EntryId(), REMOVABLE_SIMULATE); |
| 4521 } |
| 4519 } | 4522 } |
| 4520 VisitDeclarations(scope->declarations()); | 4523 VisitDeclarations(scope->declarations()); |
| 4521 AddSimulate(stmt->DeclsId(), REMOVABLE_SIMULATE); | 4524 AddSimulate(stmt->DeclsId(), REMOVABLE_SIMULATE); |
| 4522 } | 4525 } |
| 4523 CHECK_BAILOUT(VisitStatements(stmt->statements())); | 4526 CHECK_BAILOUT(VisitStatements(stmt->statements())); |
| 4524 } | 4527 } |
| 4525 set_scope(outer_scope); | 4528 set_scope(outer_scope); |
| 4526 if (scope != NULL && current_block() != NULL) { | 4529 if (scope != NULL && current_block() != NULL && |
| 4530 scope->ContextLocalCount() > 0) { |
| 4527 HValue* inner_context = environment()->context(); | 4531 HValue* inner_context = environment()->context(); |
| 4528 HValue* outer_context = Add<HLoadNamedField>( | 4532 HValue* outer_context = Add<HLoadNamedField>( |
| 4529 inner_context, nullptr, | 4533 inner_context, nullptr, |
| 4530 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); | 4534 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); |
| 4531 | 4535 |
| 4532 HInstruction* instr = Add<HStoreFrameContext>(outer_context); | 4536 HInstruction* instr = Add<HStoreFrameContext>(outer_context); |
| 4533 environment()->BindContext(outer_context); | 4537 environment()->BindContext(outer_context); |
| 4534 if (instr->HasObservableSideEffects()) { | 4538 if (instr->HasObservableSideEffects()) { |
| 4535 AddSimulate(stmt->ExitId(), REMOVABLE_SIMULATE); | 4539 AddSimulate(stmt->ExitId(), REMOVABLE_SIMULATE); |
| 4536 } | 4540 } |
| (...skipping 8427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12964 if (ShouldProduceTraceOutput()) { | 12968 if (ShouldProduceTraceOutput()) { |
| 12965 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12969 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12966 } | 12970 } |
| 12967 | 12971 |
| 12968 #ifdef DEBUG | 12972 #ifdef DEBUG |
| 12969 graph_->Verify(false); // No full verify. | 12973 graph_->Verify(false); // No full verify. |
| 12970 #endif | 12974 #endif |
| 12971 } | 12975 } |
| 12972 | 12976 |
| 12973 } } // namespace v8::internal | 12977 } } // namespace v8::internal |
| OLD | NEW |