| 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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 const Class& cls = Class::Handle(function.signature_class()); | 582 const Class& cls = Class::Handle(function.signature_class()); |
| 583 if (cls.HasTypeArguments()) { | 583 if (cls.HasTypeArguments()) { |
| 584 __ popq(RCX); // Discard type arguments. | 584 __ popq(RCX); // Discard type arguments. |
| 585 } | 585 } |
| 586 if (function.IsImplicitInstanceClosureFunction()) { | 586 if (function.IsImplicitInstanceClosureFunction()) { |
| 587 __ popq(RCX); // Discard receiver. | 587 __ popq(RCX); // Discard receiver. |
| 588 } | 588 } |
| 589 } | 589 } |
| 590 | 590 |
| 591 | 591 |
| 592 void FlowGraphCompiler::VisitThrow(ThrowComp* comp) { | |
| 593 LoadValue(RAX, comp->exception()); | |
| 594 __ pushq(RAX); | |
| 595 GenerateCallRuntime(comp->node_id(), comp->token_index(), kThrowRuntimeEntry); | |
| 596 __ int3(); | |
| 597 } | |
| 598 | |
| 599 | |
| 600 void FlowGraphCompiler::VisitReThrow(ReThrowComp* comp) { | |
| 601 LoadValue(RBX, comp->stack_trace()); | |
| 602 LoadValue(RAX, comp->exception()); | |
| 603 __ pushq(RAX); | |
| 604 __ pushq(RBX); | |
| 605 GenerateCallRuntime( | |
| 606 comp->node_id(), comp->token_index(), kReThrowRuntimeEntry); | |
| 607 Bailout("ReThrow Untested"); | |
| 608 } | |
| 609 | |
| 610 | |
| 611 void FlowGraphCompiler::VisitNativeLoadField(NativeLoadFieldComp* comp) { | 592 void FlowGraphCompiler::VisitNativeLoadField(NativeLoadFieldComp* comp) { |
| 612 __ popq(RAX); | 593 __ popq(RAX); |
| 613 __ movq(RAX, FieldAddress(RAX, comp->offset_in_bytes())); | 594 __ movq(RAX, FieldAddress(RAX, comp->offset_in_bytes())); |
| 614 } | 595 } |
| 615 | 596 |
| 616 | 597 |
| 617 void FlowGraphCompiler::VisitExtractFactoryTypeArguments( | 598 void FlowGraphCompiler::VisitExtractFactoryTypeArguments( |
| 618 ExtractFactoryTypeArgumentsComp* comp) { | 599 ExtractFactoryTypeArgumentsComp* comp) { |
| 619 __ popq(RAX); // Instantiator. | 600 __ popq(RAX); // Instantiator. |
| 620 | 601 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 __ nop(1); | 835 __ nop(1); |
| 855 __ nop(1); | 836 __ nop(1); |
| 856 __ nop(1); | 837 __ nop(1); |
| 857 __ nop(1); | 838 __ nop(1); |
| 858 AddCurrentDescriptor(PcDescriptors::kReturn, | 839 AddCurrentDescriptor(PcDescriptors::kReturn, |
| 859 AstNode::kNoId, | 840 AstNode::kNoId, |
| 860 instr->token_index()); | 841 instr->token_index()); |
| 861 } | 842 } |
| 862 | 843 |
| 863 | 844 |
| 845 void FlowGraphCompiler::VisitThrow(ThrowInstr* instr) { |
| 846 LoadValue(RAX, instr->exception()); |
| 847 __ pushq(RAX); |
| 848 GenerateCallRuntime(instr->node_id(), |
| 849 instr->token_index(), |
| 850 kThrowRuntimeEntry); |
| 851 __ int3(); |
| 852 } |
| 853 |
| 854 |
| 855 void FlowGraphCompiler::VisitReThrow(ReThrowInstr* instr) { |
| 856 LoadValue(RBX, instr->stack_trace()); |
| 857 LoadValue(RAX, instr->exception()); |
| 858 __ pushq(RAX); |
| 859 __ pushq(RBX); |
| 860 GenerateCallRuntime( |
| 861 instr->node_id(), instr->token_index(), kReThrowRuntimeEntry); |
| 862 Bailout("ReThrow Untested"); |
| 863 } |
| 864 |
| 865 |
| 866 |
| 864 void FlowGraphCompiler::VisitBranch(BranchInstr* instr) { | 867 void FlowGraphCompiler::VisitBranch(BranchInstr* instr) { |
| 865 // Determine if the true branch is fall through (!negated) or the false | 868 // Determine if the true branch is fall through (!negated) or the false |
| 866 // branch is. They cannot both be backwards branches. | 869 // branch is. They cannot both be backwards branches. |
| 867 intptr_t index = blocks_->length() - current_block()->block_number() - 1; | 870 intptr_t index = blocks_->length() - current_block()->block_number() - 1; |
| 868 ASSERT(index > 0); | 871 ASSERT(index > 0); |
| 869 | 872 |
| 870 bool negated = ((*blocks_)[index - 1] == instr->false_successor()); | 873 bool negated = ((*blocks_)[index - 1] == instr->false_successor()); |
| 871 ASSERT(!negated == ((*blocks_)[index - 1] == instr->true_successor())); | 874 ASSERT(!negated == ((*blocks_)[index - 1] == instr->true_successor())); |
| 872 | 875 |
| 873 LoadValue(RAX, instr->value()); | 876 LoadValue(RAX, instr->value()); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { | 1198 void FlowGraphCompiler::FinalizeExceptionHandlers(const Code& code) { |
| 1196 // We don't compile exception handlers yet. | 1199 // We don't compile exception handlers yet. |
| 1197 code.set_exception_handlers( | 1200 code.set_exception_handlers( |
| 1198 ExceptionHandlers::Handle(ExceptionHandlers::New(0))); | 1201 ExceptionHandlers::Handle(ExceptionHandlers::New(0))); |
| 1199 } | 1202 } |
| 1200 | 1203 |
| 1201 | 1204 |
| 1202 } // namespace dart | 1205 } // namespace dart |
| 1203 | 1206 |
| 1204 #endif // defined TARGET_ARCH_X64 | 1207 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |