| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_FLOW_GRAPH_COMPILER_H_ | 5 #ifndef VM_FLOW_GRAPH_COMPILER_H_ |
| 6 #define VM_FLOW_GRAPH_COMPILER_H_ | 6 #define VM_FLOW_GRAPH_COMPILER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 void CompileGraph(); | 360 void CompileGraph(); |
| 361 | 361 |
| 362 void VisitBlocks(); | 362 void VisitBlocks(); |
| 363 | 363 |
| 364 // Bail out of the flow graph compiler. Does not return to the caller. | 364 // Bail out of the flow graph compiler. Does not return to the caller. |
| 365 void Bailout(const char* reason); | 365 void Bailout(const char* reason); |
| 366 | 366 |
| 367 // Returns 'true' if regular code generation should be skipped. | 367 // Returns 'true' if regular code generation should be skipped. |
| 368 bool TryIntrinsify(); | 368 bool TryIntrinsify(); |
| 369 | 369 |
| 370 void GenerateAssertAssignable(TokenPosition token_pos, |
| 371 intptr_t deopt_id, |
| 372 const AbstractType& dst_type, |
| 373 const String& dst_name, |
| 374 LocationSummary* locs); |
| 375 |
| 376 #if !defined(TARGET_ARCH_DBC) |
| 370 void GenerateRuntimeCall(TokenPosition token_pos, | 377 void GenerateRuntimeCall(TokenPosition token_pos, |
| 371 intptr_t deopt_id, | 378 intptr_t deopt_id, |
| 372 const RuntimeEntry& entry, | 379 const RuntimeEntry& entry, |
| 373 intptr_t argument_count, | 380 intptr_t argument_count, |
| 374 LocationSummary* locs); | 381 LocationSummary* locs); |
| 375 | 382 |
| 376 void GenerateCall(TokenPosition token_pos, | 383 void GenerateCall(TokenPosition token_pos, |
| 377 const StubEntry& stub_entry, | 384 const StubEntry& stub_entry, |
| 378 RawPcDescriptors::Kind kind, | 385 RawPcDescriptors::Kind kind, |
| 379 LocationSummary* locs); | 386 LocationSummary* locs); |
| 380 | 387 |
| 381 void GenerateDartCall(intptr_t deopt_id, | 388 void GenerateDartCall(intptr_t deopt_id, |
| 382 TokenPosition token_pos, | 389 TokenPosition token_pos, |
| 383 const StubEntry& stub_entry, | 390 const StubEntry& stub_entry, |
| 384 RawPcDescriptors::Kind kind, | 391 RawPcDescriptors::Kind kind, |
| 385 LocationSummary* locs); | 392 LocationSummary* locs); |
| 386 void GenerateStaticDartCall(intptr_t deopt_id, | 393 void GenerateStaticDartCall(intptr_t deopt_id, |
| 387 TokenPosition token_pos, | 394 TokenPosition token_pos, |
| 388 const StubEntry& stub_entry, | 395 const StubEntry& stub_entry, |
| 389 RawPcDescriptors::Kind kind, | 396 RawPcDescriptors::Kind kind, |
| 390 LocationSummary* locs, | 397 LocationSummary* locs, |
| 391 const Function& target); | 398 const Function& target); |
| 392 | 399 |
| 393 void GenerateAssertAssignable(TokenPosition token_pos, | |
| 394 intptr_t deopt_id, | |
| 395 const AbstractType& dst_type, | |
| 396 const String& dst_name, | |
| 397 LocationSummary* locs); | |
| 398 | |
| 399 void GenerateInstanceOf(TokenPosition token_pos, | 400 void GenerateInstanceOf(TokenPosition token_pos, |
| 400 intptr_t deopt_id, | 401 intptr_t deopt_id, |
| 401 const AbstractType& type, | 402 const AbstractType& type, |
| 402 bool negate_result, | 403 bool negate_result, |
| 403 LocationSummary* locs); | 404 LocationSummary* locs); |
| 404 | 405 |
| 405 void GenerateInstanceCall(intptr_t deopt_id, | 406 void GenerateInstanceCall(intptr_t deopt_id, |
| 406 TokenPosition token_pos, | 407 TokenPosition token_pos, |
| 407 intptr_t argument_count, | 408 intptr_t argument_count, |
| 408 LocationSummary* locs, | 409 LocationSummary* locs, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 419 void GenerateNumberTypeCheck(Register kClassIdReg, | 420 void GenerateNumberTypeCheck(Register kClassIdReg, |
| 420 const AbstractType& type, | 421 const AbstractType& type, |
| 421 Label* is_instance_lbl, | 422 Label* is_instance_lbl, |
| 422 Label* is_not_instance_lbl); | 423 Label* is_not_instance_lbl); |
| 423 void GenerateStringTypeCheck(Register kClassIdReg, | 424 void GenerateStringTypeCheck(Register kClassIdReg, |
| 424 Label* is_instance_lbl, | 425 Label* is_instance_lbl, |
| 425 Label* is_not_instance_lbl); | 426 Label* is_not_instance_lbl); |
| 426 void GenerateListTypeCheck(Register kClassIdReg, | 427 void GenerateListTypeCheck(Register kClassIdReg, |
| 427 Label* is_instance_lbl); | 428 Label* is_instance_lbl); |
| 428 | 429 |
| 429 void EmitComment(Instruction* instr); | |
| 430 | |
| 431 bool NeedsEdgeCounter(TargetEntryInstr* block); | |
| 432 | |
| 433 void EmitEdgeCounter(intptr_t edge_id); | |
| 434 | |
| 435 void EmitOptimizedInstanceCall(const StubEntry& stub_entry, | 430 void EmitOptimizedInstanceCall(const StubEntry& stub_entry, |
| 436 const ICData& ic_data, | 431 const ICData& ic_data, |
| 437 intptr_t argument_count, | 432 intptr_t argument_count, |
| 438 intptr_t deopt_id, | 433 intptr_t deopt_id, |
| 439 TokenPosition token_pos, | 434 TokenPosition token_pos, |
| 440 LocationSummary* locs); | 435 LocationSummary* locs); |
| 441 | 436 |
| 442 void EmitInstanceCall(const StubEntry& stub_entry, | 437 void EmitInstanceCall(const StubEntry& stub_entry, |
| 443 const ICData& ic_data, | 438 const ICData& ic_data, |
| 444 intptr_t argument_count, | 439 intptr_t argument_count, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 | 475 |
| 481 Condition EmitEqualityRegConstCompare(Register reg, | 476 Condition EmitEqualityRegConstCompare(Register reg, |
| 482 const Object& obj, | 477 const Object& obj, |
| 483 bool needs_number_check, | 478 bool needs_number_check, |
| 484 TokenPosition token_pos); | 479 TokenPosition token_pos); |
| 485 Condition EmitEqualityRegRegCompare(Register left, | 480 Condition EmitEqualityRegRegCompare(Register left, |
| 486 Register right, | 481 Register right, |
| 487 bool needs_number_check, | 482 bool needs_number_check, |
| 488 TokenPosition token_pos); | 483 TokenPosition token_pos); |
| 489 | 484 |
| 485 bool NeedsEdgeCounter(TargetEntryInstr* block); |
| 486 |
| 487 void EmitEdgeCounter(intptr_t edge_id); |
| 488 #endif |
| 489 |
| 490 void EmitTrySync(Instruction* instr, intptr_t try_index); | 490 void EmitTrySync(Instruction* instr, intptr_t try_index); |
| 491 | 491 |
| 492 void EmitComment(Instruction* instr); |
| 493 |
| 494 |
| 492 intptr_t StackSize() const; | 495 intptr_t StackSize() const; |
| 493 | 496 |
| 494 // Returns assembler label associated with the given block entry. | 497 // Returns assembler label associated with the given block entry. |
| 495 Label* GetJumpLabel(BlockEntryInstr* block_entry) const; | 498 Label* GetJumpLabel(BlockEntryInstr* block_entry) const; |
| 496 bool WasCompacted(BlockEntryInstr* block_entry) const; | 499 bool WasCompacted(BlockEntryInstr* block_entry) const; |
| 497 | 500 |
| 498 // Returns the label of the fall-through of the current block. | 501 // Returns the label of the fall-through of the current block. |
| 499 Label* NextNonEmptyLabel() const; | 502 Label* NextNonEmptyLabel() const; |
| 500 | 503 |
| 501 // Returns true if there is a next block after the current one in | 504 // Returns true if there is a next block after the current one in |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 intptr_t deopt_id, | 631 intptr_t deopt_id, |
| 629 TokenPosition token_pos, | 632 TokenPosition token_pos, |
| 630 LocationSummary* locs); | 633 LocationSummary* locs); |
| 631 | 634 |
| 632 void EmitUnoptimizedStaticCall(intptr_t argument_count, | 635 void EmitUnoptimizedStaticCall(intptr_t argument_count, |
| 633 intptr_t deopt_id, | 636 intptr_t deopt_id, |
| 634 TokenPosition token_pos, | 637 TokenPosition token_pos, |
| 635 LocationSummary* locs, | 638 LocationSummary* locs, |
| 636 const ICData& ic_data); | 639 const ICData& ic_data); |
| 637 | 640 |
| 641 #if !defined(TARGET_ARCH_DBC) |
| 638 // Type checking helper methods. | 642 // Type checking helper methods. |
| 639 void CheckClassIds(Register class_id_reg, | 643 void CheckClassIds(Register class_id_reg, |
| 640 const GrowableArray<intptr_t>& class_ids, | 644 const GrowableArray<intptr_t>& class_ids, |
| 641 Label* is_instance_lbl, | 645 Label* is_instance_lbl, |
| 642 Label* is_not_instance_lbl); | 646 Label* is_not_instance_lbl); |
| 643 | 647 |
| 644 RawSubtypeTestCache* GenerateInlineInstanceof(TokenPosition token_pos, | 648 RawSubtypeTestCache* GenerateInlineInstanceof(TokenPosition token_pos, |
| 645 const AbstractType& type, | 649 const AbstractType& type, |
| 646 Label* is_instance_lbl, | 650 Label* is_instance_lbl, |
| 647 Label* is_not_instance_lbl); | 651 Label* is_not_instance_lbl); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 Register temp_reg, | 685 Register temp_reg, |
| 682 Label* is_instance_lbl, | 686 Label* is_instance_lbl, |
| 683 Label* is_not_instance_lbl); | 687 Label* is_not_instance_lbl); |
| 684 | 688 |
| 685 // Returns true if checking against this type is a direct class id comparison. | 689 // Returns true if checking against this type is a direct class id comparison. |
| 686 bool TypeCheckAsClassEquality(const AbstractType& type); | 690 bool TypeCheckAsClassEquality(const AbstractType& type); |
| 687 | 691 |
| 688 void GenerateBoolToJump(Register bool_reg, Label* is_true, Label* is_false); | 692 void GenerateBoolToJump(Register bool_reg, Label* is_true, Label* is_false); |
| 689 | 693 |
| 690 void CopyParameters(); | 694 void CopyParameters(); |
| 695 #endif |
| 691 | 696 |
| 692 void GenerateInlinedGetter(intptr_t offset); | 697 void GenerateInlinedGetter(intptr_t offset); |
| 693 void GenerateInlinedSetter(intptr_t offset); | 698 void GenerateInlinedSetter(intptr_t offset); |
| 694 | 699 |
| 695 // Perform a greedy local register allocation. Consider all registers free. | 700 // Perform a greedy local register allocation. Consider all registers free. |
| 696 void AllocateRegistersLocally(Instruction* instr); | 701 void AllocateRegistersLocally(Instruction* instr); |
| 697 | 702 |
| 698 // Map a block number in a forward iteration into the block number in the | 703 // Map a block number in a forward iteration into the block number in the |
| 699 // corresponding reverse iteration. Used to obtain an index into | 704 // corresponding reverse iteration. Used to obtain an index into |
| 700 // block_order for reverse iterations. | 705 // block_order for reverse iterations. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 713 | 718 |
| 714 intptr_t GetOptimizationThreshold() const; | 719 intptr_t GetOptimizationThreshold() const; |
| 715 | 720 |
| 716 StackmapTableBuilder* stackmap_table_builder() { | 721 StackmapTableBuilder* stackmap_table_builder() { |
| 717 if (stackmap_table_builder_ == NULL) { | 722 if (stackmap_table_builder_ == NULL) { |
| 718 stackmap_table_builder_ = new StackmapTableBuilder(); | 723 stackmap_table_builder_ = new StackmapTableBuilder(); |
| 719 } | 724 } |
| 720 return stackmap_table_builder_; | 725 return stackmap_table_builder_; |
| 721 } | 726 } |
| 722 | 727 |
| 723 #if defined(DEBUG) | 728 #if defined(DEBUG) && !defined(TARGET_ARCH_DBC) |
| 724 void FrameStateUpdateWith(Instruction* instr); | 729 void FrameStateUpdateWith(Instruction* instr); |
| 725 void FrameStatePush(Definition* defn); | 730 void FrameStatePush(Definition* defn); |
| 726 void FrameStatePop(intptr_t count); | 731 void FrameStatePop(intptr_t count); |
| 727 bool FrameStateIsSafeToCall(); | 732 bool FrameStateIsSafeToCall(); |
| 728 void FrameStateClear(); | 733 void FrameStateClear(); |
| 729 #endif | 734 #endif |
| 730 | 735 |
| 731 // This struct contains either function or code, the other one being NULL. | 736 // This struct contains either function or code, the other one being NULL. |
| 732 class StaticCallsStruct : public ZoneAllocated { | 737 class StaticCallsStruct : public ZoneAllocated { |
| 733 public: | 738 public: |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 const GrowableArray<const Function*>& inline_id_to_function_; | 810 const GrowableArray<const Function*>& inline_id_to_function_; |
| 806 const GrowableArray<TokenPosition>& inline_id_to_token_pos_; | 811 const GrowableArray<TokenPosition>& inline_id_to_token_pos_; |
| 807 const GrowableArray<intptr_t>& caller_inline_id_; | 812 const GrowableArray<intptr_t>& caller_inline_id_; |
| 808 | 813 |
| 809 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 814 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 810 }; | 815 }; |
| 811 | 816 |
| 812 } // namespace dart | 817 } // namespace dart |
| 813 | 818 |
| 814 #endif // VM_FLOW_GRAPH_COMPILER_H_ | 819 #endif // VM_FLOW_GRAPH_COMPILER_H_ |
| OLD | NEW |