| 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 { |
| 2197 BYTECODE(IfEqStrictNum, A_D); | 2237 BYTECODE(IfEqStrictNum, A_D); |
| 2198 RawObject* lhs = FP[rA]; | 2238 RawObject* lhs = FP[rA]; |
| 2199 RawObject* rhs = FP[rD]; | 2239 RawObject* rhs = FP[rD]; |
| 2200 if (!SimulatorHelpers::IsStrictEqualWithNumberCheck(lhs, rhs)) { | 2240 if (!SimulatorHelpers::IsStrictEqualWithNumberCheck(lhs, rhs)) { |
| 2201 pc++; | 2241 pc++; |
| 2202 } | 2242 } |
| 2203 DISPATCH(); | 2243 DISPATCH(); |
| 2204 } | 2244 } |
| 2205 | 2245 |
| 2206 { | 2246 { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2247 { | 2287 { |
| 2248 BYTECODE(LoadClassIdTOS, 0); | 2288 BYTECODE(LoadClassIdTOS, 0); |
| 2249 RawObject* obj = static_cast<RawObject*>(SP[0]); | 2289 RawObject* obj = static_cast<RawObject*>(SP[0]); |
| 2250 SP[0] = SimulatorHelpers::GetClassIdAsSmi(obj); | 2290 SP[0] = SimulatorHelpers::GetClassIdAsSmi(obj); |
| 2251 DISPATCH(); | 2291 DISPATCH(); |
| 2252 } | 2292 } |
| 2253 | 2293 |
| 2254 { | 2294 { |
| 2255 BYTECODE(StoreIndexedTOS, 0); | 2295 BYTECODE(StoreIndexedTOS, 0); |
| 2256 SP -= 3; | 2296 SP -= 3; |
| 2257 RawArray* array = static_cast<RawArray*>(SP[1]); | 2297 RawArray* array = RAW_CAST(Array, SP[1]); |
| 2258 RawSmi* index = static_cast<RawSmi*>(SP[2]); | 2298 RawSmi* index = RAW_CAST(Smi, SP[2]); |
| 2259 RawObject* value = SP[3]; | 2299 RawObject* value = SP[3]; |
| 2260 ASSERT(array->GetClassId() == kArrayCid); | |
| 2261 ASSERT(!index->IsHeapObject()); | |
| 2262 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 2300 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2263 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); | 2301 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); |
| 2264 DISPATCH(); | 2302 DISPATCH(); |
| 2265 } | 2303 } |
| 2266 | 2304 |
| 2267 { | 2305 { |
| 2268 BYTECODE(StoreIndexed, A_B_C); | 2306 BYTECODE(StoreIndexed, A_B_C); |
| 2269 RawArray* array = static_cast<RawArray*>(FP[rA]); | 2307 RawArray* array = RAW_CAST(Array, FP[rA]); |
| 2270 RawSmi* index = static_cast<RawSmi*>(FP[rB]); | 2308 RawSmi* index = RAW_CAST(Smi, FP[rB]); |
| 2271 RawObject* value = FP[rC]; | 2309 RawObject* value = FP[rC]; |
| 2272 ASSERT(array->GetClassId() == kArrayCid); | |
| 2273 ASSERT(!index->IsHeapObject()); | |
| 2274 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 2310 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2275 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); | 2311 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); |
| 2276 DISPATCH(); | 2312 DISPATCH(); |
| 2277 } | 2313 } |
| 2278 | 2314 |
| 2279 { | 2315 { |
| 2316 BYTECODE(LoadIndexed, A_B_C); |
| 2317 RawArray* array = RAW_CAST(Array, FP[rB]); |
| 2318 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2319 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2320 FP[rA] = array->ptr()->data()[Smi::Value(index)]; |
| 2321 DISPATCH(); |
| 2322 } |
| 2323 |
| 2324 { |
| 2280 BYTECODE(Deopt, A_D); | 2325 BYTECODE(Deopt, A_D); |
| 2281 const bool is_lazy = rD == 0; | 2326 const bool is_lazy = rD == 0; |
| 2282 | 2327 |
| 2283 // Preserve result of the previous call. | 2328 // Preserve result of the previous call. |
| 2284 // TODO(vegorov) we could have actually included result into the | 2329 // TODO(vegorov) we could have actually included result into the |
| 2285 // deoptimization environment because it is passed through the stack. | 2330 // deoptimization environment because it is passed through the stack. |
| 2286 // If we do then we could remove special result handling from this code. | 2331 // If we do then we could remove special result handling from this code. |
| 2287 RawObject* result = SP[0]; | 2332 RawObject* result = SP[0]; |
| 2288 | 2333 |
| 2289 // When not preserving the result, we still need to preserve SP[0] as it | 2334 // 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; | 2499 special_[kExceptionSpecialIndex] = raw_exception; |
| 2455 special_[kStacktraceSpecialIndex] = raw_stacktrace; | 2500 special_[kStacktraceSpecialIndex] = raw_stacktrace; |
| 2456 buf->Longjmp(); | 2501 buf->Longjmp(); |
| 2457 UNREACHABLE(); | 2502 UNREACHABLE(); |
| 2458 } | 2503 } |
| 2459 | 2504 |
| 2460 } // namespace dart | 2505 } // namespace dart |
| 2461 | 2506 |
| 2462 | 2507 |
| 2463 #endif // defined TARGET_ARCH_DBC | 2508 #endif // defined TARGET_ARCH_DBC |
| OLD | NEW |