| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 void set_block_id(int id) { block_id_ = id; } | 63 void set_block_id(int id) { block_id_ = id; } |
| 64 HGraph* graph() const { return graph_; } | 64 HGraph* graph() const { return graph_; } |
| 65 Isolate* isolate() const; | 65 Isolate* isolate() const; |
| 66 const ZoneList<HPhi*>* phis() const { return &phis_; } | 66 const ZoneList<HPhi*>* phis() const { return &phis_; } |
| 67 HInstruction* first() const { return first_; } | 67 HInstruction* first() const { return first_; } |
| 68 HInstruction* last() const { return last_; } | 68 HInstruction* last() const { return last_; } |
| 69 void set_last(HInstruction* instr) { last_ = instr; } | 69 void set_last(HInstruction* instr) { last_ = instr; } |
| 70 HInstruction* GetLastInstruction(); | 70 HInstruction* GetLastInstruction(); |
| 71 HControlInstruction* end() const { return end_; } | 71 HControlInstruction* end() const { return end_; } |
| 72 HLoopInformation* loop_information() const { return loop_information_; } | 72 HLoopInformation* loop_information() const { return loop_information_; } |
| 73 HLoopInformation* current_loop() const { |
| 74 return IsLoopHeader() ? loop_information() |
| 75 : (parent_loop_header() != NULL |
| 76 ? parent_loop_header()->loop_information() : NULL); |
| 77 } |
| 73 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } | 78 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } |
| 74 bool HasPredecessor() const { return predecessors_.length() > 0; } | 79 bool HasPredecessor() const { return predecessors_.length() > 0; } |
| 75 const ZoneList<HBasicBlock*>* dominated_blocks() const { | 80 const ZoneList<HBasicBlock*>* dominated_blocks() const { |
| 76 return &dominated_blocks_; | 81 return &dominated_blocks_; |
| 77 } | 82 } |
| 78 const ZoneList<int>* deleted_phis() const { | 83 const ZoneList<int>* deleted_phis() const { |
| 79 return &deleted_phis_; | 84 return &deleted_phis_; |
| 80 } | 85 } |
| 81 void RecordDeletedPhi(int merge_index) { | 86 void RecordDeletedPhi(int merge_index) { |
| 82 deleted_phis_.Add(merge_index, zone()); | 87 deleted_phis_.Add(merge_index, zone()); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 int current_; | 225 int current_; |
| 221 }; | 226 }; |
| 222 | 227 |
| 223 | 228 |
| 224 class HLoopInformation: public ZoneObject { | 229 class HLoopInformation: public ZoneObject { |
| 225 public: | 230 public: |
| 226 HLoopInformation(HBasicBlock* loop_header, Zone* zone) | 231 HLoopInformation(HBasicBlock* loop_header, Zone* zone) |
| 227 : back_edges_(4, zone), | 232 : back_edges_(4, zone), |
| 228 loop_header_(loop_header), | 233 loop_header_(loop_header), |
| 229 blocks_(8, zone), | 234 blocks_(8, zone), |
| 230 stack_check_(NULL) { | 235 stack_check_(NULL), |
| 236 exits_count_(0) { |
| 231 blocks_.Add(loop_header, zone); | 237 blocks_.Add(loop_header, zone); |
| 232 } | 238 } |
| 233 virtual ~HLoopInformation() {} | 239 virtual ~HLoopInformation() {} |
| 234 | 240 |
| 235 const ZoneList<HBasicBlock*>* back_edges() const { return &back_edges_; } | 241 const ZoneList<HBasicBlock*>* back_edges() const { return &back_edges_; } |
| 236 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 242 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| 237 HBasicBlock* loop_header() const { return loop_header_; } | 243 HBasicBlock* loop_header() const { return loop_header_; } |
| 238 HBasicBlock* GetLastBackEdge() const; | 244 HBasicBlock* GetLastBackEdge() const; |
| 239 void RegisterBackEdge(HBasicBlock* block); | 245 void RegisterBackEdge(HBasicBlock* block); |
| 240 | 246 |
| 241 HStackCheck* stack_check() const { return stack_check_; } | 247 HStackCheck* stack_check() const { return stack_check_; } |
| 242 void set_stack_check(HStackCheck* stack_check) { | 248 void set_stack_check(HStackCheck* stack_check) { |
| 243 stack_check_ = stack_check; | 249 stack_check_ = stack_check; |
| 244 } | 250 } |
| 245 | 251 |
| 252 int exits_count() { return exits_count_; } |
| 253 HLoopInformation* parent_loop() { |
| 254 HBasicBlock* parent_header = loop_header()->parent_loop_header(); |
| 255 return parent_header != NULL ? parent_header->loop_information() : NULL; |
| 256 } |
| 257 bool IsNestedInThisLoop(HLoopInformation* other) { |
| 258 while (other != NULL) { |
| 259 if (other == this) { |
| 260 return true; |
| 261 } |
| 262 other = other->parent_loop(); |
| 263 } |
| 264 return false; |
| 265 } |
| 266 void ProcessEdge(HBasicBlock* destination); |
| 267 void ProcessThrow(); |
| 268 |
| 246 private: | 269 private: |
| 247 void AddBlock(HBasicBlock* block); | 270 void AddBlock(HBasicBlock* block); |
| 248 | 271 |
| 249 ZoneList<HBasicBlock*> back_edges_; | 272 ZoneList<HBasicBlock*> back_edges_; |
| 250 HBasicBlock* loop_header_; | 273 HBasicBlock* loop_header_; |
| 251 ZoneList<HBasicBlock*> blocks_; | 274 ZoneList<HBasicBlock*> blocks_; |
| 252 HStackCheck* stack_check_; | 275 HStackCheck* stack_check_; |
| 276 int exits_count_; |
| 253 }; | 277 }; |
| 254 | 278 |
| 255 class BoundsCheckTable; | 279 class BoundsCheckTable; |
| 256 class HGraph: public ZoneObject { | 280 class HGraph: public ZoneObject { |
| 257 public: | 281 public: |
| 258 explicit HGraph(CompilationInfo* info); | 282 explicit HGraph(CompilationInfo* info); |
| 259 | 283 |
| 260 Isolate* isolate() const { return isolate_; } | 284 Isolate* isolate() const { return isolate_; } |
| 261 Zone* zone() const { return zone_; } | 285 Zone* zone() const { return zone_; } |
| 262 CompilationInfo* info() const { return info_; } | 286 CompilationInfo* info() const { return info_; } |
| 263 | 287 |
| 264 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 288 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| 265 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } | 289 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } |
| 266 HBasicBlock* entry_block() const { return entry_block_; } | 290 HBasicBlock* entry_block() const { return entry_block_; } |
| 267 HEnvironment* start_environment() const { return start_environment_; } | 291 HEnvironment* start_environment() const { return start_environment_; } |
| 268 | 292 |
| 269 void FinalizeUniqueValueIds(); | 293 void FinalizeUniqueValueIds(); |
| 294 |
| 295 bool HasRelationBeenEvaluated(HValue* value, |
| 296 NumericRelation relation, |
| 297 HValue* other_value, |
| 298 int offset, |
| 299 int scale, |
| 300 HBasicBlock* block, |
| 301 bool* result) { |
| 302 return evaluated_relations_table_.IsInTable( |
| 303 value->id(), relation, other_value->id(), |
| 304 offset, scale, block->block_id(), result); |
| 305 } |
| 306 void AddRelationToTable(HValue* value, |
| 307 NumericRelation relation, |
| 308 HValue* other_value, |
| 309 int offset, |
| 310 int scale, |
| 311 HBasicBlock* block, |
| 312 bool result) { |
| 313 evaluated_relations_table_.AddToTable( |
| 314 value->id(), relation, other_value->id(), |
| 315 offset, scale, block->block_id(), result); |
| 316 } |
| 317 void ClearRelationsTable() { |
| 318 evaluated_relations_table_.Clear(); |
| 319 } |
| 320 |
| 270 void InitializeInferredTypes(); | 321 void InitializeInferredTypes(); |
| 271 void InsertTypeConversions(); | 322 void InsertTypeConversions(); |
| 272 void MergeRemovableSimulates(); | 323 void MergeRemovableSimulates(); |
| 273 void InsertRepresentationChanges(); | 324 void InsertRepresentationChanges(); |
| 274 void MarkDeoptimizeOnUndefined(); | 325 void MarkDeoptimizeOnUndefined(); |
| 275 void ComputeMinusZeroChecks(); | 326 void ComputeMinusZeroChecks(); |
| 276 void ComputeSafeUint32Operations(); | 327 void ComputeSafeUint32Operations(); |
| 277 void GlobalValueNumbering(); | 328 void GlobalValueNumbering(); |
| 278 bool ProcessArgumentsObject(); | 329 bool ProcessArgumentsObject(); |
| 279 void EliminateRedundantPhis(); | 330 void EliminateRedundantPhis(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 HValue* use_value, | 471 HValue* use_value, |
| 421 int use_index, | 472 int use_index, |
| 422 Representation to); | 473 Representation to); |
| 423 void InsertRepresentationChangesForValue(HValue* value); | 474 void InsertRepresentationChangesForValue(HValue* value); |
| 424 void InferTypes(ZoneList<HValue*>* worklist); | 475 void InferTypes(ZoneList<HValue*>* worklist); |
| 425 void InitializeInferredTypes(int from_inclusive, int to_inclusive); | 476 void InitializeInferredTypes(int from_inclusive, int to_inclusive); |
| 426 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); | 477 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); |
| 427 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); | 478 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); |
| 428 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); | 479 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); |
| 429 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); | 480 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); |
| 481 void EliminateRedundantBoundsChecksUsingIdefs(HBasicBlock* bb); |
| 482 void ApplyBoundsChecksIndexChanges(HBasicBlock* bb); |
| 430 | 483 |
| 431 Isolate* isolate_; | 484 Isolate* isolate_; |
| 432 int next_block_id_; | 485 int next_block_id_; |
| 433 HBasicBlock* entry_block_; | 486 HBasicBlock* entry_block_; |
| 434 HEnvironment* start_environment_; | 487 HEnvironment* start_environment_; |
| 435 ZoneList<HBasicBlock*> blocks_; | 488 ZoneList<HBasicBlock*> blocks_; |
| 436 ZoneList<HValue*> values_; | 489 ZoneList<HValue*> values_; |
| 437 ZoneList<HPhi*>* phi_list_; | 490 ZoneList<HPhi*>* phi_list_; |
| 438 ZoneList<HInstruction*>* uint32_instructions_; | 491 ZoneList<HInstruction*>* uint32_instructions_; |
| 439 SetOncePointer<HConstant> undefined_constant_; | 492 SetOncePointer<HConstant> undefined_constant_; |
| 440 SetOncePointer<HConstant> constant_0_; | 493 SetOncePointer<HConstant> constant_0_; |
| 441 SetOncePointer<HConstant> constant_1_; | 494 SetOncePointer<HConstant> constant_1_; |
| 442 SetOncePointer<HConstant> constant_smi_0_; | 495 SetOncePointer<HConstant> constant_smi_0_; |
| 443 SetOncePointer<HConstant> constant_smi_1_; | 496 SetOncePointer<HConstant> constant_smi_1_; |
| 444 SetOncePointer<HConstant> constant_minus1_; | 497 SetOncePointer<HConstant> constant_minus1_; |
| 445 SetOncePointer<HConstant> constant_true_; | 498 SetOncePointer<HConstant> constant_true_; |
| 446 SetOncePointer<HConstant> constant_false_; | 499 SetOncePointer<HConstant> constant_false_; |
| 447 SetOncePointer<HConstant> constant_the_hole_; | 500 SetOncePointer<HConstant> constant_the_hole_; |
| 448 SetOncePointer<HConstant> constant_null_; | 501 SetOncePointer<HConstant> constant_null_; |
| 449 SetOncePointer<HConstant> constant_invalid_context_; | 502 SetOncePointer<HConstant> constant_invalid_context_; |
| 450 SetOncePointer<HArgumentsObject> arguments_object_; | 503 SetOncePointer<HArgumentsObject> arguments_object_; |
| 451 | 504 |
| 452 SetOncePointer<HBasicBlock> osr_loop_entry_; | 505 SetOncePointer<HBasicBlock> osr_loop_entry_; |
| 453 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; | 506 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; |
| 454 | 507 |
| 455 CompilationInfo* info_; | 508 CompilationInfo* info_; |
| 456 Zone* zone_; | 509 Zone* zone_; |
| 457 | 510 |
| 511 NumericRelationTable evaluated_relations_table_; |
| 512 |
| 458 bool is_recursive_; | 513 bool is_recursive_; |
| 459 bool use_optimistic_licm_; | 514 bool use_optimistic_licm_; |
| 460 bool has_soft_deoptimize_; | 515 bool has_soft_deoptimize_; |
| 461 bool depends_on_empty_array_proto_elements_; | 516 bool depends_on_empty_array_proto_elements_; |
| 462 int type_change_checksum_; | 517 int type_change_checksum_; |
| 463 | 518 |
| 464 DISALLOW_COPY_AND_ASSIGN(HGraph); | 519 DISALLOW_COPY_AND_ASSIGN(HGraph); |
| 465 }; | 520 }; |
| 466 | 521 |
| 467 | 522 |
| (...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2025 EmbeddedVector<char, 64> filename_; | 2080 EmbeddedVector<char, 64> filename_; |
| 2026 HeapStringAllocator string_allocator_; | 2081 HeapStringAllocator string_allocator_; |
| 2027 StringStream trace_; | 2082 StringStream trace_; |
| 2028 int indent_; | 2083 int indent_; |
| 2029 }; | 2084 }; |
| 2030 | 2085 |
| 2031 | 2086 |
| 2032 } } // namespace v8::internal | 2087 } } // namespace v8::internal |
| 2033 | 2088 |
| 2034 #endif // V8_HYDROGEN_H_ | 2089 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |