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

Unified Diff: src/wasm/asm-wasm-builder.cc

Issue 1968493002: [wasm] Introduce special bytecodes for asm.js division/remainder instead of relying on module state. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move asm.js tests to their own file. Created 4 years, 7 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
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-opcodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/asm-wasm-builder.cc
diff --git a/src/wasm/asm-wasm-builder.cc b/src/wasm/asm-wasm-builder.cc
index 50b0ea5126e340f8a5201a2c83554c3150e7e793..3a0b5692ad4c7ad3e947ade9ca321424850638ae 100644
--- a/src/wasm/asm-wasm-builder.cc
+++ b/src/wasm/asm-wasm-builder.cc
@@ -1383,9 +1383,6 @@ class AsmWasmBuilderImpl : public AstVisitor {
#ifdef Mul
#undef Mul
#endif
-#ifdef Div
-#undef Div
-#endif
#define NON_SIGNED_BINOP(op) \
static WasmOpcode opcodes[] = { \
@@ -1464,19 +1461,25 @@ class AsmWasmBuilderImpl : public AstVisitor {
BINOP_CASE(Token::ADD, Add, NON_SIGNED_BINOP, true);
BINOP_CASE(Token::SUB, Sub, NON_SIGNED_BINOP, true);
BINOP_CASE(Token::MUL, Mul, NON_SIGNED_BINOP, true);
- BINOP_CASE(Token::DIV, Div, SIGNED_BINOP, false);
BINOP_CASE(Token::BIT_OR, Ior, NON_SIGNED_INT_BINOP, true);
BINOP_CASE(Token::BIT_AND, And, NON_SIGNED_INT_BINOP, true);
BINOP_CASE(Token::BIT_XOR, Xor, NON_SIGNED_INT_BINOP, true);
BINOP_CASE(Token::SHL, Shl, NON_SIGNED_INT_BINOP, true);
BINOP_CASE(Token::SAR, ShrS, NON_SIGNED_INT_BINOP, true);
BINOP_CASE(Token::SHR, ShrU, NON_SIGNED_INT_BINOP, true);
+ case Token::DIV: {
+ static WasmOpcode opcodes[] = {kExprI32AsmjsDivS, kExprI32AsmjsDivU,
+ kExprF32Div, kExprF64Div};
+ int type = TypeIndexOf(expr->left(), expr->right(), false);
+ current_function_builder_->Emit(opcodes[type]);
+ break;
+ }
case Token::MOD: {
TypeIndex type = TypeIndexOf(expr->left(), expr->right(), false);
if (type == kInt32) {
- current_function_builder_->Emit(kExprI32RemS);
+ current_function_builder_->Emit(kExprI32AsmjsRemS);
} else if (type == kUint32) {
- current_function_builder_->Emit(kExprI32RemU);
+ current_function_builder_->Emit(kExprI32AsmjsRemU);
} else if (type == kFloat64) {
current_function_builder_->Emit(kExprF64Mod);
return;
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698