Index: src/compiler/wasm-compiler.cc |
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc |
index 26badb3a248b374c8b4a908c35a29201fa3279f1..64b3089952d32f6b093d42adb24e28c43b5ccc59 100644 |
--- a/src/compiler/wasm-compiler.cc |
+++ b/src/compiler/wasm-compiler.cc |
@@ -1133,6 +1133,10 @@ Node* WasmGraphBuilder::BuildI32SConvertF32(Node* input) { |
Node* WasmGraphBuilder::BuildI32SConvertF64(Node* input) { |
MachineOperatorBuilder* m = jsgraph()->machine(); |
+ if (module_ && module_->asm_js) { |
+ return graph()->NewNode( |
+ m->TruncateFloat64ToInt32(TruncationMode::kJavaScript), input); |
+ } |
// Truncation of the input value is needed for the overflow check later. |
Node* trunc = Unop(wasm::kExprF64Trunc, input); |
Node* result = graph()->NewNode(m->ChangeFloat64ToInt32(), trunc); |
@@ -1167,6 +1171,10 @@ Node* WasmGraphBuilder::BuildI32UConvertF32(Node* input) { |
Node* WasmGraphBuilder::BuildI32UConvertF64(Node* input) { |
MachineOperatorBuilder* m = jsgraph()->machine(); |
+ if (module_ && module_->asm_js) { |
+ return graph()->NewNode( |
+ m->TruncateFloat64ToInt32(TruncationMode::kJavaScript), input); |
+ } |
// Truncation of the input value is needed for the overflow check later. |
Node* trunc = Unop(wasm::kExprF64Trunc, input); |
Node* result = graph()->NewNode(m->ChangeFloat64ToUint32(), trunc); |