| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void set_block_id(int id) { block_id_ = id; } | 62 void set_block_id(int id) { block_id_ = id; } |
| 63 HGraph* graph() const { return graph_; } | 63 HGraph* graph() const { return graph_; } |
| 64 Isolate* isolate() const; | 64 Isolate* isolate() const; |
| 65 const ZoneList<HPhi*>* phis() const { return &phis_; } | 65 const ZoneList<HPhi*>* phis() const { return &phis_; } |
| 66 HInstruction* first() const { return first_; } | 66 HInstruction* first() const { return first_; } |
| 67 HInstruction* last() const { return last_; } | 67 HInstruction* last() const { return last_; } |
| 68 void set_last(HInstruction* instr) { last_ = instr; } | 68 void set_last(HInstruction* instr) { last_ = instr; } |
| 69 HInstruction* GetLastInstruction(); | 69 HInstruction* GetLastInstruction(); |
| 70 HControlInstruction* end() const { return end_; } | 70 HControlInstruction* end() const { return end_; } |
| 71 HLoopInformation* loop_information() const { return loop_information_; } | 71 HLoopInformation* loop_information() const { return loop_information_; } |
| 72 HLoopInformation* current_loop() const { |
| 73 return IsLoopHeader() ? loop_information() |
| 74 : (parent_loop_header() != NULL |
| 75 ? parent_loop_header()->loop_information() : NULL); |
| 76 } |
| 72 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } | 77 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } |
| 73 bool HasPredecessor() const { return predecessors_.length() > 0; } | 78 bool HasPredecessor() const { return predecessors_.length() > 0; } |
| 74 const ZoneList<HBasicBlock*>* dominated_blocks() const { | 79 const ZoneList<HBasicBlock*>* dominated_blocks() const { |
| 75 return &dominated_blocks_; | 80 return &dominated_blocks_; |
| 76 } | 81 } |
| 77 const ZoneList<int>* deleted_phis() const { | 82 const ZoneList<int>* deleted_phis() const { |
| 78 return &deleted_phis_; | 83 return &deleted_phis_; |
| 79 } | 84 } |
| 80 void RecordDeletedPhi(int merge_index) { | 85 void RecordDeletedPhi(int merge_index) { |
| 81 deleted_phis_.Add(merge_index, zone()); | 86 deleted_phis_.Add(merge_index, zone()); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 int current_; | 219 int current_; |
| 215 }; | 220 }; |
| 216 | 221 |
| 217 | 222 |
| 218 class HLoopInformation: public ZoneObject { | 223 class HLoopInformation: public ZoneObject { |
| 219 public: | 224 public: |
| 220 HLoopInformation(HBasicBlock* loop_header, Zone* zone) | 225 HLoopInformation(HBasicBlock* loop_header, Zone* zone) |
| 221 : back_edges_(4, zone), | 226 : back_edges_(4, zone), |
| 222 loop_header_(loop_header), | 227 loop_header_(loop_header), |
| 223 blocks_(8, zone), | 228 blocks_(8, zone), |
| 224 stack_check_(NULL) { | 229 stack_check_(NULL), |
| 230 exits_count_(0) { |
| 225 blocks_.Add(loop_header, zone); | 231 blocks_.Add(loop_header, zone); |
| 226 } | 232 } |
| 227 virtual ~HLoopInformation() {} | 233 virtual ~HLoopInformation() {} |
| 228 | 234 |
| 229 const ZoneList<HBasicBlock*>* back_edges() const { return &back_edges_; } | 235 const ZoneList<HBasicBlock*>* back_edges() const { return &back_edges_; } |
| 230 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 236 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| 231 HBasicBlock* loop_header() const { return loop_header_; } | 237 HBasicBlock* loop_header() const { return loop_header_; } |
| 232 HBasicBlock* GetLastBackEdge() const; | 238 HBasicBlock* GetLastBackEdge() const; |
| 233 void RegisterBackEdge(HBasicBlock* block); | 239 void RegisterBackEdge(HBasicBlock* block); |
| 234 | 240 |
| 235 HStackCheck* stack_check() const { return stack_check_; } | 241 HStackCheck* stack_check() const { return stack_check_; } |
| 236 void set_stack_check(HStackCheck* stack_check) { | 242 void set_stack_check(HStackCheck* stack_check) { |
| 237 stack_check_ = stack_check; | 243 stack_check_ = stack_check; |
| 238 } | 244 } |
| 239 | 245 |
| 246 int exits_count() { return exits_count_; } |
| 247 HLoopInformation* parent_loop() { |
| 248 HBasicBlock* parent_header = loop_header()->parent_loop_header(); |
| 249 return parent_header != NULL ? parent_header->loop_information() : NULL; |
| 250 } |
| 251 bool IsNestedInThisLoop(HLoopInformation* other) { |
| 252 while (other != NULL) { |
| 253 if (other == this) { |
| 254 return true; |
| 255 } |
| 256 other = other->parent_loop(); |
| 257 } |
| 258 return false; |
| 259 } |
| 260 void ProcessEdge(HBasicBlock* destination); |
| 261 void ProcessThrow(); |
| 262 |
| 240 private: | 263 private: |
| 241 void AddBlock(HBasicBlock* block); | 264 void AddBlock(HBasicBlock* block); |
| 242 | 265 |
| 243 ZoneList<HBasicBlock*> back_edges_; | 266 ZoneList<HBasicBlock*> back_edges_; |
| 244 HBasicBlock* loop_header_; | 267 HBasicBlock* loop_header_; |
| 245 ZoneList<HBasicBlock*> blocks_; | 268 ZoneList<HBasicBlock*> blocks_; |
| 246 HStackCheck* stack_check_; | 269 HStackCheck* stack_check_; |
| 270 int exits_count_; |
| 247 }; | 271 }; |
| 248 | 272 |
| 249 class BoundsCheckTable; | 273 class BoundsCheckTable; |
| 250 class HGraph: public ZoneObject { | 274 class HGraph: public ZoneObject { |
| 251 public: | 275 public: |
| 252 explicit HGraph(CompilationInfo* info); | 276 explicit HGraph(CompilationInfo* info); |
| 253 | 277 |
| 254 Isolate* isolate() const { return isolate_; } | 278 Isolate* isolate() const { return isolate_; } |
| 255 Zone* zone() const { return zone_; } | 279 Zone* zone() const { return zone_; } |
| 256 CompilationInfo* info() const { return info_; } | 280 CompilationInfo* info() const { return info_; } |
| 257 | 281 |
| 258 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 282 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| 259 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } | 283 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } |
| 260 HBasicBlock* entry_block() const { return entry_block_; } | 284 HBasicBlock* entry_block() const { return entry_block_; } |
| 261 HEnvironment* start_environment() const { return start_environment_; } | 285 HEnvironment* start_environment() const { return start_environment_; } |
| 262 | 286 |
| 287 bool HasRelationBeenEvaluated(HValue* value, |
| 288 NumericRelation relation, |
| 289 HValue* other_value, |
| 290 int offset, |
| 291 int scale, |
| 292 HBasicBlock* block, |
| 293 bool* result) { |
| 294 return evaluated_relations_table_.IsInTable( |
| 295 value->id(), relation, other_value->id(), |
| 296 offset, scale, block->block_id(), result); |
| 297 } |
| 298 void AddRelationToTable(HValue* value, |
| 299 NumericRelation relation, |
| 300 HValue* other_value, |
| 301 int offset, |
| 302 int scale, |
| 303 HBasicBlock* block, |
| 304 bool result) { |
| 305 evaluated_relations_table_.AddToTable( |
| 306 value->id(), relation, other_value->id(), |
| 307 offset, scale, block->block_id(), result); |
| 308 } |
| 309 void ClearRelationsTable() { |
| 310 evaluated_relations_table_.Clear(); |
| 311 } |
| 312 |
| 263 void InitializeInferredTypes(); | 313 void InitializeInferredTypes(); |
| 264 void InsertTypeConversions(); | 314 void InsertTypeConversions(); |
| 265 void MergeRemovableSimulates(); | 315 void MergeRemovableSimulates(); |
| 266 void InsertRepresentationChanges(); | 316 void InsertRepresentationChanges(); |
| 267 void MarkDeoptimizeOnUndefined(); | 317 void MarkDeoptimizeOnUndefined(); |
| 268 void ComputeMinusZeroChecks(); | 318 void ComputeMinusZeroChecks(); |
| 269 void ComputeSafeUint32Operations(); | 319 void ComputeSafeUint32Operations(); |
| 270 void GlobalValueNumbering(); | 320 void GlobalValueNumbering(); |
| 271 bool ProcessArgumentsObject(); | 321 bool ProcessArgumentsObject(); |
| 272 void EliminateRedundantPhis(); | 322 void EliminateRedundantPhis(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 HValue* use_value, | 449 HValue* use_value, |
| 400 int use_index, | 450 int use_index, |
| 401 Representation to); | 451 Representation to); |
| 402 void InsertRepresentationChangesForValue(HValue* value); | 452 void InsertRepresentationChangesForValue(HValue* value); |
| 403 void InferTypes(ZoneList<HValue*>* worklist); | 453 void InferTypes(ZoneList<HValue*>* worklist); |
| 404 void InitializeInferredTypes(int from_inclusive, int to_inclusive); | 454 void InitializeInferredTypes(int from_inclusive, int to_inclusive); |
| 405 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); | 455 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); |
| 406 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); | 456 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); |
| 407 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); | 457 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); |
| 408 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); | 458 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); |
| 459 void EliminateRedundantBoundsChecksUsingIdefs(HBasicBlock* bb); |
| 460 void ApplyBoundsChecksIndexChanges(HBasicBlock* bb); |
| 409 | 461 |
| 410 Isolate* isolate_; | 462 Isolate* isolate_; |
| 411 int next_block_id_; | 463 int next_block_id_; |
| 412 HBasicBlock* entry_block_; | 464 HBasicBlock* entry_block_; |
| 413 HEnvironment* start_environment_; | 465 HEnvironment* start_environment_; |
| 414 ZoneList<HBasicBlock*> blocks_; | 466 ZoneList<HBasicBlock*> blocks_; |
| 415 ZoneList<HValue*> values_; | 467 ZoneList<HValue*> values_; |
| 416 ZoneList<HPhi*>* phi_list_; | 468 ZoneList<HPhi*>* phi_list_; |
| 417 ZoneList<HInstruction*>* uint32_instructions_; | 469 ZoneList<HInstruction*>* uint32_instructions_; |
| 418 SetOncePointer<HConstant> undefined_constant_; | 470 SetOncePointer<HConstant> undefined_constant_; |
| 419 SetOncePointer<HConstant> constant_0_; | 471 SetOncePointer<HConstant> constant_0_; |
| 420 SetOncePointer<HConstant> constant_1_; | 472 SetOncePointer<HConstant> constant_1_; |
| 421 SetOncePointer<HConstant> constant_minus1_; | 473 SetOncePointer<HConstant> constant_minus1_; |
| 422 SetOncePointer<HConstant> constant_true_; | 474 SetOncePointer<HConstant> constant_true_; |
| 423 SetOncePointer<HConstant> constant_false_; | 475 SetOncePointer<HConstant> constant_false_; |
| 424 SetOncePointer<HConstant> constant_the_hole_; | 476 SetOncePointer<HConstant> constant_the_hole_; |
| 425 SetOncePointer<HConstant> constant_invalid_context_; | 477 SetOncePointer<HConstant> constant_invalid_context_; |
| 426 SetOncePointer<HArgumentsObject> arguments_object_; | 478 SetOncePointer<HArgumentsObject> arguments_object_; |
| 427 | 479 |
| 428 SetOncePointer<HBasicBlock> osr_loop_entry_; | 480 SetOncePointer<HBasicBlock> osr_loop_entry_; |
| 429 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; | 481 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; |
| 430 | 482 |
| 431 CompilationInfo* info_; | 483 CompilationInfo* info_; |
| 432 Zone* zone_; | 484 Zone* zone_; |
| 433 | 485 |
| 486 NumericRelationTable evaluated_relations_table_; |
| 487 |
| 434 bool is_recursive_; | 488 bool is_recursive_; |
| 435 bool use_optimistic_licm_; | 489 bool use_optimistic_licm_; |
| 436 bool has_soft_deoptimize_; | 490 bool has_soft_deoptimize_; |
| 437 int type_change_checksum_; | 491 int type_change_checksum_; |
| 438 | 492 |
| 439 DISALLOW_COPY_AND_ASSIGN(HGraph); | 493 DISALLOW_COPY_AND_ASSIGN(HGraph); |
| 440 }; | 494 }; |
| 441 | 495 |
| 442 | 496 |
| 443 Zone* HBasicBlock::zone() const { return graph_->zone(); } | 497 Zone* HBasicBlock::zone() const { return graph_->zone(); } |
| (...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 EmbeddedVector<char, 64> filename_; | 1846 EmbeddedVector<char, 64> filename_; |
| 1793 HeapStringAllocator string_allocator_; | 1847 HeapStringAllocator string_allocator_; |
| 1794 StringStream trace_; | 1848 StringStream trace_; |
| 1795 int indent_; | 1849 int indent_; |
| 1796 }; | 1850 }; |
| 1797 | 1851 |
| 1798 | 1852 |
| 1799 } } // namespace v8::internal | 1853 } } // namespace v8::internal |
| 1800 | 1854 |
| 1801 #endif // V8_HYDROGEN_H_ | 1855 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |