| 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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 Register result = locs()->out().reg(); | 827 Register result = locs()->out().reg(); |
| 828 | 828 |
| 829 const DeoptReasonId deopt_reason = | 829 const DeoptReasonId deopt_reason = |
| 830 (receiver_type() == kGrowableObjectArrayCid) ? | 830 (receiver_type() == kGrowableObjectArrayCid) ? |
| 831 kDeoptLoadIndexedGrowableArray : kDeoptLoadIndexedFixedArray; | 831 kDeoptLoadIndexedGrowableArray : kDeoptLoadIndexedFixedArray; |
| 832 | 832 |
| 833 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), | 833 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), |
| 834 original()->try_index(), | 834 original()->try_index(), |
| 835 deopt_reason); | 835 deopt_reason); |
| 836 | 836 |
| 837 __ testq(receiver, Immediate(kSmiTagMask)); // Deoptimize if Smi. | |
| 838 __ j(ZERO, deopt); | |
| 839 __ CompareClassId(receiver, receiver_type()); | |
| 840 __ j(NOT_EQUAL, deopt); | |
| 841 | |
| 842 __ testq(index, Immediate(kSmiTagMask)); | |
| 843 __ j(NOT_ZERO, deopt); | |
| 844 | |
| 845 switch (receiver_type()) { | 837 switch (receiver_type()) { |
| 846 case kArrayCid: | 838 case kArrayCid: |
| 847 case kImmutableArrayCid: | 839 case kImmutableArrayCid: |
| 848 __ cmpq(index, FieldAddress(receiver, Array::length_offset())); | 840 __ cmpq(index, FieldAddress(receiver, Array::length_offset())); |
| 849 __ j(ABOVE_EQUAL, deopt); | 841 __ j(ABOVE_EQUAL, deopt); |
| 850 // Note that index is Smi, i.e, times 4. | 842 // Note that index is Smi, i.e, times 4. |
| 851 ASSERT(kSmiTagShift == 1); | 843 ASSERT(kSmiTagShift == 1); |
| 852 __ movq(result, FieldAddress(receiver, index, TIMES_4, sizeof(RawArray))); | 844 __ movq(result, FieldAddress(receiver, index, TIMES_4, sizeof(RawArray))); |
| 853 break; | 845 break; |
| 854 | 846 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 | 887 |
| 896 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 888 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 897 Register receiver = locs()->in(0).reg(); | 889 Register receiver = locs()->in(0).reg(); |
| 898 Register index = locs()->in(1).reg(); | 890 Register index = locs()->in(1).reg(); |
| 899 Register value = locs()->in(2).reg(); | 891 Register value = locs()->in(2).reg(); |
| 900 | 892 |
| 901 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), | 893 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), |
| 902 original()->try_index(), | 894 original()->try_index(), |
| 903 kDeoptStoreIndexed); | 895 kDeoptStoreIndexed); |
| 904 | 896 |
| 905 __ testq(receiver, Immediate(kSmiTagMask)); // Deoptimize if Smi. | |
| 906 __ j(ZERO, deopt); | |
| 907 __ CompareClassId(receiver, receiver_type()); | |
| 908 __ j(NOT_EQUAL, deopt); | |
| 909 | |
| 910 __ testq(index, Immediate(kSmiTagMask)); | |
| 911 __ j(NOT_ZERO, deopt); | |
| 912 | |
| 913 switch (receiver_type()) { | 897 switch (receiver_type()) { |
| 914 case kArrayCid: | 898 case kArrayCid: |
| 915 case kImmutableArrayCid: | 899 case kImmutableArrayCid: |
| 916 __ cmpq(index, FieldAddress(receiver, Array::length_offset())); | 900 __ cmpq(index, FieldAddress(receiver, Array::length_offset())); |
| 917 __ j(ABOVE_EQUAL, deopt); | 901 __ j(ABOVE_EQUAL, deopt); |
| 918 // Note that index is Smi, i.e, times 4. | 902 // Note that index is Smi, i.e, times 4. |
| 919 ASSERT(kSmiTagShift == 1); | 903 ASSERT(kSmiTagShift == 1); |
| 920 if (this->value()->NeedsStoreBuffer()) { | 904 if (this->value()->NeedsStoreBuffer()) { |
| 921 __ StoreIntoObject(receiver, | 905 __ StoreIntoObject(receiver, |
| 922 FieldAddress(receiver, index, TIMES_4, sizeof(RawArray)), | 906 FieldAddress(receiver, index, TIMES_4, sizeof(RawArray)), |
| (...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2443 __ testq(value, Immediate(kSmiTagMask)); | 2427 __ testq(value, Immediate(kSmiTagMask)); |
| 2444 __ j(NOT_ZERO, deopt); | 2428 __ j(NOT_ZERO, deopt); |
| 2445 } | 2429 } |
| 2446 | 2430 |
| 2447 | 2431 |
| 2448 } // namespace dart | 2432 } // namespace dart |
| 2449 | 2433 |
| 2450 #undef __ | 2434 #undef __ |
| 2451 | 2435 |
| 2452 #endif // defined TARGET_ARCH_X64 | 2436 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |