OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #if defined(TARGET_ARCH_DBC) | 9 #if defined(TARGET_ARCH_DBC) |
10 | 10 |
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 *++SP = target; | 1851 *++SP = target; |
1852 pc++; | 1852 pc++; |
1853 break; | 1853 break; |
1854 } | 1854 } |
1855 } | 1855 } |
1856 pc += 2 * cids_length; | 1856 pc += 2 * cids_length; |
1857 DISPATCH(); | 1857 DISPATCH(); |
1858 } | 1858 } |
1859 | 1859 |
1860 { | 1860 { |
| 1861 BYTECODE(PushPolymorphicInstanceCallByRange, A_D); |
| 1862 const uint8_t argc = rA; |
| 1863 const intptr_t cids_length = rD; |
| 1864 RawObject** args = SP - argc + 1; |
| 1865 const intptr_t receiver_cid = SimulatorHelpers::GetClassId(args[0]); |
| 1866 for (intptr_t i = 0; i < 3 * cids_length; i += 3) { |
| 1867 // Note unsigned types to get an unsigned range compare. |
| 1868 const uintptr_t cid_start = Bytecode::DecodeD(*(pc + i)); |
| 1869 const uintptr_t cids = Bytecode::DecodeD(*(pc + i + 1)); |
| 1870 if (receiver_cid - cid_start < cids) { |
| 1871 RawFunction* target = |
| 1872 RAW_CAST(Function, LOAD_CONSTANT(Bytecode::DecodeD(*(pc + i + 2)))); |
| 1873 *++SP = target; |
| 1874 pc++; |
| 1875 break; |
| 1876 } |
| 1877 } |
| 1878 pc += 3 * cids_length; |
| 1879 DISPATCH(); |
| 1880 } |
| 1881 |
| 1882 { |
1861 BYTECODE(NativeBootstrapCall, 0); | 1883 BYTECODE(NativeBootstrapCall, 0); |
1862 RawFunction* function = FrameFunction(FP); | 1884 RawFunction* function = FrameFunction(FP); |
1863 RawObject** incoming_args = | 1885 RawObject** incoming_args = |
1864 (function->ptr()->num_optional_parameters_ == 0) | 1886 (function->ptr()->num_optional_parameters_ == 0) |
1865 ? FrameArguments(FP, function->ptr()->num_fixed_parameters_) | 1887 ? FrameArguments(FP, function->ptr()->num_fixed_parameters_) |
1866 : FP; | 1888 : FP; |
1867 | 1889 |
1868 SimulatorBootstrapNativeCall native_target = | 1890 SimulatorBootstrapNativeCall native_target = |
1869 reinterpret_cast<SimulatorBootstrapNativeCall>(SP[-1]); | 1891 reinterpret_cast<SimulatorBootstrapNativeCall>(SP[-1]); |
1870 intptr_t argc_tag = reinterpret_cast<intptr_t>(SP[-0]); | 1892 intptr_t argc_tag = reinterpret_cast<intptr_t>(SP[-0]); |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3201 } | 3223 } |
3202 pc += cids_length; | 3224 pc += cids_length; |
3203 } else { | 3225 } else { |
3204 pc += cids_length; | 3226 pc += cids_length; |
3205 pc += (may_be_smi ? 1 : 0); | 3227 pc += (may_be_smi ? 1 : 0); |
3206 } | 3228 } |
3207 DISPATCH(); | 3229 DISPATCH(); |
3208 } | 3230 } |
3209 | 3231 |
3210 { | 3232 { |
| 3233 BYTECODE(CheckCidsByRange, A_B_C); |
| 3234 const intptr_t raw_value = reinterpret_cast<intptr_t>(FP[rA]); |
| 3235 const bool is_smi = ((raw_value & kSmiTagMask) == kSmiTag); |
| 3236 const bool may_be_smi = (rB == 1); |
| 3237 const intptr_t cids_length = rC; |
| 3238 if (LIKELY(!is_smi)) { |
| 3239 const intptr_t cid = SimulatorHelpers::GetClassId(FP[rA]); |
| 3240 for (intptr_t i = 0; i < cids_length; i += 2) { |
| 3241 // Note unsigned type to get unsigned range check below. |
| 3242 const uintptr_t cid_start = Bytecode::DecodeD(*(pc + i)); |
| 3243 const uintptr_t cids = Bytecode::DecodeD(*(pc + i + 1)); |
| 3244 if (cid - cid_start < cids) { |
| 3245 pc++; |
| 3246 break; |
| 3247 } |
| 3248 } |
| 3249 pc += cids_length; |
| 3250 } else { |
| 3251 pc += cids_length; |
| 3252 pc += (may_be_smi ? 1 : 0); |
| 3253 } |
| 3254 DISPATCH(); |
| 3255 } |
| 3256 |
| 3257 { |
3211 BYTECODE(IfEqStrictTOS, 0); | 3258 BYTECODE(IfEqStrictTOS, 0); |
3212 SP -= 2; | 3259 SP -= 2; |
3213 if (SP[1] != SP[2]) { | 3260 if (SP[1] != SP[2]) { |
3214 pc++; | 3261 pc++; |
3215 } | 3262 } |
3216 DISPATCH(); | 3263 DISPATCH(); |
3217 } | 3264 } |
3218 | 3265 |
3219 { | 3266 { |
3220 BYTECODE(IfNeStrictTOS, 0); | 3267 BYTECODE(IfNeStrictTOS, 0); |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3765 pc_ = pc; | 3812 pc_ = pc; |
3766 } | 3813 } |
3767 | 3814 |
3768 buf->Longjmp(); | 3815 buf->Longjmp(); |
3769 UNREACHABLE(); | 3816 UNREACHABLE(); |
3770 } | 3817 } |
3771 | 3818 |
3772 } // namespace dart | 3819 } // namespace dart |
3773 | 3820 |
3774 #endif // defined TARGET_ARCH_DBC | 3821 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |