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 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2187 BYTECODE(IfNeStrict, A_D); | 2187 BYTECODE(IfNeStrict, A_D); |
2188 RawObject* lhs = FP[rA]; | 2188 RawObject* lhs = FP[rA]; |
2189 RawObject* rhs = FP[rD]; | 2189 RawObject* rhs = FP[rD]; |
2190 if (lhs == rhs) { | 2190 if (lhs == rhs) { |
2191 pc++; | 2191 pc++; |
2192 } | 2192 } |
2193 DISPATCH(); | 2193 DISPATCH(); |
2194 } | 2194 } |
2195 | 2195 |
2196 { | 2196 { |
| 2197 BYTECODE(IfLe, A_D); |
| 2198 const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rA]); |
| 2199 const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rD]); |
| 2200 if (lhs > rhs) { |
| 2201 pc++; |
| 2202 } |
| 2203 DISPATCH(); |
| 2204 } |
| 2205 |
| 2206 { |
| 2207 BYTECODE(IfLt, A_D); |
| 2208 const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rA]); |
| 2209 const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rD]); |
| 2210 if (lhs >= rhs) { |
| 2211 pc++; |
| 2212 } |
| 2213 DISPATCH(); |
| 2214 } |
| 2215 |
| 2216 { |
| 2217 BYTECODE(IfGe, A_D); |
| 2218 const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rA]); |
| 2219 const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rD]); |
| 2220 if (lhs < rhs) { |
| 2221 pc++; |
| 2222 } |
| 2223 DISPATCH(); |
| 2224 } |
| 2225 |
| 2226 { |
| 2227 BYTECODE(IfGt, A_D); |
| 2228 const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rA]); |
| 2229 const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rD]); |
| 2230 if (lhs <= rhs) { |
| 2231 pc++; |
| 2232 } |
| 2233 DISPATCH(); |
| 2234 } |
| 2235 |
| 2236 { |
| 2237 BYTECODE(IfULe, A_D); |
| 2238 const uintptr_t lhs = reinterpret_cast<uintptr_t>(FP[rA]); |
| 2239 const uintptr_t rhs = reinterpret_cast<uintptr_t>(FP[rD]); |
| 2240 if (lhs > rhs) { |
| 2241 pc++; |
| 2242 } |
| 2243 DISPATCH(); |
| 2244 } |
| 2245 |
| 2246 { |
| 2247 BYTECODE(IfULt, A_D); |
| 2248 const uintptr_t lhs = reinterpret_cast<uintptr_t>(FP[rA]); |
| 2249 const uintptr_t rhs = reinterpret_cast<uintptr_t>(FP[rD]); |
| 2250 if (lhs >= rhs) { |
| 2251 pc++; |
| 2252 } |
| 2253 DISPATCH(); |
| 2254 } |
| 2255 |
| 2256 { |
| 2257 BYTECODE(IfUGe, A_D); |
| 2258 const uintptr_t lhs = reinterpret_cast<uintptr_t>(FP[rA]); |
| 2259 const uintptr_t rhs = reinterpret_cast<uintptr_t>(FP[rD]); |
| 2260 if (lhs < rhs) { |
| 2261 pc++; |
| 2262 } |
| 2263 DISPATCH(); |
| 2264 } |
| 2265 |
| 2266 { |
| 2267 BYTECODE(IfUGt, A_D); |
| 2268 const uintptr_t lhs = reinterpret_cast<uintptr_t>(FP[rA]); |
| 2269 const uintptr_t rhs = reinterpret_cast<uintptr_t>(FP[rD]); |
| 2270 if (lhs <= rhs) { |
| 2271 pc++; |
| 2272 } |
| 2273 DISPATCH(); |
| 2274 } |
| 2275 |
| 2276 { |
2197 BYTECODE(IfEqStrictNum, A_D); | 2277 BYTECODE(IfEqStrictNum, A_D); |
2198 RawObject* lhs = FP[rA]; | 2278 RawObject* lhs = FP[rA]; |
2199 RawObject* rhs = FP[rD]; | 2279 RawObject* rhs = FP[rD]; |
2200 if (!SimulatorHelpers::IsStrictEqualWithNumberCheck(lhs, rhs)) { | 2280 if (!SimulatorHelpers::IsStrictEqualWithNumberCheck(lhs, rhs)) { |
2201 pc++; | 2281 pc++; |
2202 } | 2282 } |
2203 DISPATCH(); | 2283 DISPATCH(); |
2204 } | 2284 } |
2205 | 2285 |
2206 { | 2286 { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2247 { | 2327 { |
2248 BYTECODE(LoadClassIdTOS, 0); | 2328 BYTECODE(LoadClassIdTOS, 0); |
2249 RawObject* obj = static_cast<RawObject*>(SP[0]); | 2329 RawObject* obj = static_cast<RawObject*>(SP[0]); |
2250 SP[0] = SimulatorHelpers::GetClassIdAsSmi(obj); | 2330 SP[0] = SimulatorHelpers::GetClassIdAsSmi(obj); |
2251 DISPATCH(); | 2331 DISPATCH(); |
2252 } | 2332 } |
2253 | 2333 |
2254 { | 2334 { |
2255 BYTECODE(StoreIndexedTOS, 0); | 2335 BYTECODE(StoreIndexedTOS, 0); |
2256 SP -= 3; | 2336 SP -= 3; |
2257 RawArray* array = static_cast<RawArray*>(SP[1]); | 2337 RawArray* array = RAW_CAST(Array, SP[1]); |
2258 RawSmi* index = static_cast<RawSmi*>(SP[2]); | 2338 RawSmi* index = RAW_CAST(Smi, SP[2]); |
2259 RawObject* value = SP[3]; | 2339 RawObject* value = SP[3]; |
2260 ASSERT(array->GetClassId() == kArrayCid); | |
2261 ASSERT(!index->IsHeapObject()); | |
2262 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 2340 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
2263 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); | 2341 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); |
2264 DISPATCH(); | 2342 DISPATCH(); |
2265 } | 2343 } |
2266 | 2344 |
2267 { | 2345 { |
2268 BYTECODE(StoreIndexed, A_B_C); | 2346 BYTECODE(StoreIndexed, A_B_C); |
2269 RawArray* array = static_cast<RawArray*>(FP[rA]); | 2347 RawArray* array = RAW_CAST(Array, FP[rA]); |
2270 RawSmi* index = static_cast<RawSmi*>(FP[rB]); | 2348 RawSmi* index = RAW_CAST(Smi, FP[rB]); |
2271 RawObject* value = FP[rC]; | 2349 RawObject* value = FP[rC]; |
2272 ASSERT(array->GetClassId() == kArrayCid); | |
2273 ASSERT(!index->IsHeapObject()); | |
2274 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 2350 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
2275 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); | 2351 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); |
2276 DISPATCH(); | 2352 DISPATCH(); |
2277 } | 2353 } |
2278 | 2354 |
2279 { | 2355 { |
| 2356 BYTECODE(LoadIndexed, A_B_C); |
| 2357 RawArray* array = RAW_CAST(Array, FP[rB]); |
| 2358 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2359 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2360 FP[rA] = array->ptr()->data()[Smi::Value(index)]; |
| 2361 DISPATCH(); |
| 2362 } |
| 2363 |
| 2364 { |
2280 BYTECODE(Deopt, A_D); | 2365 BYTECODE(Deopt, A_D); |
2281 const bool is_lazy = rD == 0; | 2366 const bool is_lazy = rD == 0; |
2282 | 2367 |
2283 // Preserve result of the previous call. | 2368 // Preserve result of the previous call. |
2284 // TODO(vegorov) we could have actually included result into the | 2369 // TODO(vegorov) we could have actually included result into the |
2285 // deoptimization environment because it is passed through the stack. | 2370 // deoptimization environment because it is passed through the stack. |
2286 // If we do then we could remove special result handling from this code. | 2371 // If we do then we could remove special result handling from this code. |
2287 RawObject* result = SP[0]; | 2372 RawObject* result = SP[0]; |
2288 | 2373 |
2289 // When not preserving the result, we still need to preserve SP[0] as it | 2374 // When not preserving the result, we still need to preserve SP[0] as it |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 special_[kExceptionSpecialIndex] = raw_exception; | 2539 special_[kExceptionSpecialIndex] = raw_exception; |
2455 special_[kStacktraceSpecialIndex] = raw_stacktrace; | 2540 special_[kStacktraceSpecialIndex] = raw_stacktrace; |
2456 buf->Longjmp(); | 2541 buf->Longjmp(); |
2457 UNREACHABLE(); | 2542 UNREACHABLE(); |
2458 } | 2543 } |
2459 | 2544 |
2460 } // namespace dart | 2545 } // namespace dart |
2461 | 2546 |
2462 | 2547 |
2463 #endif // defined TARGET_ARCH_DBC | 2548 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |