| 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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 ASSERT(comp->HasICData()); | 670 ASSERT(comp->HasICData()); |
| 671 const ICData& ic_data = *comp->ic_data(); | 671 const ICData& ic_data = *comp->ic_data(); |
| 672 ASSERT(ic_data.num_args_tested() == 1); | 672 ASSERT(ic_data.num_args_tested() == 1); |
| 673 // No indexed access on Smi. | 673 // No indexed access on Smi. |
| 674 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi); | 674 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi); |
| 675 // Load receiver into RAX. | 675 // Load receiver into RAX. |
| 676 const intptr_t kNumArguments = 2; | 676 const intptr_t kNumArguments = 2; |
| 677 __ movq(RAX, Address(RSP, (kNumArguments - 1) * kWordSize)); | 677 __ movq(RAX, Address(RSP, (kNumArguments - 1) * kWordSize)); |
| 678 __ testq(RAX, Immediate(kSmiTagMask)); | 678 __ testq(RAX, Immediate(kSmiTagMask)); |
| 679 __ j(ZERO, deopt); | 679 __ j(ZERO, deopt); |
| 680 Label done; | |
| 681 __ LoadClassId(RDI, RAX); | 680 __ LoadClassId(RDI, RAX); |
| 682 compiler->EmitTestAndCall(ic_data, | 681 compiler->EmitTestAndCall(ic_data, |
| 683 RDI, // Class id register. | 682 RDI, // Class id register. |
| 684 kNumArguments, | 683 kNumArguments, |
| 685 Array::Handle(), // No named arguments. | 684 Array::Handle(), // No named arguments. |
| 686 deopt, &done, // Labels. | 685 deopt, // Deoptimize target. |
| 686 NULL, // Fallthrough when done. |
| 687 comp->cid(), | 687 comp->cid(), |
| 688 comp->token_pos(), | 688 comp->token_pos(), |
| 689 comp->try_index()); | 689 comp->try_index()); |
| 690 __ Bind(&done); | |
| 691 } | 690 } |
| 692 | 691 |
| 693 | 692 |
| 694 void LoadIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 693 void LoadIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 695 if (receiver_type() == kIllegalObjectKind) { | 694 if (receiver_type() == kIllegalObjectKind) { |
| 696 if (HasICData()) { | 695 if (HasICData()) { |
| 697 EmitLoadIndexedPolymorphic(compiler, this); | 696 EmitLoadIndexedPolymorphic(compiler, this); |
| 698 } else { | 697 } else { |
| 699 compiler->EmitLoadIndexedGeneric(this); | 698 compiler->EmitLoadIndexedGeneric(this); |
| 700 } | 699 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 ASSERT(comp->HasICData()); | 808 ASSERT(comp->HasICData()); |
| 810 const ICData& ic_data = *comp->ic_data(); | 809 const ICData& ic_data = *comp->ic_data(); |
| 811 ASSERT(ic_data.num_args_tested() == 1); | 810 ASSERT(ic_data.num_args_tested() == 1); |
| 812 // No indexed access on Smi. | 811 // No indexed access on Smi. |
| 813 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi); | 812 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi); |
| 814 // Load receiver into RAX. | 813 // Load receiver into RAX. |
| 815 const intptr_t kNumArguments = 3; | 814 const intptr_t kNumArguments = 3; |
| 816 __ movq(RAX, Address(RSP, (kNumArguments - 1) * kWordSize)); | 815 __ movq(RAX, Address(RSP, (kNumArguments - 1) * kWordSize)); |
| 817 __ testq(RAX, Immediate(kSmiTagMask)); | 816 __ testq(RAX, Immediate(kSmiTagMask)); |
| 818 __ j(ZERO, deopt); | 817 __ j(ZERO, deopt); |
| 819 Label done; | |
| 820 __ LoadClassId(RDI, RAX); | 818 __ LoadClassId(RDI, RAX); |
| 821 compiler->EmitTestAndCall(ic_data, | 819 compiler->EmitTestAndCall(ic_data, |
| 822 RDI, // Class id register. | 820 RDI, // Class id register. |
| 823 kNumArguments, | 821 kNumArguments, |
| 824 Array::Handle(), // No named arguments. | 822 Array::Handle(), // No named arguments. |
| 825 deopt, &done, // Labels. | 823 deopt, // deoptimize label. |
| 824 NULL, // fallthrough when done. |
| 826 comp->cid(), | 825 comp->cid(), |
| 827 comp->token_pos(), | 826 comp->token_pos(), |
| 828 comp->try_index()); | 827 comp->try_index()); |
| 829 __ Bind(&done); | |
| 830 } | 828 } |
| 831 | 829 |
| 832 | 830 |
| 833 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 831 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 834 if (receiver_type() == kIllegalObjectKind) { | 832 if (receiver_type() == kIllegalObjectKind) { |
| 835 if (HasICData()) { | 833 if (HasICData()) { |
| 836 EmitStoreIndexedPolymorphic(compiler, this); | 834 EmitStoreIndexedPolymorphic(compiler, this); |
| 837 } else { | 835 } else { |
| 838 EmitStoreIndexedGeneric(compiler, this); | 836 EmitStoreIndexedGeneric(compiler, this); |
| 839 } | 837 } |
| (...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1956 __ movq(RAX, | 1954 __ movq(RAX, |
| 1957 Address(RSP, (instance_call()->ArgumentCount() - 1) * kWordSize)); | 1955 Address(RSP, (instance_call()->ArgumentCount() - 1) * kWordSize)); |
| 1958 __ testq(RAX, Immediate(kSmiTagMask)); | 1956 __ testq(RAX, Immediate(kSmiTagMask)); |
| 1959 __ j(ZERO, is_smi_label); | 1957 __ j(ZERO, is_smi_label); |
| 1960 Label done; | 1958 Label done; |
| 1961 __ LoadClassId(RDI, RAX); | 1959 __ LoadClassId(RDI, RAX); |
| 1962 compiler->EmitTestAndCall(*ic_data(), | 1960 compiler->EmitTestAndCall(*ic_data(), |
| 1963 RDI, // Class id register. | 1961 RDI, // Class id register. |
| 1964 instance_call()->ArgumentCount(), | 1962 instance_call()->ArgumentCount(), |
| 1965 instance_call()->argument_names(), | 1963 instance_call()->argument_names(), |
| 1966 deopt, &done, // Labels. | 1964 deopt, |
| 1965 (is_smi_label == &handle_smi) ? &done : NULL, |
| 1967 instance_call()->cid(), | 1966 instance_call()->cid(), |
| 1968 instance_call()->token_pos(), | 1967 instance_call()->token_pos(), |
| 1969 instance_call()->try_index()); | 1968 instance_call()->try_index()); |
| 1970 if (is_smi_label == &handle_smi) { | 1969 if (is_smi_label == &handle_smi) { |
| 1971 __ Bind(&handle_smi); | 1970 __ Bind(&handle_smi); |
| 1972 ASSERT(ic_data()->GetReceiverClassIdAt(0) == kSmi); | 1971 ASSERT(ic_data()->GetReceiverClassIdAt(0) == kSmi); |
| 1973 const Function& target = Function::ZoneHandle(ic_data()->GetTargetAt(0)); | 1972 const Function& target = Function::ZoneHandle(ic_data()->GetTargetAt(0)); |
| 1974 compiler->GenerateStaticCall(instance_call()->cid(), | 1973 compiler->GenerateStaticCall(instance_call()->cid(), |
| 1975 instance_call()->token_pos(), | 1974 instance_call()->token_pos(), |
| 1976 instance_call()->try_index(), | 1975 instance_call()->try_index(), |
| 1977 target, | 1976 target, |
| 1978 instance_call()->ArgumentCount(), | 1977 instance_call()->ArgumentCount(), |
| 1979 instance_call()->argument_names()); | 1978 instance_call()->argument_names()); |
| 1980 } | 1979 } |
| 1981 __ Bind(&done); | 1980 __ Bind(&done); |
| 1982 } | 1981 } |
| 1983 | 1982 |
| 1984 } // namespace dart | 1983 } // namespace dart |
| 1985 | 1984 |
| 1986 #undef __ | 1985 #undef __ |
| 1987 | 1986 |
| 1988 #endif // defined TARGET_ARCH_X64 | 1987 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |