Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: runtime/vm/simulator_dbc.cc

Issue 2423843002: Add DoubleTestOp instruction (Closed)
Patch Set: Cleanup Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 RawObject** FP, 243 RawObject** FP,
244 RawObject** result) { 244 RawObject** result) {
245 RawObject** args = FrameArguments(FP, 1); 245 RawObject** args = FrameArguments(FP, 1);
246 RawDouble* d = static_cast<RawDouble*>(args[0]); 246 RawDouble* d = static_cast<RawDouble*>(args[0]);
247 *result = isnan(d->ptr()->value_) 247 *result = isnan(d->ptr()->value_)
248 ? Bool::True().raw() 248 ? Bool::True().raw()
249 : Bool::False().raw(); 249 : Bool::False().raw();
250 return true; 250 return true;
251 } 251 }
252 252
253 static bool Double_getIsInfinite(Thread* thread,
254 RawObject** FP,
255 RawObject** result) {
256 RawObject** args = FrameArguments(FP, 1);
257 RawDouble* d = static_cast<RawDouble*>(args[0]);
258 *result = isinf(d->ptr()->value_)
259 ? Bool::True().raw()
260 : Bool::False().raw();
261 return true;
262 }
263
253 static bool ObjectEquals(Thread* thread, 264 static bool ObjectEquals(Thread* thread,
254 RawObject** FP, 265 RawObject** FP,
255 RawObject** result) { 266 RawObject** result) {
256 RawObject** args = FrameArguments(FP, 2); 267 RawObject** args = FrameArguments(FP, 2);
257 *result = args[0] == args[1] ? Bool::True().raw() : Bool::False().raw(); 268 *result = args[0] == args[1] ? Bool::True().raw() : Bool::False().raw();
258 return true; 269 return true;
259 } 270 }
260 271
261 static bool ObjectRuntimeType(Thread* thread, 272 static bool ObjectRuntimeType(Thread* thread,
262 RawObject** FP, 273 RawObject** FP,
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 SimulatorHelpers::GrowableArraySetIndexed; 455 SimulatorHelpers::GrowableArraySetIndexed;
445 intrinsics_[kGrowableArrayGetIndexedIntrinsic] = 456 intrinsics_[kGrowableArrayGetIndexedIntrinsic] =
446 SimulatorHelpers::GrowableArrayGetIndexed; 457 SimulatorHelpers::GrowableArrayGetIndexed;
447 intrinsics_[kObjectEqualsIntrinsic] = 458 intrinsics_[kObjectEqualsIntrinsic] =
448 SimulatorHelpers::ObjectEquals; 459 SimulatorHelpers::ObjectEquals;
449 intrinsics_[kObjectRuntimeTypeIntrinsic] = 460 intrinsics_[kObjectRuntimeTypeIntrinsic] =
450 SimulatorHelpers::ObjectRuntimeType; 461 SimulatorHelpers::ObjectRuntimeType;
451 462
452 intrinsics_[kDouble_getIsNaNIntrinsic] = 463 intrinsics_[kDouble_getIsNaNIntrinsic] =
453 SimulatorHelpers::Double_getIsNan; 464 SimulatorHelpers::Double_getIsNan;
465 intrinsics_[kDouble_getIsInfiniteIntrinsic] =
466 SimulatorHelpers::Double_getIsInfinite;
454 intrinsics_[kDouble_addIntrinsic] = 467 intrinsics_[kDouble_addIntrinsic] =
455 SimulatorHelpers::Double_add; 468 SimulatorHelpers::Double_add;
456 intrinsics_[kDouble_mulIntrinsic] = 469 intrinsics_[kDouble_mulIntrinsic] =
457 SimulatorHelpers::Double_mul; 470 SimulatorHelpers::Double_mul;
458 intrinsics_[kDouble_subIntrinsic] = 471 intrinsics_[kDouble_subIntrinsic] =
459 SimulatorHelpers::Double_sub; 472 SimulatorHelpers::Double_sub;
460 intrinsics_[kDouble_divIntrinsic] = 473 intrinsics_[kDouble_divIntrinsic] =
461 SimulatorHelpers::Double_div; 474 SimulatorHelpers::Double_div;
462 intrinsics_[kDouble_greaterThanIntrinsic] = 475 intrinsics_[kDouble_greaterThanIntrinsic] =
463 SimulatorHelpers::Double_greaterThan; 476 SimulatorHelpers::Double_greaterThan;
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 2192
2180 { 2193 {
2181 BYTECODE(FloatToDouble, A_D); 2194 BYTECODE(FloatToDouble, A_D);
2182 const float valuef = *reinterpret_cast<float*>(&FP[rD]); 2195 const float valuef = *reinterpret_cast<float*>(&FP[rD]);
2183 const double value = static_cast<double>(valuef); 2196 const double value = static_cast<double>(valuef);
2184 FP[rA] = bit_cast<RawObject*, double>(value); 2197 FP[rA] = bit_cast<RawObject*, double>(value);
2185 DISPATCH(); 2198 DISPATCH();
2186 } 2199 }
2187 2200
2188 { 2201 {
2202 BYTECODE(DoubleIsNaN, A_D);
2203 const double v = bit_cast<double, RawObject*>(FP[rD]);
2204 FP[rA] = isnan(v) ? true_value : false_value;
2205 DISPATCH();
2206 }
2207
2208 {
2209 BYTECODE(DoubleIsInfinite, A_D);
2210 const double v = bit_cast<double, RawObject*>(FP[rD]);
2211 FP[rA] = isinf(v) ? true_value : false_value;
2212 DISPATCH();
2213 }
2214
2215 {
2189 BYTECODE(LoadIndexedFloat32, A_B_C); 2216 BYTECODE(LoadIndexedFloat32, A_B_C);
2190 uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]); 2217 uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]);
2191 const uint32_t value = *reinterpret_cast<uint32_t*>(data); 2218 const uint32_t value = *reinterpret_cast<uint32_t*>(data);
2192 const uint64_t value64 = value; 2219 const uint64_t value64 = value;
2193 FP[rA] = reinterpret_cast<RawObject*>(value64); 2220 FP[rA] = reinterpret_cast<RawObject*>(value64);
2194 DISPATCH(); 2221 DISPATCH();
2195 } 2222 }
2196 2223
2197 { 2224 {
2198 BYTECODE(LoadIndexed4Float32, A_B_C); 2225 BYTECODE(LoadIndexed4Float32, A_B_C);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 DISPATCH(); 2437 DISPATCH();
2411 } 2438 }
2412 2439
2413 { 2440 {
2414 BYTECODE(FloatToDouble, A_D); 2441 BYTECODE(FloatToDouble, A_D);
2415 UNREACHABLE(); 2442 UNREACHABLE();
2416 DISPATCH(); 2443 DISPATCH();
2417 } 2444 }
2418 2445
2419 { 2446 {
2447 BYTECODE(DoubleIsNaN, A_D);
2448 UNREACHABLE();
2449 DISPATCH();
2450 }
2451
2452 {
2453 BYTECODE(DoubleIsInfinite, A_D);
2454 UNREACHABLE();
2455 DISPATCH();
2456 }
2457
2458 {
2420 BYTECODE(LoadIndexedFloat32, A_B_C); 2459 BYTECODE(LoadIndexedFloat32, A_B_C);
2421 UNREACHABLE(); 2460 UNREACHABLE();
2422 DISPATCH(); 2461 DISPATCH();
2423 } 2462 }
2424 2463
2425 { 2464 {
2426 BYTECODE(LoadIndexed4Float32, A_B_C); 2465 BYTECODE(LoadIndexed4Float32, A_B_C);
2427 UNREACHABLE(); 2466 UNREACHABLE();
2428 DISPATCH(); 2467 DISPATCH();
2429 } 2468 }
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
3669 pc_ = pc; 3708 pc_ = pc;
3670 special_[kExceptionSpecialIndex] = raw_exception; 3709 special_[kExceptionSpecialIndex] = raw_exception;
3671 special_[kStacktraceSpecialIndex] = raw_stacktrace; 3710 special_[kStacktraceSpecialIndex] = raw_stacktrace;
3672 buf->Longjmp(); 3711 buf->Longjmp();
3673 UNREACHABLE(); 3712 UNREACHABLE();
3674 } 3713 }
3675 3714
3676 } // namespace dart 3715 } // namespace dart
3677 3716
3678 #endif // defined TARGET_ARCH_DBC 3717 #endif // defined TARGET_ARCH_DBC
OLDNEW
« runtime/vm/method_recognizer.h ('K') | « runtime/vm/method_recognizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698