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

Side by Side Diff: src/wasm/wasm-interpreter.cc

Issue 2105313002: [wasm] Detect unrepresentability in the float32-to-int32 conversion correctly on arm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: address comments Created 4 years, 5 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/wasm/wasm-interpreter.h" 5 #include "src/wasm/wasm-interpreter.h"
6 #include "src/wasm/ast-decoder.h" 6 #include "src/wasm/ast-decoder.h"
7 #include "src/wasm/decoder.h" 7 #include "src/wasm/decoder.h"
8 #include "src/wasm/wasm-external-refs.h" 8 #include "src/wasm/wasm-external-refs.h"
9 #include "src/wasm/wasm-module.h" 9 #include "src/wasm/wasm-module.h"
10 10
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 static int32_t ExecuteI32SConvertF64(double a, TrapReason* trap) { 508 static int32_t ExecuteI32SConvertF64(double a, TrapReason* trap) {
509 if (a < (static_cast<double>(INT32_MAX) + 1.0) && 509 if (a < (static_cast<double>(INT32_MAX) + 1.0) &&
510 a > (static_cast<double>(INT32_MIN) - 1.0)) { 510 a > (static_cast<double>(INT32_MIN) - 1.0)) {
511 return static_cast<int32_t>(a); 511 return static_cast<int32_t>(a);
512 } 512 }
513 *trap = kTrapFloatUnrepresentable; 513 *trap = kTrapFloatUnrepresentable;
514 return 0; 514 return 0;
515 } 515 }
516 516
517 static uint32_t ExecuteI32UConvertF32(float a, TrapReason* trap) { 517 static uint32_t ExecuteI32UConvertF32(float a, TrapReason* trap) {
518 if (a < (static_cast<float>(UINT32_MAX) + 1.0) && a > -1) { 518 if (a < (static_cast<float>(static_cast<uint64_t>(UINT32_MAX) + 1)) &&
519 a > -1) {
519 return static_cast<uint32_t>(a); 520 return static_cast<uint32_t>(a);
520 } 521 }
521 *trap = kTrapFloatUnrepresentable; 522 *trap = kTrapFloatUnrepresentable;
522 return 0; 523 return 0;
523 } 524 }
524 525
525 static uint32_t ExecuteI32UConvertF64(double a, TrapReason* trap) { 526 static uint32_t ExecuteI32UConvertF64(double a, TrapReason* trap) {
526 if (a < (static_cast<float>(UINT32_MAX) + 1.0) && a > -1) { 527 if (a < (static_cast<float>(UINT32_MAX) + 1.0) && a > -1) {
527 return static_cast<uint32_t>(a); 528 return static_cast<uint32_t>(a);
528 } 529 }
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 1822
1822 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( 1823 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting(
1823 Zone* zone, const byte* start, const byte* end) { 1824 Zone* zone, const byte* start, const byte* end) {
1824 ControlTransfers targets(zone, 0, start, end); 1825 ControlTransfers targets(zone, 0, start, end);
1825 return targets.map_; 1826 return targets.map_;
1826 } 1827 }
1827 1828
1828 } // namespace wasm 1829 } // namespace wasm
1829 } // namespace internal 1830 } // namespace internal
1830 } // namespace v8 1831 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698