| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 ASSERT(comp->HasICData()); | 661 ASSERT(comp->HasICData()); |
| 662 const ICData& ic_data = *comp->ic_data(); | 662 const ICData& ic_data = *comp->ic_data(); |
| 663 ASSERT(ic_data.num_args_tested() == 1); | 663 ASSERT(ic_data.num_args_tested() == 1); |
| 664 // No indexed access on Smi. | 664 // No indexed access on Smi. |
| 665 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi); | 665 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi); |
| 666 // Load receiver into EAX. | 666 // Load receiver into EAX. |
| 667 const intptr_t kNumArguments = 2; | 667 const intptr_t kNumArguments = 2; |
| 668 __ movl(EAX, Address(ESP, (kNumArguments - 1) * kWordSize)); | 668 __ movl(EAX, Address(ESP, (kNumArguments - 1) * kWordSize)); |
| 669 __ testl(EAX, Immediate(kSmiTagMask)); | 669 __ testl(EAX, Immediate(kSmiTagMask)); |
| 670 __ j(ZERO, deopt); | 670 __ j(ZERO, deopt); |
| 671 Label done; | |
| 672 __ LoadClassId(EDI, EAX); | 671 __ LoadClassId(EDI, EAX); |
| 673 compiler->EmitTestAndCall(ic_data, | 672 compiler->EmitTestAndCall(ic_data, |
| 674 EDI, // Class id register. | 673 EDI, // Class id register. |
| 675 kNumArguments, | 674 kNumArguments, |
| 676 Array::Handle(), // No named arguments. | 675 Array::Handle(), // No named arguments. |
| 677 deopt, &done, // Labels. | 676 deopt, // Deoptimize target. |
| 677 NULL, // Fallthrough when done. |
| 678 comp->cid(), | 678 comp->cid(), |
| 679 comp->token_pos(), | 679 comp->token_pos(), |
| 680 comp->try_index()); | 680 comp->try_index()); |
| 681 __ Bind(&done); | |
| 682 } | 681 } |
| 683 | 682 |
| 684 | 683 |
| 685 void LoadIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 684 void LoadIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 686 if (receiver_type() == kIllegalObjectKind) { | 685 if (receiver_type() == kIllegalObjectKind) { |
| 687 if (HasICData()) { | 686 if (HasICData()) { |
| 688 EmitLoadIndexedPolymorphic(compiler, this); | 687 EmitLoadIndexedPolymorphic(compiler, this); |
| 689 } else { | 688 } else { |
| 690 compiler->EmitLoadIndexedGeneric(this); | 689 compiler->EmitLoadIndexedGeneric(this); |
| 691 } | 690 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 ASSERT(comp->HasICData()); | 799 ASSERT(comp->HasICData()); |
| 801 const ICData& ic_data = *comp->ic_data(); | 800 const ICData& ic_data = *comp->ic_data(); |
| 802 ASSERT(ic_data.num_args_tested() == 1); | 801 ASSERT(ic_data.num_args_tested() == 1); |
| 803 // No indexed access on Smi. | 802 // No indexed access on Smi. |
| 804 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi); | 803 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi); |
| 805 // Load receiver into EAX. | 804 // Load receiver into EAX. |
| 806 const intptr_t kNumArguments = 3; | 805 const intptr_t kNumArguments = 3; |
| 807 __ movl(EAX, Address(ESP, (kNumArguments - 1) * kWordSize)); | 806 __ movl(EAX, Address(ESP, (kNumArguments - 1) * kWordSize)); |
| 808 __ testl(EAX, Immediate(kSmiTagMask)); | 807 __ testl(EAX, Immediate(kSmiTagMask)); |
| 809 __ j(ZERO, deopt); | 808 __ j(ZERO, deopt); |
| 810 Label done; | |
| 811 __ LoadClassId(EDI, EAX); | 809 __ LoadClassId(EDI, EAX); |
| 812 compiler->EmitTestAndCall(ic_data, | 810 compiler->EmitTestAndCall(ic_data, |
| 813 EDI, // Class id register. | 811 EDI, // Class id register. |
| 814 kNumArguments, | 812 kNumArguments, |
| 815 Array::Handle(), // No named arguments. | 813 Array::Handle(), // No named arguments. |
| 816 deopt, &done, // Labels. | 814 deopt, // Deoptimize target. |
| 815 NULL, // Fallthrough when done. |
| 817 comp->cid(), | 816 comp->cid(), |
| 818 comp->token_pos(), | 817 comp->token_pos(), |
| 819 comp->try_index()); | 818 comp->try_index()); |
| 820 __ Bind(&done); | |
| 821 } | 819 } |
| 822 | 820 |
| 823 | 821 |
| 824 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 822 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 825 if (receiver_type() == kIllegalObjectKind) { | 823 if (receiver_type() == kIllegalObjectKind) { |
| 826 if (HasICData()) { | 824 if (HasICData()) { |
| 827 EmitStoreIndexedPolymorphic(compiler, this); | 825 EmitStoreIndexedPolymorphic(compiler, this); |
| 828 } else { | 826 } else { |
| 829 EmitStoreIndexedGeneric(compiler, this); | 827 EmitStoreIndexedGeneric(compiler, this); |
| 830 } | 828 } |
| (...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 __ movl(EAX, | 1949 __ movl(EAX, |
| 1952 Address(ESP, (instance_call()->ArgumentCount() - 1) * kWordSize)); | 1950 Address(ESP, (instance_call()->ArgumentCount() - 1) * kWordSize)); |
| 1953 __ testl(EAX, Immediate(kSmiTagMask)); | 1951 __ testl(EAX, Immediate(kSmiTagMask)); |
| 1954 __ j(ZERO, is_smi_label); | 1952 __ j(ZERO, is_smi_label); |
| 1955 Label done; | 1953 Label done; |
| 1956 __ LoadClassId(EDI, EAX); | 1954 __ LoadClassId(EDI, EAX); |
| 1957 compiler->EmitTestAndCall(*ic_data(), | 1955 compiler->EmitTestAndCall(*ic_data(), |
| 1958 EDI, // Class id register. | 1956 EDI, // Class id register. |
| 1959 instance_call()->ArgumentCount(), | 1957 instance_call()->ArgumentCount(), |
| 1960 instance_call()->argument_names(), | 1958 instance_call()->argument_names(), |
| 1961 deopt, &done, // Labels. | 1959 deopt, |
| 1960 (is_smi_label == &handle_smi) ? &done : NULL, |
| 1962 instance_call()->cid(), | 1961 instance_call()->cid(), |
| 1963 instance_call()->token_pos(), | 1962 instance_call()->token_pos(), |
| 1964 instance_call()->try_index()); | 1963 instance_call()->try_index()); |
| 1965 if (is_smi_label == &handle_smi) { | 1964 if (is_smi_label == &handle_smi) { |
| 1966 __ Bind(&handle_smi); | 1965 __ Bind(&handle_smi); |
| 1967 ASSERT(ic_data()->GetReceiverClassIdAt(0) == kSmi); | 1966 ASSERT(ic_data()->GetReceiverClassIdAt(0) == kSmi); |
| 1968 const Function& target = Function::ZoneHandle(ic_data()->GetTargetAt(0)); | 1967 const Function& target = Function::ZoneHandle(ic_data()->GetTargetAt(0)); |
| 1969 compiler->GenerateStaticCall(instance_call()->cid(), | 1968 compiler->GenerateStaticCall(instance_call()->cid(), |
| 1970 instance_call()->token_pos(), | 1969 instance_call()->token_pos(), |
| 1971 instance_call()->try_index(), | 1970 instance_call()->try_index(), |
| 1972 target, | 1971 target, |
| 1973 instance_call()->ArgumentCount(), | 1972 instance_call()->ArgumentCount(), |
| 1974 instance_call()->argument_names()); | 1973 instance_call()->argument_names()); |
| 1975 } | 1974 } |
| 1976 __ Bind(&done); | 1975 __ Bind(&done); |
| 1977 } | 1976 } |
| 1978 | 1977 |
| 1979 } // namespace dart | 1978 } // namespace dart |
| 1980 | 1979 |
| 1981 #undef __ | 1980 #undef __ |
| 1982 | 1981 |
| 1983 #endif // defined TARGET_ARCH_X64 | 1982 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |