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

Unified Diff: src/compiler/wasm-compiler.cc

Issue 1919513002: [turbofan] Introduce TruncateTaggedToWord32 simplified operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index 9dfaa6a72a998fe1f4cc6d4e1a5dbef22f1a4186..2edd72dee57fbc8630f522cdef1b82280df6ad4d 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -1139,8 +1139,7 @@ Node* WasmGraphBuilder::BuildI32SConvertF32(Node* input) {
if (module_ && module_->asm_js()) {
// asm.js must use the wacky JS semantics.
input = graph()->NewNode(m->ChangeFloat32ToFloat64(), input);
- return graph()->NewNode(
- m->TruncateFloat64ToInt32(TruncationMode::kJavaScript), input);
+ return graph()->NewNode(m->TruncateFloat64ToWord32(), input);
}
// Truncation of the input value is needed for the overflow check later.
@@ -1161,8 +1160,7 @@ Node* WasmGraphBuilder::BuildI32SConvertF64(Node* input) {
MachineOperatorBuilder* m = jsgraph()->machine();
if (module_ && module_->asm_js()) {
// asm.js must use the wacky JS semantics.
- return graph()->NewNode(
- m->TruncateFloat64ToInt32(TruncationMode::kJavaScript), input);
+ return graph()->NewNode(m->TruncateFloat64ToWord32(), input);
}
// Truncation of the input value is needed for the overflow check later.
Node* trunc = Unop(wasm::kExprF64Trunc, input);
@@ -1183,8 +1181,7 @@ Node* WasmGraphBuilder::BuildI32UConvertF32(Node* input) {
if (module_ && module_->asm_js()) {
// asm.js must use the wacky JS semantics.
input = graph()->NewNode(m->ChangeFloat32ToFloat64(), input);
- return graph()->NewNode(
- m->TruncateFloat64ToInt32(TruncationMode::kJavaScript), input);
+ return graph()->NewNode(m->TruncateFloat64ToWord32(), input);
}
// Truncation of the input value is needed for the overflow check later.
@@ -1205,8 +1202,7 @@ Node* WasmGraphBuilder::BuildI32UConvertF64(Node* input) {
MachineOperatorBuilder* m = jsgraph()->machine();
if (module_ && module_->asm_js()) {
// asm.js must use the wacky JS semantics.
- return graph()->NewNode(
- m->TruncateFloat64ToInt32(TruncationMode::kJavaScript), input);
+ return graph()->NewNode(m->TruncateFloat64ToWord32(), input);
}
// Truncation of the input value is needed for the overflow check later.
Node* trunc = Unop(wasm::kExprF64Trunc, input);
@@ -2007,8 +2003,7 @@ Node* WasmGraphBuilder::BuildChangeFloat64ToTagged(Node* value) {
MachineOperatorBuilder* machine = jsgraph()->machine();
CommonOperatorBuilder* common = jsgraph()->common();
- Node* const value32 = graph()->NewNode(
- machine->TruncateFloat64ToInt32(TruncationMode::kRoundToZero), value);
+ Node* value32 = graph()->NewNode(machine->RoundFloat64ToInt32(), value);
Node* check_same = graph()->NewNode(
machine->Float64Equal(), value,
graph()->NewNode(machine->ChangeInt32ToFloat64(), value32));
@@ -2239,15 +2234,13 @@ Node* WasmGraphBuilder::FromJS(Node* node, Node* context,
switch (type) {
case wasm::kAstI32: {
- num = graph()->NewNode(jsgraph()->machine()->TruncateFloat64ToInt32(
- TruncationMode::kJavaScript),
+ num = graph()->NewNode(jsgraph()->machine()->TruncateFloat64ToWord32(),
num);
break;
}
case wasm::kAstI64:
// TODO(titzer): JS->i64 has no good solution right now. Using 32 bits.
- num = graph()->NewNode(jsgraph()->machine()->TruncateFloat64ToInt32(
- TruncationMode::kJavaScript),
+ num = graph()->NewNode(jsgraph()->machine()->TruncateFloat64ToWord32(),
num);
if (jsgraph()->machine()->Is64()) {
// We cannot change an int32 to an int64 on a 32 bit platform. Instead

Powered by Google App Engine
This is Rietveld 408576698