| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 ASSERT(last_environment() != NULL); | 141 ASSERT(last_environment() != NULL); |
| 142 ASSERT(!last_environment()->ast_id().IsNone()); | 142 ASSERT(!last_environment()->ast_id().IsNone()); |
| 143 HBlockEntry* entry = new(zone()) HBlockEntry(); | 143 HBlockEntry* entry = new(zone()) HBlockEntry(); |
| 144 entry->InitializeAsFirst(this); | 144 entry->InitializeAsFirst(this); |
| 145 first_ = last_ = entry; | 145 first_ = last_ = entry; |
| 146 } | 146 } |
| 147 instr->InsertAfter(last_); | 147 instr->InsertAfter(last_); |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 HPhi* HBasicBlock::AddNewPhi(int merged_index) { |
| 152 if (graph()->IsInsideNoSideEffectsScope()) { |
| 153 merged_index = HPhi::kInvalidMergedIndex; |
| 154 } |
| 155 HPhi* phi = new(zone()) HPhi(merged_index, zone()); |
| 156 AddPhi(phi); |
| 157 return phi; |
| 158 } |
| 159 |
| 160 |
| 151 HSimulate* HBasicBlock::CreateSimulate(BailoutId ast_id, | 161 HSimulate* HBasicBlock::CreateSimulate(BailoutId ast_id, |
| 152 RemovableSimulate removable) { | 162 RemovableSimulate removable) { |
| 153 ASSERT(HasEnvironment()); | 163 ASSERT(HasEnvironment()); |
| 154 HEnvironment* environment = last_environment(); | 164 HEnvironment* environment = last_environment(); |
| 155 ASSERT(ast_id.IsNone() || | 165 ASSERT(ast_id.IsNone() || |
| 156 ast_id == BailoutId::StubEntry() || | 166 ast_id == BailoutId::StubEntry() || |
| 157 environment->closure()->shared()->VerifyBailoutId(ast_id)); | 167 environment->closure()->shared()->VerifyBailoutId(ast_id)); |
| 158 | 168 |
| 159 int push_count = environment->push_count(); | 169 int push_count = environment->push_count(); |
| 160 int pop_count = environment->pop_count(); | 170 int pop_count = environment->pop_count(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 FunctionState* state, | 206 FunctionState* state, |
| 197 bool add_simulate) { | 207 bool add_simulate) { |
| 198 bool drop_extra = state != NULL && | 208 bool drop_extra = state != NULL && |
| 199 state->inlining_kind() == DROP_EXTRA_ON_RETURN; | 209 state->inlining_kind() == DROP_EXTRA_ON_RETURN; |
| 200 | 210 |
| 201 if (block->IsInlineReturnTarget()) { | 211 if (block->IsInlineReturnTarget()) { |
| 202 AddInstruction(new(zone()) HLeaveInlined()); | 212 AddInstruction(new(zone()) HLeaveInlined()); |
| 203 UpdateEnvironment(last_environment()->DiscardInlined(drop_extra)); | 213 UpdateEnvironment(last_environment()->DiscardInlined(drop_extra)); |
| 204 } | 214 } |
| 205 | 215 |
| 206 if (add_simulate) AddSimulate(BailoutId::None()); | 216 if (add_simulate) AddNewSimulate(BailoutId::None()); |
| 207 HGoto* instr = new(zone()) HGoto(block); | 217 HGoto* instr = new(zone()) HGoto(block); |
| 208 Finish(instr); | 218 Finish(instr); |
| 209 } | 219 } |
| 210 | 220 |
| 211 | 221 |
| 212 void HBasicBlock::AddLeaveInlined(HValue* return_value, | 222 void HBasicBlock::AddLeaveInlined(HValue* return_value, |
| 213 FunctionState* state) { | 223 FunctionState* state) { |
| 214 HBasicBlock* target = state->function_return(); | 224 HBasicBlock* target = state->function_return(); |
| 215 bool drop_extra = state->inlining_kind() == DROP_EXTRA_ON_RETURN; | 225 bool drop_extra = state->inlining_kind() == DROP_EXTRA_ON_RETURN; |
| 216 | 226 |
| 217 ASSERT(target->IsInlineReturnTarget()); | 227 ASSERT(target->IsInlineReturnTarget()); |
| 218 ASSERT(return_value != NULL); | 228 ASSERT(return_value != NULL); |
| 219 AddInstruction(new(zone()) HLeaveInlined()); | 229 AddInstruction(new(zone()) HLeaveInlined()); |
| 220 UpdateEnvironment(last_environment()->DiscardInlined(drop_extra)); | 230 UpdateEnvironment(last_environment()->DiscardInlined(drop_extra)); |
| 221 last_environment()->Push(return_value); | 231 last_environment()->Push(return_value); |
| 222 AddSimulate(BailoutId::None()); | 232 AddNewSimulate(BailoutId::None()); |
| 223 HGoto* instr = new(zone()) HGoto(target); | 233 HGoto* instr = new(zone()) HGoto(target); |
| 224 Finish(instr); | 234 Finish(instr); |
| 225 } | 235 } |
| 226 | 236 |
| 227 | 237 |
| 228 void HBasicBlock::SetInitialEnvironment(HEnvironment* env) { | 238 void HBasicBlock::SetInitialEnvironment(HEnvironment* env) { |
| 229 ASSERT(!HasEnvironment()); | 239 ASSERT(!HasEnvironment()); |
| 230 ASSERT(first() == NULL); | 240 ASSERT(first() == NULL); |
| 231 UpdateEnvironment(env); | 241 UpdateEnvironment(env); |
| 232 } | 242 } |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 body_block_ = NULL; | 907 body_block_ = NULL; |
| 898 exit_block_ = NULL; | 908 exit_block_ = NULL; |
| 899 } | 909 } |
| 900 | 910 |
| 901 | 911 |
| 902 HValue* HGraphBuilder::LoopBuilder::BeginBody( | 912 HValue* HGraphBuilder::LoopBuilder::BeginBody( |
| 903 HValue* initial, | 913 HValue* initial, |
| 904 HValue* terminating, | 914 HValue* terminating, |
| 905 Token::Value token) { | 915 Token::Value token) { |
| 906 HEnvironment* env = builder_->environment(); | 916 HEnvironment* env = builder_->environment(); |
| 907 phi_ = new(zone()) HPhi(env->values()->length(), zone()); | 917 phi_ = header_block_->AddNewPhi(env->values()->length()); |
| 908 header_block_->AddPhi(phi_); | |
| 909 phi_->AddInput(initial); | 918 phi_->AddInput(initial); |
| 910 env->Push(initial); | 919 env->Push(initial); |
| 911 builder_->current_block()->GotoNoSimulate(header_block_); | 920 builder_->current_block()->GotoNoSimulate(header_block_); |
| 912 | 921 |
| 913 HEnvironment* body_env = env->Copy(); | 922 HEnvironment* body_env = env->Copy(); |
| 914 HEnvironment* exit_env = env->Copy(); | 923 HEnvironment* exit_env = env->Copy(); |
| 915 body_block_ = builder_->CreateBasicBlock(body_env); | 924 body_block_ = builder_->CreateBasicBlock(body_env); |
| 916 exit_block_ = builder_->CreateBasicBlock(exit_env); | 925 exit_block_ = builder_->CreateBasicBlock(exit_env); |
| 917 // Remove the phi from the expression stack | 926 // Remove the phi from the expression stack |
| 918 body_env->Pop(); | 927 body_env->Pop(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 set_current_block(graph()->entry_block()); | 983 set_current_block(graph()->entry_block()); |
| 975 if (!BuildGraph()) return NULL; | 984 if (!BuildGraph()) return NULL; |
| 976 graph()->FinalizeUniqueValueIds(); | 985 graph()->FinalizeUniqueValueIds(); |
| 977 return graph_; | 986 return graph_; |
| 978 } | 987 } |
| 979 | 988 |
| 980 | 989 |
| 981 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { | 990 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { |
| 982 ASSERT(current_block() != NULL); | 991 ASSERT(current_block() != NULL); |
| 983 current_block()->AddInstruction(instr); | 992 current_block()->AddInstruction(instr); |
| 984 if (no_side_effects_scope_count_ > 0) { | 993 if (graph()->IsInsideNoSideEffectsScope()) { |
| 985 instr->SetFlag(HValue::kHasNoObservableSideEffects); | 994 instr->SetFlag(HValue::kHasNoObservableSideEffects); |
| 986 } | 995 } |
| 987 return instr; | 996 return instr; |
| 988 } | 997 } |
| 989 | 998 |
| 990 | 999 |
| 991 void HGraphBuilder::AddIncrementCounter(StatsCounter* counter, | 1000 void HGraphBuilder::AddIncrementCounter(StatsCounter* counter, |
| 992 HValue* context) { | 1001 HValue* context) { |
| 993 if (FLAG_native_code_counters && counter->Enabled()) { | 1002 if (FLAG_native_code_counters && counter->Enabled()) { |
| 994 HValue* reference = Add<HConstant>(ExternalReference(counter)); | 1003 HValue* reference = Add<HConstant>(ExternalReference(counter)); |
| 995 HValue* old_value = Add<HLoadNamedField>(reference, | 1004 HValue* old_value = Add<HLoadNamedField>(reference, |
| 996 HObjectAccess::ForCounter()); | 1005 HObjectAccess::ForCounter()); |
| 997 HValue* new_value = Add<HAdd>(old_value, graph()->GetConstant1()); | 1006 HValue* new_value = Add<HAdd>(old_value, graph()->GetConstant1()); |
| 998 new_value->ClearFlag(HValue::kCanOverflow); // Ignore counter overflow | 1007 new_value->ClearFlag(HValue::kCanOverflow); // Ignore counter overflow |
| 999 Add<HStoreNamedField>(reference, HObjectAccess::ForCounter(), | 1008 Add<HStoreNamedField>(reference, HObjectAccess::ForCounter(), |
| 1000 new_value); | 1009 new_value); |
| 1001 } | 1010 } |
| 1002 } | 1011 } |
| 1003 | 1012 |
| 1004 | 1013 |
| 1005 void HGraphBuilder::AddSimulate(BailoutId id, | 1014 void HGraphBuilder::AddSimulate(BailoutId id, |
| 1006 RemovableSimulate removable) { | 1015 RemovableSimulate removable) { |
| 1007 ASSERT(current_block() != NULL); | 1016 ASSERT(current_block() != NULL); |
| 1008 ASSERT(no_side_effects_scope_count_ == 0); | 1017 ASSERT(!graph()->IsInsideNoSideEffectsScope()); |
| 1009 current_block()->AddSimulate(id, removable); | 1018 current_block()->AddNewSimulate(id, removable); |
| 1010 } | 1019 } |
| 1011 | 1020 |
| 1012 | 1021 |
| 1013 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) { | 1022 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) { |
| 1014 HBasicBlock* b = graph()->CreateBasicBlock(); | 1023 HBasicBlock* b = graph()->CreateBasicBlock(); |
| 1015 b->SetInitialEnvironment(env); | 1024 b->SetInitialEnvironment(env); |
| 1016 return b; | 1025 return b; |
| 1017 } | 1026 } |
| 1018 | 1027 |
| 1019 | 1028 |
| 1020 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() { | 1029 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() { |
| 1021 HBasicBlock* header = graph()->CreateBasicBlock(); | 1030 HBasicBlock* header = graph()->CreateBasicBlock(); |
| 1022 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header); | 1031 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header); |
| 1023 header->SetInitialEnvironment(entry_env); | 1032 header->SetInitialEnvironment(entry_env); |
| 1024 header->AttachLoopInformation(); | 1033 header->AttachLoopInformation(); |
| 1025 return header; | 1034 return header; |
| 1026 } | 1035 } |
| 1027 | 1036 |
| 1028 | 1037 |
| 1029 HValue* HGraphBuilder::BuildCheckHeapObject(HValue* obj) { | 1038 HValue* HGraphBuilder::BuildCheckHeapObject(HValue* obj) { |
| 1030 if (obj->type().IsHeapObject()) return obj; | 1039 if (obj->type().IsHeapObject()) return obj; |
| 1031 return Add<HCheckHeapObject>(obj); | 1040 return Add<HCheckHeapObject>(obj); |
| 1032 } | 1041 } |
| 1033 | 1042 |
| 1034 | 1043 |
| 1035 void HGraphBuilder::FinishExitWithHardDeoptimization( | 1044 void HGraphBuilder::FinishExitWithHardDeoptimization( |
| 1036 HBasicBlock* continuation) { | 1045 HBasicBlock* continuation) { |
| 1037 PadEnvironmentForContinuation(current_block(), continuation); | 1046 PadEnvironmentForContinuation(current_block(), continuation); |
| 1038 Add<HDeoptimize>(Deoptimizer::EAGER); | 1047 Add<HDeoptimize>(Deoptimizer::EAGER); |
| 1039 if (no_side_effects_scope_count_ > 0) { | 1048 if (graph()->IsInsideNoSideEffectsScope()) { |
| 1040 current_block()->GotoNoSimulate(continuation); | 1049 current_block()->GotoNoSimulate(continuation); |
| 1041 } else { | 1050 } else { |
| 1042 current_block()->Goto(continuation); | 1051 current_block()->Goto(continuation); |
| 1043 } | 1052 } |
| 1044 } | 1053 } |
| 1045 | 1054 |
| 1046 | 1055 |
| 1047 void HGraphBuilder::PadEnvironmentForContinuation( | 1056 void HGraphBuilder::PadEnvironmentForContinuation( |
| 1048 HBasicBlock* from, | 1057 HBasicBlock* from, |
| 1049 HBasicBlock* continuation) { | 1058 HBasicBlock* continuation) { |
| (...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2071 phi_list_(NULL), | 2080 phi_list_(NULL), |
| 2072 uint32_instructions_(NULL), | 2081 uint32_instructions_(NULL), |
| 2073 osr_(NULL), | 2082 osr_(NULL), |
| 2074 info_(info), | 2083 info_(info), |
| 2075 zone_(info->zone()), | 2084 zone_(info->zone()), |
| 2076 is_recursive_(false), | 2085 is_recursive_(false), |
| 2077 use_optimistic_licm_(false), | 2086 use_optimistic_licm_(false), |
| 2078 has_soft_deoptimize_(false), | 2087 has_soft_deoptimize_(false), |
| 2079 depends_on_empty_array_proto_elements_(false), | 2088 depends_on_empty_array_proto_elements_(false), |
| 2080 type_change_checksum_(0), | 2089 type_change_checksum_(0), |
| 2081 maximum_environment_size_(0) { | 2090 maximum_environment_size_(0), |
| 2091 no_side_effects_scope_count_(0) { |
| 2082 if (info->IsStub()) { | 2092 if (info->IsStub()) { |
| 2083 HydrogenCodeStub* stub = info->code_stub(); | 2093 HydrogenCodeStub* stub = info->code_stub(); |
| 2084 CodeStubInterfaceDescriptor* descriptor = | 2094 CodeStubInterfaceDescriptor* descriptor = |
| 2085 stub->GetInterfaceDescriptor(isolate_); | 2095 stub->GetInterfaceDescriptor(isolate_); |
| 2086 start_environment_ = | 2096 start_environment_ = |
| 2087 new(zone_) HEnvironment(zone_, descriptor->environment_length()); | 2097 new(zone_) HEnvironment(zone_, descriptor->environment_length()); |
| 2088 } else { | 2098 } else { |
| 2089 start_environment_ = | 2099 start_environment_ = |
| 2090 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); | 2100 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); |
| 2091 } | 2101 } |
| (...skipping 3561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5653 external_elements, checked_key, val, | 5663 external_elements, checked_key, val, |
| 5654 mapcompare, elements_kind, is_store); | 5664 mapcompare, elements_kind, is_store); |
| 5655 } | 5665 } |
| 5656 *has_side_effects |= access->HasObservableSideEffects(); | 5666 *has_side_effects |= access->HasObservableSideEffects(); |
| 5657 // The caller will use has_side_effects and add a correct Simulate. | 5667 // The caller will use has_side_effects and add a correct Simulate. |
| 5658 access->SetFlag(HValue::kHasNoObservableSideEffects); | 5668 access->SetFlag(HValue::kHasNoObservableSideEffects); |
| 5659 if (position != RelocInfo::kNoPosition) access->set_position(position); | 5669 if (position != RelocInfo::kNoPosition) access->set_position(position); |
| 5660 if (!is_store) { | 5670 if (!is_store) { |
| 5661 Push(access); | 5671 Push(access); |
| 5662 } | 5672 } |
| 5673 NoObservableSideEffectsScope scope(this); |
| 5663 current_block()->GotoNoSimulate(join); | 5674 current_block()->GotoNoSimulate(join); |
| 5664 set_current_block(other_map); | 5675 set_current_block(other_map); |
| 5665 } | 5676 } |
| 5666 | 5677 |
| 5667 // Deopt if none of the cases matched. | 5678 // Deopt if none of the cases matched. |
| 5668 NoObservableSideEffectsScope scope(this); | 5679 NoObservableSideEffectsScope scope(this); |
| 5669 FinishExitWithHardDeoptimization(join); | 5680 FinishExitWithHardDeoptimization(join); |
| 5670 set_current_block(join); | 5681 set_current_block(join); |
| 5671 return is_store ? NULL : Pop(); | 5682 return is_store ? NULL : Pop(); |
| 5672 } | 5683 } |
| (...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8105 return ast_context()->ReturnControl(result, expr->id()); | 8116 return ast_context()->ReturnControl(result, expr->id()); |
| 8106 } else { | 8117 } else { |
| 8107 if (combined_rep.IsTagged() || combined_rep.IsNone()) { | 8118 if (combined_rep.IsTagged() || combined_rep.IsNone()) { |
| 8108 HCompareGeneric* result = | 8119 HCompareGeneric* result = |
| 8109 new(zone()) HCompareGeneric(context, left, right, op); | 8120 new(zone()) HCompareGeneric(context, left, right, op); |
| 8110 result->set_observed_input_representation(1, left_rep); | 8121 result->set_observed_input_representation(1, left_rep); |
| 8111 result->set_observed_input_representation(2, right_rep); | 8122 result->set_observed_input_representation(2, right_rep); |
| 8112 result->set_position(expr->position()); | 8123 result->set_position(expr->position()); |
| 8113 return ast_context()->ReturnInstruction(result, expr->id()); | 8124 return ast_context()->ReturnInstruction(result, expr->id()); |
| 8114 } else { | 8125 } else { |
| 8115 // TODO(verwaest): Remove once Representation::FromType properly | |
| 8116 // returns Smi when the IC measures Smi. | |
| 8117 if (left_type->Is(Type::Smi())) left_rep = Representation::Smi(); | |
| 8118 if (right_type->Is(Type::Smi())) right_rep = Representation::Smi(); | |
| 8119 HCompareNumericAndBranch* result = | 8126 HCompareNumericAndBranch* result = |
| 8120 new(zone()) HCompareNumericAndBranch(left, right, op); | 8127 new(zone()) HCompareNumericAndBranch(left, right, op); |
| 8121 result->set_observed_input_representation(left_rep, right_rep); | 8128 result->set_observed_input_representation(left_rep, right_rep); |
| 8122 result->set_position(expr->position()); | 8129 result->set_position(expr->position()); |
| 8123 return ast_context()->ReturnControl(result, expr->id()); | 8130 return ast_context()->ReturnControl(result, expr->id()); |
| 8124 } | 8131 } |
| 8125 } | 8132 } |
| 8126 } | 8133 } |
| 8127 | 8134 |
| 8128 | 8135 |
| (...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9280 ASSERT(!block->IsLoopHeader()); | 9287 ASSERT(!block->IsLoopHeader()); |
| 9281 ASSERT(values_.length() == other->values_.length()); | 9288 ASSERT(values_.length() == other->values_.length()); |
| 9282 | 9289 |
| 9283 int length = values_.length(); | 9290 int length = values_.length(); |
| 9284 for (int i = 0; i < length; ++i) { | 9291 for (int i = 0; i < length; ++i) { |
| 9285 HValue* value = values_[i]; | 9292 HValue* value = values_[i]; |
| 9286 if (value != NULL && value->IsPhi() && value->block() == block) { | 9293 if (value != NULL && value->IsPhi() && value->block() == block) { |
| 9287 // There is already a phi for the i'th value. | 9294 // There is already a phi for the i'th value. |
| 9288 HPhi* phi = HPhi::cast(value); | 9295 HPhi* phi = HPhi::cast(value); |
| 9289 // Assert index is correct and that we haven't missed an incoming edge. | 9296 // Assert index is correct and that we haven't missed an incoming edge. |
| 9290 ASSERT(phi->merged_index() == i); | 9297 ASSERT(phi->merged_index() == i || !phi->HasMergedIndex()); |
| 9291 ASSERT(phi->OperandCount() == block->predecessors()->length()); | 9298 ASSERT(phi->OperandCount() == block->predecessors()->length()); |
| 9292 phi->AddInput(other->values_[i]); | 9299 phi->AddInput(other->values_[i]); |
| 9293 } else if (values_[i] != other->values_[i]) { | 9300 } else if (values_[i] != other->values_[i]) { |
| 9294 // There is a fresh value on the incoming edge, a phi is needed. | 9301 // There is a fresh value on the incoming edge, a phi is needed. |
| 9295 ASSERT(values_[i] != NULL && other->values_[i] != NULL); | 9302 ASSERT(values_[i] != NULL && other->values_[i] != NULL); |
| 9296 HPhi* phi = new(zone()) HPhi(i, zone()); | 9303 HPhi* phi = block->AddNewPhi(i); |
| 9297 HValue* old_value = values_[i]; | 9304 HValue* old_value = values_[i]; |
| 9298 for (int j = 0; j < block->predecessors()->length(); j++) { | 9305 for (int j = 0; j < block->predecessors()->length(); j++) { |
| 9299 phi->AddInput(old_value); | 9306 phi->AddInput(old_value); |
| 9300 } | 9307 } |
| 9301 phi->AddInput(other->values_[i]); | 9308 phi->AddInput(other->values_[i]); |
| 9302 this->values_[i] = phi; | 9309 this->values_[i] = phi; |
| 9303 block->AddPhi(phi); | |
| 9304 } | 9310 } |
| 9305 } | 9311 } |
| 9306 } | 9312 } |
| 9307 | 9313 |
| 9308 | 9314 |
| 9309 void HEnvironment::Bind(int index, HValue* value) { | 9315 void HEnvironment::Bind(int index, HValue* value) { |
| 9310 ASSERT(value != NULL); | 9316 ASSERT(value != NULL); |
| 9311 assigned_variables_.Add(index, zone()); | 9317 assigned_variables_.Add(index, zone()); |
| 9312 values_[index] = value; | 9318 values_[index] = value; |
| 9313 } | 9319 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9354 HEnvironment* HEnvironment::CopyWithoutHistory() const { | 9360 HEnvironment* HEnvironment::CopyWithoutHistory() const { |
| 9355 HEnvironment* result = Copy(); | 9361 HEnvironment* result = Copy(); |
| 9356 result->ClearHistory(); | 9362 result->ClearHistory(); |
| 9357 return result; | 9363 return result; |
| 9358 } | 9364 } |
| 9359 | 9365 |
| 9360 | 9366 |
| 9361 HEnvironment* HEnvironment::CopyAsLoopHeader(HBasicBlock* loop_header) const { | 9367 HEnvironment* HEnvironment::CopyAsLoopHeader(HBasicBlock* loop_header) const { |
| 9362 HEnvironment* new_env = Copy(); | 9368 HEnvironment* new_env = Copy(); |
| 9363 for (int i = 0; i < values_.length(); ++i) { | 9369 for (int i = 0; i < values_.length(); ++i) { |
| 9364 HPhi* phi = new(zone()) HPhi(i, zone()); | 9370 HPhi* phi = loop_header->AddNewPhi(i); |
| 9365 phi->AddInput(values_[i]); | 9371 phi->AddInput(values_[i]); |
| 9366 new_env->values_[i] = phi; | 9372 new_env->values_[i] = phi; |
| 9367 loop_header->AddPhi(phi); | |
| 9368 } | 9373 } |
| 9369 new_env->ClearHistory(); | 9374 new_env->ClearHistory(); |
| 9370 return new_env; | 9375 return new_env; |
| 9371 } | 9376 } |
| 9372 | 9377 |
| 9373 | 9378 |
| 9374 HEnvironment* HEnvironment::CreateStubEnvironment(HEnvironment* outer, | 9379 HEnvironment* HEnvironment::CreateStubEnvironment(HEnvironment* outer, |
| 9375 Handle<JSFunction> target, | 9380 Handle<JSFunction> target, |
| 9376 FrameType frame_type, | 9381 FrameType frame_type, |
| 9377 int arguments) const { | 9382 int arguments) const { |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9779 if (ShouldProduceTraceOutput()) { | 9784 if (ShouldProduceTraceOutput()) { |
| 9780 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9785 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 9781 } | 9786 } |
| 9782 | 9787 |
| 9783 #ifdef DEBUG | 9788 #ifdef DEBUG |
| 9784 graph_->Verify(false); // No full verify. | 9789 graph_->Verify(false); // No full verify. |
| 9785 #endif | 9790 #endif |
| 9786 } | 9791 } |
| 9787 | 9792 |
| 9788 } } // namespace v8::internal | 9793 } } // namespace v8::internal |
| OLD | NEW |