| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 bool IsLoopSuccessorDominator() const { | 155 bool IsLoopSuccessorDominator() const { |
| 156 return dominates_loop_successors_; | 156 return dominates_loop_successors_; |
| 157 } | 157 } |
| 158 void MarkAsLoopSuccessorDominator() { | 158 void MarkAsLoopSuccessorDominator() { |
| 159 dominates_loop_successors_ = true; | 159 dominates_loop_successors_ = true; |
| 160 } | 160 } |
| 161 | 161 |
| 162 inline Zone* zone() const; | 162 inline Zone* zone() const; |
| 163 | 163 |
| 164 void BuildSsiRecursively() { |
| 165 BuildSsi(); |
| 166 for (int i = 0; i < dominated_blocks()->length(); ++i) { |
| 167 dominated_blocks()->at(i)->BuildSsiRecursively(); |
| 168 } |
| 169 } |
| 170 void BuildSsi() { |
| 171 for (int i = 0; i < phis()->length(); i++) { |
| 172 HPhi* current = phis()->at(i); |
| 173 current->SetFlag(HValue::kProcessedBySsi); |
| 174 current->BuildSsi(); |
| 175 } |
| 176 |
| 177 for (HInstruction* current = first(); |
| 178 current != NULL; |
| 179 current = current->next()) { |
| 180 // We set the flag before calling BuildSsi so that, while creating new |
| 181 // SSI definitions, uses inside current will not be updated. |
| 182 current->SetFlag(HValue::kProcessedBySsi); |
| 183 current->BuildSsi(); |
| 184 } |
| 185 } |
| 186 |
| 164 #ifdef DEBUG | 187 #ifdef DEBUG |
| 165 void Verify(); | 188 void Verify(); |
| 166 #endif | 189 #endif |
| 167 | 190 |
| 168 private: | 191 private: |
| 169 void RegisterPredecessor(HBasicBlock* pred); | 192 void RegisterPredecessor(HBasicBlock* pred); |
| 170 void AddDominatedBlock(HBasicBlock* block); | 193 void AddDominatedBlock(HBasicBlock* block); |
| 171 | 194 |
| 172 HSimulate* CreateSimulate(BailoutId ast_id, RemovableSimulate removable); | 195 HSimulate* CreateSimulate(BailoutId ast_id, RemovableSimulate removable); |
| 173 HDeoptimize* CreateDeoptimize(HDeoptimize::UseEnvironment has_uses); | 196 HDeoptimize* CreateDeoptimize(HDeoptimize::UseEnvironment has_uses); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // Returns false if there are phi-uses of an uninitialized const | 306 // Returns false if there are phi-uses of an uninitialized const |
| 284 // which are not supported by the optimizing compiler. | 307 // which are not supported by the optimizing compiler. |
| 285 bool CheckConstPhiUses(); | 308 bool CheckConstPhiUses(); |
| 286 | 309 |
| 287 void CollectPhis(); | 310 void CollectPhis(); |
| 288 | 311 |
| 289 void set_undefined_constant(HConstant* constant) { | 312 void set_undefined_constant(HConstant* constant) { |
| 290 undefined_constant_.set(constant); | 313 undefined_constant_.set(constant); |
| 291 } | 314 } |
| 292 HConstant* GetConstantUndefined() const { return undefined_constant_.get(); } | 315 HConstant* GetConstantUndefined() const { return undefined_constant_.get(); } |
| 316 HConstant* GetConstant0(); |
| 293 HConstant* GetConstant1(); | 317 HConstant* GetConstant1(); |
| 294 HConstant* GetConstantMinus1(); | 318 HConstant* GetConstantMinus1(); |
| 295 HConstant* GetConstantTrue(); | 319 HConstant* GetConstantTrue(); |
| 296 HConstant* GetConstantFalse(); | 320 HConstant* GetConstantFalse(); |
| 297 HConstant* GetConstantHole(); | 321 HConstant* GetConstantHole(); |
| 298 | 322 |
| 299 HBasicBlock* CreateBasicBlock(); | 323 HBasicBlock* CreateBasicBlock(); |
| 300 HArgumentsObject* GetArgumentsObject() const { | 324 HArgumentsObject* GetArgumentsObject() const { |
| 301 return arguments_object_.get(); | 325 return arguments_object_.get(); |
| 302 } | 326 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 return is_recursive_; | 387 return is_recursive_; |
| 364 } | 388 } |
| 365 | 389 |
| 366 void RecordUint32Instruction(HInstruction* instr) { | 390 void RecordUint32Instruction(HInstruction* instr) { |
| 367 if (uint32_instructions_ == NULL) { | 391 if (uint32_instructions_ == NULL) { |
| 368 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); | 392 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); |
| 369 } | 393 } |
| 370 uint32_instructions_->Add(instr, zone()); | 394 uint32_instructions_->Add(instr, zone()); |
| 371 } | 395 } |
| 372 | 396 |
| 397 void BuildSsi(); |
| 398 void CleanupSsi(); |
| 399 |
| 373 private: | 400 private: |
| 374 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, | 401 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, |
| 375 Handle<Object> value); | 402 Handle<Object> value); |
| 376 HConstant* GetConstantInt32(SetOncePointer<HConstant>* pointer, | 403 HConstant* GetConstantInt32(SetOncePointer<HConstant>* pointer, |
| 377 int32_t integer_value); | 404 int32_t integer_value); |
| 378 | 405 |
| 379 void MarkAsDeoptimizingRecursively(HBasicBlock* block); | 406 void MarkAsDeoptimizingRecursively(HBasicBlock* block); |
| 380 void InsertTypeConversions(HInstruction* instr); | 407 void InsertTypeConversions(HInstruction* instr); |
| 381 void PropagateMinusZeroChecks(HValue* value, BitVector* visited); | 408 void PropagateMinusZeroChecks(HValue* value, BitVector* visited); |
| 382 void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi); | 409 void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi); |
| 383 void InsertRepresentationChangeForUse(HValue* value, | 410 void InsertRepresentationChangeForUse(HValue* value, |
| 384 HValue* use_value, | 411 HValue* use_value, |
| 385 int use_index, | 412 int use_index, |
| 386 Representation to); | 413 Representation to); |
| 387 void InsertRepresentationChangesForValue(HValue* value); | 414 void InsertRepresentationChangesForValue(HValue* value); |
| 388 void InferTypes(ZoneList<HValue*>* worklist); | 415 void InferTypes(ZoneList<HValue*>* worklist); |
| 389 void InitializeInferredTypes(int from_inclusive, int to_inclusive); | 416 void InitializeInferredTypes(int from_inclusive, int to_inclusive); |
| 390 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); | 417 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); |
| 391 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); | 418 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); |
| 392 | 419 |
| 393 Isolate* isolate_; | 420 Isolate* isolate_; |
| 394 int next_block_id_; | 421 int next_block_id_; |
| 395 HBasicBlock* entry_block_; | 422 HBasicBlock* entry_block_; |
| 396 HEnvironment* start_environment_; | 423 HEnvironment* start_environment_; |
| 397 ZoneList<HBasicBlock*> blocks_; | 424 ZoneList<HBasicBlock*> blocks_; |
| 398 ZoneList<HValue*> values_; | 425 ZoneList<HValue*> values_; |
| 399 ZoneList<HPhi*>* phi_list_; | 426 ZoneList<HPhi*>* phi_list_; |
| 400 ZoneList<HInstruction*>* uint32_instructions_; | 427 ZoneList<HInstruction*>* uint32_instructions_; |
| 401 SetOncePointer<HConstant> undefined_constant_; | 428 SetOncePointer<HConstant> undefined_constant_; |
| 429 SetOncePointer<HConstant> constant_0_; |
| 402 SetOncePointer<HConstant> constant_1_; | 430 SetOncePointer<HConstant> constant_1_; |
| 403 SetOncePointer<HConstant> constant_minus1_; | 431 SetOncePointer<HConstant> constant_minus1_; |
| 404 SetOncePointer<HConstant> constant_true_; | 432 SetOncePointer<HConstant> constant_true_; |
| 405 SetOncePointer<HConstant> constant_false_; | 433 SetOncePointer<HConstant> constant_false_; |
| 406 SetOncePointer<HConstant> constant_hole_; | 434 SetOncePointer<HConstant> constant_hole_; |
| 407 SetOncePointer<HArgumentsObject> arguments_object_; | 435 SetOncePointer<HArgumentsObject> arguments_object_; |
| 408 | 436 |
| 409 SetOncePointer<HBasicBlock> osr_loop_entry_; | 437 SetOncePointer<HBasicBlock> osr_loop_entry_; |
| 410 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; | 438 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; |
| 411 | 439 |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 const char* filename_; | 1583 const char* filename_; |
| 1556 HeapStringAllocator string_allocator_; | 1584 HeapStringAllocator string_allocator_; |
| 1557 StringStream trace_; | 1585 StringStream trace_; |
| 1558 int indent_; | 1586 int indent_; |
| 1559 }; | 1587 }; |
| 1560 | 1588 |
| 1561 | 1589 |
| 1562 } } // namespace v8::internal | 1590 } } // namespace v8::internal |
| 1563 | 1591 |
| 1564 #endif // V8_HYDROGEN_H_ | 1592 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |