| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 } | 651 } |
| 652 | 652 |
| 653 | 653 |
| 654 void FlowGraphCompiler::VisitConstant(ConstantVal* val) { | 654 void FlowGraphCompiler::VisitConstant(ConstantVal* val) { |
| 655 // Moved to intermediate_language_x64.cc. | 655 // Moved to intermediate_language_x64.cc. |
| 656 UNREACHABLE(); | 656 UNREACHABLE(); |
| 657 } | 657 } |
| 658 | 658 |
| 659 | 659 |
| 660 void FlowGraphCompiler::VisitAssertAssignable(AssertAssignableComp* comp) { | 660 void FlowGraphCompiler::VisitAssertAssignable(AssertAssignableComp* comp) { |
| 661 const Immediate raw_null = | 661 // Moved to intermediate_language_x64.cc. |
| 662 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 662 UNREACHABLE(); |
| 663 if (comp->instantiator_type_arguments() == NULL) { | |
| 664 __ movq(RDX, raw_null); | |
| 665 } else { | |
| 666 LoadValue(RDX, comp->instantiator_type_arguments()); | |
| 667 } | |
| 668 if (comp->instantiator() == NULL) { | |
| 669 __ movq(RCX, raw_null); | |
| 670 } else { | |
| 671 LoadValue(RCX, comp->instantiator()); | |
| 672 } | |
| 673 LoadValue(RAX, comp->value()); | |
| 674 GenerateAssertAssignable(comp->cid(), | |
| 675 comp->token_index(), | |
| 676 comp->try_index(), | |
| 677 comp->dst_type(), | |
| 678 comp->dst_name()); | |
| 679 } | 663 } |
| 680 | 664 |
| 681 | 665 |
| 682 void FlowGraphCompiler::VisitAssertBoolean(AssertBooleanComp* comp) { | 666 void FlowGraphCompiler::VisitAssertBoolean(AssertBooleanComp* comp) { |
| 683 LoadValue(RAX, comp->value()); | 667 // Moved to intermediate_language_x64.cc. |
| 684 // Check that the type of the value is allowed in conditional context. | 668 UNREACHABLE(); |
| 685 // Call the runtime if the object is not bool::true or bool::false. | |
| 686 Label done; | |
| 687 __ CompareObject(RAX, Bool::ZoneHandle(Bool::True())); | |
| 688 __ j(EQUAL, &done, Assembler::kNearJump); | |
| 689 __ CompareObject(RAX, Bool::ZoneHandle(Bool::False())); | |
| 690 __ j(EQUAL, &done, Assembler::kNearJump); | |
| 691 | |
| 692 __ pushq(Immediate(Smi::RawValue(comp->token_index()))); // Source location. | |
| 693 __ pushq(RAX); // Push the source object. | |
| 694 GenerateCallRuntime(comp->cid(), | |
| 695 comp->token_index(), | |
| 696 comp->try_index(), | |
| 697 kConditionTypeErrorRuntimeEntry); | |
| 698 // We should never return here. | |
| 699 __ int3(); | |
| 700 | |
| 701 __ Bind(&done); | |
| 702 } | 669 } |
| 703 | 670 |
| 704 | 671 |
| 705 // Truee iff. the v2 is above v1 on stack, or one of them is constant. | 672 // Truee iff. the v2 is above v1 on stack, or one of them is constant. |
| 706 static bool VerifyValues(Value* v1, Value* v2) { | 673 static bool VerifyValues(Value* v1, Value* v2) { |
| 707 if (v1->IsUse() && v2->IsUse()) { | 674 if (v1->IsUse() && v2->IsUse()) { |
| 708 return (v1->AsUse()->definition()->temp_index() + 1) == | 675 return (v1->AsUse()->definition()->temp_index() + 1) == |
| 709 v2->AsUse()->definition()->temp_index(); | 676 v2->AsUse()->definition()->temp_index(); |
| 710 } | 677 } |
| 711 return true; | 678 return true; |
| (...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1987 | 1954 |
| 1988 void FlowGraphCompiler::FinalizeComments(const Code& code) { | 1955 void FlowGraphCompiler::FinalizeComments(const Code& code) { |
| 1989 code.set_comments(assembler_->GetCodeComments()); | 1956 code.set_comments(assembler_->GetCodeComments()); |
| 1990 } | 1957 } |
| 1991 | 1958 |
| 1992 #undef __ | 1959 #undef __ |
| 1993 | 1960 |
| 1994 } // namespace dart | 1961 } // namespace dart |
| 1995 | 1962 |
| 1996 #endif // defined TARGET_ARCH_X64 | 1963 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |