Chromium Code Reviews

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

Issue 1655883002: [wasm] Initial commit for the Int64Reducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: feedback addressed Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index 69e51d77e5544ff89e21b1c3a4326a468bc89953..a9a21687f18dd4233dfb2ad21672f57296f7c2b6 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -15,6 +15,7 @@
#include "src/compiler/graph.h"
#include "src/compiler/graph-visualizer.h"
#include "src/compiler/instruction-selector.h"
+#include "src/compiler/int64-lowering.h"
#include "src/compiler/js-generic-lowering.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/js-operator.h"
@@ -481,6 +482,9 @@ Node* WasmGraphBuilder::Binop(wasm::WasmOpcode opcode, Node* left,
op = m->Uint32LessThanOrEqual();
std::swap(left, right);
break;
+ case wasm::kExprI64And:
+ op = m->Word64And();
+ break;
#if WASM_64
// Opcodes only supported on 64-bit platforms.
// TODO(titzer): query the machine operator builder here instead of #ifdef.
@@ -531,9 +535,6 @@ Node* WasmGraphBuilder::Binop(wasm::WasmOpcode opcode, Node* left,
op = m->Uint64Mod();
return graph()->NewNode(op, left, right,
trap_->ZeroCheck64(kTrapRemByZero, right));
- case wasm::kExprI64And:
- op = m->Word64And();
- break;
case wasm::kExprI64Ior:
op = m->Word64Or();
break;
@@ -783,13 +784,12 @@ Node* WasmGraphBuilder::Unop(wasm::WasmOpcode opcode, Node* input) {
op = m->Float64RoundTiesEven().op();
break;
}
-
-#if WASM_64
- // Opcodes only supported on 64-bit platforms.
- // TODO(titzer): query the machine operator builder here instead of #ifdef.
case wasm::kExprI32ConvertI64:
op = m->TruncateInt64ToInt32();
break;
+#if WASM_64
+ // Opcodes only supported on 64-bit platforms.
+ // TODO(titzer): query the machine operator builder here instead of #ifdef.
case wasm::kExprI64SConvertI32:
op = m->ChangeInt32ToInt64();
break;
@@ -1888,6 +1888,13 @@ Node* WasmGraphBuilder::String(const char* string) {
Graph* WasmGraphBuilder::graph() { return jsgraph()->graph(); }
+void WasmGraphBuilder::Int64LoweringForTesting() {
+#if !WASM_64
+ Int64Lowering r(jsgraph()->graph(), jsgraph()->machine(), jsgraph()->common(),
+ jsgraph()->zone());
+ r.ReduceGraph();
+#endif
+}
static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
CompilationInfo* info,
@@ -1910,7 +1917,6 @@ static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
}
}
-
Handle<JSFunction> CompileJSToWasmWrapper(
Isolate* isolate, wasm::ModuleEnv* module, Handle<String> name,
Handle<Code> wasm_code, Handle<JSObject> module_object, uint32_t index) {

Powered by Google App Engine