| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 HDeoptimize* instr = new(zone()) HDeoptimize(environment->length()); | 124 HDeoptimize* instr = new(zone()) HDeoptimize(environment->length()); |
| 125 for (int i = 0; i < environment->length(); i++) { | 125 for (int i = 0; i < environment->length(); i++) { |
| 126 HValue* val = environment->values()->at(i); | 126 HValue* val = environment->values()->at(i); |
| 127 instr->AddEnvironmentValue(val); | 127 instr->AddEnvironmentValue(val); |
| 128 } | 128 } |
| 129 | 129 |
| 130 return instr; | 130 return instr; |
| 131 } | 131 } |
| 132 | 132 |
| 133 | 133 |
| 134 HSimulate* HBasicBlock::CreateSimulate(int id) { | 134 HSimulate* HBasicBlock::CreateSimulate(int ast_id) { |
| 135 ASSERT(HasEnvironment()); | 135 ASSERT(HasEnvironment()); |
| 136 HEnvironment* environment = last_environment(); | 136 HEnvironment* environment = last_environment(); |
| 137 ASSERT(id == AstNode::kNoNumber || | 137 ASSERT(id == AstNode::kNoNumber || |
| 138 environment->closure()->shared()->VerifyBailoutId(id)); | 138 environment->closure()->shared()->VerifyBailoutId(id)); |
| 139 | 139 |
| 140 int push_count = environment->push_count(); | 140 int push_count = environment->push_count(); |
| 141 int pop_count = environment->pop_count(); | 141 int pop_count = environment->pop_count(); |
| 142 | 142 |
| 143 HSimulate* instr = new(zone()) HSimulate(id, pop_count); | 143 HSimulate* instr = new(zone()) HSimulate(ast_id, pop_count); |
| 144 for (int i = push_count - 1; i >= 0; --i) { | 144 for (int i = push_count - 1; i >= 0; --i) { |
| 145 instr->AddPushedValue(environment->ExpressionStackAt(i)); | 145 instr->AddPushedValue(environment->ExpressionStackAt(i)); |
| 146 } | 146 } |
| 147 for (int i = 0; i < environment->assigned_variables()->length(); ++i) { | 147 for (int i = 0; i < environment->assigned_variables()->length(); ++i) { |
| 148 int index = environment->assigned_variables()->at(i); | 148 int index = environment->assigned_variables()->at(i); |
| 149 instr->AddAssignedValue(index, environment->Lookup(index)); | 149 instr->AddAssignedValue(index, environment->Lookup(index)); |
| 150 } | 150 } |
| 151 environment->ClearHistory(); | 151 environment->ClearHistory(); |
| 152 return instr; | 152 return instr; |
| 153 } | 153 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 187 } |
| 188 | 188 |
| 189 | 189 |
| 190 void HBasicBlock::SetInitialEnvironment(HEnvironment* env) { | 190 void HBasicBlock::SetInitialEnvironment(HEnvironment* env) { |
| 191 ASSERT(!HasEnvironment()); | 191 ASSERT(!HasEnvironment()); |
| 192 ASSERT(first() == NULL); | 192 ASSERT(first() == NULL); |
| 193 UpdateEnvironment(env); | 193 UpdateEnvironment(env); |
| 194 } | 194 } |
| 195 | 195 |
| 196 | 196 |
| 197 void HBasicBlock::SetJoinId(int id) { | 197 void HBasicBlock::SetJoinId(int ast_id) { |
| 198 int length = predecessors_.length(); | 198 int length = predecessors_.length(); |
| 199 ASSERT(length > 0); | 199 ASSERT(length > 0); |
| 200 for (int i = 0; i < length; i++) { | 200 for (int i = 0; i < length; i++) { |
| 201 HBasicBlock* predecessor = predecessors_[i]; | 201 HBasicBlock* predecessor = predecessors_[i]; |
| 202 ASSERT(predecessor->end()->IsGoto()); | 202 ASSERT(predecessor->end()->IsGoto()); |
| 203 HSimulate* simulate = HSimulate::cast(predecessor->end()->previous()); | 203 HSimulate* simulate = HSimulate::cast(predecessor->end()->previous()); |
| 204 // We only need to verify the ID once. | 204 // We only need to verify the ID once. |
| 205 ASSERT(i != 0 || | 205 ASSERT(i != 0 || |
| 206 predecessor->last_environment()->closure()->shared() | 206 predecessor->last_environment()->closure()->shared() |
| 207 ->VerifyBailoutId(id)); | 207 ->VerifyBailoutId(ast_id)); |
| 208 simulate->set_ast_id(id); | 208 simulate->set_ast_id(ast_id); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 | 212 |
| 213 bool HBasicBlock::Dominates(HBasicBlock* other) const { | 213 bool HBasicBlock::Dominates(HBasicBlock* other) const { |
| 214 HBasicBlock* current = other->dominator(); | 214 HBasicBlock* current = other->dominator(); |
| 215 while (current != NULL) { | 215 while (current != NULL) { |
| 216 if (current == this) return true; | 216 if (current == this) return true; |
| 217 current = current->dominator(); | 217 current = current->dominator(); |
| 218 } | 218 } |
| (...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2321 } | 2321 } |
| 2322 | 2322 |
| 2323 | 2323 |
| 2324 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { | 2324 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { |
| 2325 ASSERT(current_block() != NULL); | 2325 ASSERT(current_block() != NULL); |
| 2326 current_block()->AddInstruction(instr); | 2326 current_block()->AddInstruction(instr); |
| 2327 return instr; | 2327 return instr; |
| 2328 } | 2328 } |
| 2329 | 2329 |
| 2330 | 2330 |
| 2331 void HGraphBuilder::AddSimulate(int id) { | 2331 void HGraphBuilder::AddSimulate(int ast_id) { |
| 2332 ASSERT(current_block() != NULL); | 2332 ASSERT(current_block() != NULL); |
| 2333 current_block()->AddSimulate(id); | 2333 current_block()->AddSimulate(ast_id); |
| 2334 } | 2334 } |
| 2335 | 2335 |
| 2336 | 2336 |
| 2337 void HGraphBuilder::AddPhi(HPhi* instr) { | 2337 void HGraphBuilder::AddPhi(HPhi* instr) { |
| 2338 ASSERT(current_block() != NULL); | 2338 ASSERT(current_block() != NULL); |
| 2339 current_block()->AddPhi(instr); | 2339 current_block()->AddPhi(instr); |
| 2340 } | 2340 } |
| 2341 | 2341 |
| 2342 | 2342 |
| 2343 void HGraphBuilder::PushAndAdd(HInstruction* instr) { | 2343 void HGraphBuilder::PushAndAdd(HInstruction* instr) { |
| (...skipping 4222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6566 } | 6566 } |
| 6567 } | 6567 } |
| 6568 | 6568 |
| 6569 #ifdef DEBUG | 6569 #ifdef DEBUG |
| 6570 if (graph_ != NULL) graph_->Verify(); | 6570 if (graph_ != NULL) graph_->Verify(); |
| 6571 if (allocator_ != NULL) allocator_->Verify(); | 6571 if (allocator_ != NULL) allocator_->Verify(); |
| 6572 #endif | 6572 #endif |
| 6573 } | 6573 } |
| 6574 | 6574 |
| 6575 } } // namespace v8::internal | 6575 } } // namespace v8::internal |
| OLD | NEW |