Chromium Code Reviews| 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 <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
| 10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
| (...skipping 4681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4692 } else { | 4692 } else { |
| 4693 function = New<HThisFunction>(); | 4693 function = New<HThisFunction>(); |
| 4694 } | 4694 } |
| 4695 AddInstruction(function); | 4695 AddInstruction(function); |
| 4696 // Allocate a block context and store it to the stack frame. | 4696 // Allocate a block context and store it to the stack frame. |
| 4697 HValue* scope_info = Add<HConstant>(scope->GetScopeInfo(isolate())); | 4697 HValue* scope_info = Add<HConstant>(scope->GetScopeInfo(isolate())); |
| 4698 Add<HPushArguments>(scope_info, function); | 4698 Add<HPushArguments>(scope_info, function); |
| 4699 HInstruction* inner_context = Add<HCallRuntime>( | 4699 HInstruction* inner_context = Add<HCallRuntime>( |
| 4700 Runtime::FunctionForId(Runtime::kPushBlockContext), 2); | 4700 Runtime::FunctionForId(Runtime::kPushBlockContext), 2); |
| 4701 inner_context->SetFlag(HValue::kHasNoObservableSideEffects); | 4701 inner_context->SetFlag(HValue::kHasNoObservableSideEffects); |
| 4702 HInstruction* instr = Add<HStoreFrameContext>(inner_context); | |
| 4703 set_scope(scope); | 4702 set_scope(scope); |
| 4704 environment()->BindContext(inner_context); | 4703 environment()->BindContext(inner_context); |
| 4705 if (instr->HasObservableSideEffects()) { | |
| 4706 AddSimulate(stmt->EntryId(), REMOVABLE_SIMULATE); | |
|
Benedikt Meurer
2016/03/30 07:07:56
Please also remove this BailoutId from the Stateme
| |
| 4707 } | |
| 4708 } | 4704 } |
| 4709 VisitDeclarations(scope->declarations()); | 4705 VisitDeclarations(scope->declarations()); |
| 4710 AddSimulate(stmt->DeclsId(), REMOVABLE_SIMULATE); | 4706 AddSimulate(stmt->DeclsId(), REMOVABLE_SIMULATE); |
| 4711 } | 4707 } |
| 4712 CHECK_BAILOUT(VisitStatements(stmt->statements())); | 4708 CHECK_BAILOUT(VisitStatements(stmt->statements())); |
| 4713 } | 4709 } |
| 4714 set_scope(outer_scope); | 4710 set_scope(outer_scope); |
| 4715 if (scope != NULL && current_block() != NULL && | 4711 if (scope != NULL && current_block() != NULL && |
| 4716 scope->ContextLocalCount() > 0) { | 4712 scope->ContextLocalCount() > 0) { |
| 4717 HValue* inner_context = environment()->context(); | 4713 HValue* inner_context = environment()->context(); |
| 4718 HValue* outer_context = Add<HLoadNamedField>( | 4714 HValue* outer_context = Add<HLoadNamedField>( |
| 4719 inner_context, nullptr, | 4715 inner_context, nullptr, |
| 4720 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); | 4716 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); |
| 4721 | 4717 |
| 4722 HInstruction* instr = Add<HStoreFrameContext>(outer_context); | |
| 4723 environment()->BindContext(outer_context); | 4718 environment()->BindContext(outer_context); |
| 4724 if (instr->HasObservableSideEffects()) { | |
| 4725 AddSimulate(stmt->ExitId(), REMOVABLE_SIMULATE); | |
|
Benedikt Meurer
2016/03/30 07:07:56
Please also remove this BailoutId from the Stateme
| |
| 4726 } | |
| 4727 } | 4719 } |
| 4728 HBasicBlock* break_block = break_info.break_block(); | 4720 HBasicBlock* break_block = break_info.break_block(); |
| 4729 if (break_block != NULL) { | 4721 if (break_block != NULL) { |
| 4730 if (current_block() != NULL) Goto(break_block); | 4722 if (current_block() != NULL) Goto(break_block); |
| 4731 break_block->SetJoinId(stmt->ExitId()); | 4723 break_block->SetJoinId(stmt->ExitId()); |
| 4732 set_current_block(break_block); | 4724 set_current_block(break_block); |
| 4733 } | 4725 } |
| 4734 } | 4726 } |
| 4735 | 4727 |
| 4736 | 4728 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4856 HValue* context = environment()->context(); | 4848 HValue* context = environment()->context(); |
| 4857 Drop(drop_extra); | 4849 Drop(drop_extra); |
| 4858 int context_pop_count = inner_scope->ContextChainLength(outer_scope); | 4850 int context_pop_count = inner_scope->ContextChainLength(outer_scope); |
| 4859 if (context_pop_count > 0) { | 4851 if (context_pop_count > 0) { |
| 4860 while (context_pop_count-- > 0) { | 4852 while (context_pop_count-- > 0) { |
| 4861 HInstruction* context_instruction = Add<HLoadNamedField>( | 4853 HInstruction* context_instruction = Add<HLoadNamedField>( |
| 4862 context, nullptr, | 4854 context, nullptr, |
| 4863 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); | 4855 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); |
| 4864 context = context_instruction; | 4856 context = context_instruction; |
| 4865 } | 4857 } |
| 4866 HInstruction* instr = Add<HStoreFrameContext>(context); | |
| 4867 if (instr->HasObservableSideEffects()) { | |
| 4868 AddSimulate(stmt->target()->EntryId(), REMOVABLE_SIMULATE); | |
| 4869 } | |
| 4870 environment()->BindContext(context); | 4858 environment()->BindContext(context); |
| 4871 } | 4859 } |
| 4872 | 4860 |
| 4873 Goto(continue_block); | 4861 Goto(continue_block); |
| 4874 set_current_block(NULL); | 4862 set_current_block(NULL); |
| 4875 } | 4863 } |
| 4876 | 4864 |
| 4877 | 4865 |
| 4878 void HOptimizedGraphBuilder::VisitBreakStatement(BreakStatement* stmt) { | 4866 void HOptimizedGraphBuilder::VisitBreakStatement(BreakStatement* stmt) { |
| 4879 DCHECK(!HasStackOverflow()); | 4867 DCHECK(!HasStackOverflow()); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 4893 HValue* context = environment()->context(); | 4881 HValue* context = environment()->context(); |
| 4894 Drop(drop_extra); | 4882 Drop(drop_extra); |
| 4895 int context_pop_count = inner_scope->ContextChainLength(outer_scope); | 4883 int context_pop_count = inner_scope->ContextChainLength(outer_scope); |
| 4896 if (context_pop_count > 0) { | 4884 if (context_pop_count > 0) { |
| 4897 while (context_pop_count-- > 0) { | 4885 while (context_pop_count-- > 0) { |
| 4898 HInstruction* context_instruction = Add<HLoadNamedField>( | 4886 HInstruction* context_instruction = Add<HLoadNamedField>( |
| 4899 context, nullptr, | 4887 context, nullptr, |
| 4900 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); | 4888 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); |
| 4901 context = context_instruction; | 4889 context = context_instruction; |
| 4902 } | 4890 } |
| 4903 HInstruction* instr = Add<HStoreFrameContext>(context); | |
| 4904 if (instr->HasObservableSideEffects()) { | |
| 4905 AddSimulate(stmt->target()->ExitId(), REMOVABLE_SIMULATE); | |
| 4906 } | |
| 4907 environment()->BindContext(context); | 4891 environment()->BindContext(context); |
| 4908 } | 4892 } |
| 4909 Goto(break_block); | 4893 Goto(break_block); |
| 4910 set_current_block(NULL); | 4894 set_current_block(NULL); |
| 4911 } | 4895 } |
| 4912 | 4896 |
| 4913 | 4897 |
| 4914 void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { | 4898 void HOptimizedGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) { |
| 4915 DCHECK(!HasStackOverflow()); | 4899 DCHECK(!HasStackOverflow()); |
| 4916 DCHECK(current_block() != NULL); | 4900 DCHECK(current_block() != NULL); |
| (...skipping 8670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13587 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13571 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13588 } | 13572 } |
| 13589 | 13573 |
| 13590 #ifdef DEBUG | 13574 #ifdef DEBUG |
| 13591 graph_->Verify(false); // No full verify. | 13575 graph_->Verify(false); // No full verify. |
| 13592 #endif | 13576 #endif |
| 13593 } | 13577 } |
| 13594 | 13578 |
| 13595 } // namespace internal | 13579 } // namespace internal |
| 13596 } // namespace v8 | 13580 } // namespace v8 |
| OLD | NEW |