Upgrade V8 to 5.1.281.57 DO NOT MERGE
FPIIM-449
Change-Id: Id981b686b4d587ac31697662eb98bb34be42ad90
(cherry picked from commit 3b9bc31999c9787eb726ecdbfd5796bfdec32a18)
diff --git a/src/wasm/asm-wasm-builder.cc b/src/wasm/asm-wasm-builder.cc
index ee5427b..d16d3a8 100644
--- a/src/wasm/asm-wasm-builder.cc
+++ b/src/wasm/asm-wasm-builder.cc
@@ -4,6 +4,12 @@
#include "src/v8.h"
+// Required to get M_E etc. in MSVC.
+#if defined(_WIN32)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+
#include "src/wasm/asm-wasm-builder.h"
#include "src/wasm/wasm-macro-gen.h"
#include "src/wasm/wasm-opcodes.h"
@@ -28,7 +34,7 @@
class AsmWasmBuilderImpl : public AstVisitor {
public:
AsmWasmBuilderImpl(Isolate* isolate, Zone* zone, FunctionLiteral* literal,
- Handle<Object> foreign)
+ Handle<Object> foreign, AsmTyper* typer)
: local_variables_(HashMap::PointersMatch,
ZoneHashMap::kDefaultHashMapCapacity,
ZoneAllocationPolicy(zone)),
@@ -46,6 +52,7 @@
isolate_(isolate),
zone_(zone),
foreign_(foreign),
+ typer_(typer),
cache_(TypeCache::Get()),
breakable_blocks_(zone),
block_size_(0),
@@ -59,12 +66,10 @@
}
void InitializeInitFunction() {
- unsigned char init[] = "__init__";
init_function_index_ = builder_->AddFunction();
current_function_builder_ = builder_->FunctionAt(init_function_index_);
- current_function_builder_->SetName(init, 8);
current_function_builder_->ReturnType(kAstStmt);
- current_function_builder_->Exported(1);
+ builder_->MarkStartFunction(init_function_index_);
current_function_builder_ = nullptr;
}
@@ -133,13 +138,14 @@
: builder_(builder) {
builder_->breakable_blocks_.push_back(std::make_pair(stmt, is_loop));
builder_->current_function_builder_->Emit(opcode);
- index_ = builder_->current_function_builder_->EmitEditableImmediate(0);
+ index_ =
+ builder_->current_function_builder_->EmitEditableVarIntImmediate();
prev_block_size_ = builder_->block_size_;
builder_->block_size_ = initial_block_size;
}
~BlockVisitor() {
- builder_->current_function_builder_->EditImmediate(index_,
- builder_->block_size_);
+ builder_->current_function_builder_->EditVarIntImmediate(
+ index_, builder_->block_size_);
builder_->block_size_ = prev_block_size_;
builder_->breakable_blocks_.pop_back();
}
@@ -188,7 +194,7 @@
}
}
DCHECK(i >= 0);
- current_function_builder_->EmitWithU8(kExprBr, block_distance);
+ current_function_builder_->EmitWithVarInt(kExprBr, block_distance);
current_function_builder_->Emit(kExprNop);
}
@@ -211,7 +217,7 @@
}
}
DCHECK(i >= 0);
- current_function_builder_->EmitWithU8(kExprBr, block_distance);
+ current_function_builder_->EmitWithVarInt(kExprBr, block_distance);
current_function_builder_->Emit(kExprNop);
}
@@ -232,7 +238,8 @@
void SetLocalTo(uint16_t index, int value) {
current_function_builder_->Emit(kExprSetLocal);
AddLeb128(index, true);
- byte code[] = {WASM_I32(value)};
+ // TODO(bradnelson): variable size
+ byte code[] = {WASM_I32V(value)};
current_function_builder_->EmitCode(code, sizeof(code));
block_size_++;
}
@@ -286,7 +293,7 @@
RECURSE(Visit(stmt->body()));
current_function_builder_->Emit(kExprIf);
RECURSE(Visit(stmt->cond()));
- current_function_builder_->EmitWithU8(kExprBr, 0);
+ current_function_builder_->EmitWithVarInt(kExprBr, 0);
current_function_builder_->Emit(kExprNop);
}
@@ -296,7 +303,7 @@
1);
current_function_builder_->Emit(kExprIf);
RECURSE(Visit(stmt->cond()));
- current_function_builder_->EmitWithU8(kExprBr, 0);
+ current_function_builder_->EmitWithVarInt(kExprBr, 0);
RECURSE(Visit(stmt->body()));
}
@@ -311,9 +318,9 @@
if (stmt->cond() != nullptr) {
block_size_++;
current_function_builder_->Emit(kExprIf);
- current_function_builder_->Emit(kExprBoolNot);
+ current_function_builder_->Emit(kExprI32Eqz);
RECURSE(Visit(stmt->cond()));
- current_function_builder_->EmitWithU8(kExprBr, 1);
+ current_function_builder_->EmitWithVarInt(kExprBr, 1);
current_function_builder_->Emit(kExprNop);
}
if (stmt->body() != nullptr) {
@@ -325,7 +332,7 @@
RECURSE(Visit(stmt->next()));
}
block_size_++;
- current_function_builder_->EmitWithU8(kExprBr, 0);
+ current_function_builder_->EmitWithVarInt(kExprBr, 0);
current_function_builder_->Emit(kExprNop);
}
@@ -371,6 +378,58 @@
RECURSE(Visit(expr->else_expression()));
}
+ bool VisitStdlibConstant(Variable* var) {
+ AsmTyper::StandardMember standard_object =
+ typer_->VariableAsStandardMember(var);
+ double value;
+ switch (standard_object) {
+ case AsmTyper::kInfinity: {
+ value = std::numeric_limits<double>::infinity();
+ break;
+ }
+ case AsmTyper::kNaN: {
+ value = std::numeric_limits<double>::quiet_NaN();
+ break;
+ }
+ case AsmTyper::kMathE: {
+ value = M_E;
+ break;
+ }
+ case AsmTyper::kMathLN10: {
+ value = M_LN10;
+ break;
+ }
+ case AsmTyper::kMathLN2: {
+ value = M_LN2;
+ break;
+ }
+ case AsmTyper::kMathLOG10E: {
+ value = M_LOG10E;
+ break;
+ }
+ case AsmTyper::kMathLOG2E: {
+ value = M_LOG2E;
+ break;
+ }
+ case AsmTyper::kMathPI: {
+ value = M_PI;
+ break;
+ }
+ case AsmTyper::kMathSQRT1_2: {
+ value = M_SQRT1_2;
+ break;
+ }
+ case AsmTyper::kMathSQRT2: {
+ value = M_SQRT2;
+ break;
+ }
+ default: { return false; }
+ }
+ byte code[] = {WASM_F64(value)};
+ current_function_builder_->EmitCode(code, sizeof(code));
+ return true;
+ }
+
void VisitVariableProxy(VariableProxy* expr) {
if (in_function_) {
Variable* var = expr->var();
@@ -382,6 +441,9 @@
}
is_set_op_ = false;
} else {
+ if (VisitStdlibConstant(var)) {
+ return;
+ }
if (var->IsContextSlot()) {
current_function_builder_->Emit(kExprLoadGlobal);
} else {
@@ -399,32 +461,32 @@
}
void VisitLiteral(Literal* expr) {
- if (in_function_) {
- if (expr->raw_value()->IsNumber()) {
- LocalType type = TypeOf(expr);
- switch (type) {
- case kAstI32: {
- int val = static_cast<int>(expr->raw_value()->AsNumber());
- byte code[] = {WASM_I32(val)};
- current_function_builder_->EmitCode(code, sizeof(code));
- break;
- }
- case kAstF32: {
- float val = static_cast<float>(expr->raw_value()->AsNumber());
- byte code[] = {WASM_F32(val)};
- current_function_builder_->EmitCode(code, sizeof(code));
- break;
- }
- case kAstF64: {
- double val = static_cast<double>(expr->raw_value()->AsNumber());
- byte code[] = {WASM_F64(val)};
- current_function_builder_->EmitCode(code, sizeof(code));
- break;
- }
- default:
- UNREACHABLE();
- }
+ Handle<Object> value = expr->value();
+ if (!in_function_ || !value->IsNumber()) {
+ return;
+ }
+ Type* type = expr->bounds().upper;
+ if (type->Is(cache_.kAsmSigned)) {
+ int32_t i = 0;
+ if (!value->ToInt32(&i)) {
+ UNREACHABLE();
}
+ byte code[] = {WASM_I32V(i)};
+ current_function_builder_->EmitCode(code, sizeof(code));
+ } else if (type->Is(cache_.kAsmUnsigned) || type->Is(cache_.kAsmFixnum)) {
+ uint32_t u = 0;
+ if (!value->ToUint32(&u)) {
+ UNREACHABLE();
+ }
+ int32_t i = static_cast<int32_t>(u);
+ byte code[] = {WASM_I32V(i)};
+ current_function_builder_->EmitCode(code, sizeof(code));
+ } else if (type->Is(cache_.kAsmDouble)) {
+ double val = expr->raw_value()->AsNumber();
+ byte code[] = {WASM_F64(val)};
+ current_function_builder_->EmitCode(code, sizeof(code));
+ } else {
+ UNREACHABLE();
}
}
@@ -589,29 +651,33 @@
UnLoadInitFunction();
return;
}
- // TODO(bradnelson): Get rid of this.
- if (TypeOf(expr->value()) == kAstStmt) {
- Property* prop = expr->value()->AsProperty();
- if (prop != nullptr) {
- VariableProxy* vp = prop->obj()->AsVariableProxy();
- if (vp != nullptr && vp->var()->IsParameter() &&
- vp->var()->index() == 1) {
- VariableProxy* target = expr->target()->AsVariableProxy();
- if (target->bounds().lower->Is(Type::Function())) {
- const AstRawString* name =
- prop->key()->AsLiteral()->AsRawPropertyName();
- imported_function_table_.AddImport(
- target->var(), name->raw_data(), name->length());
- }
+ Property* prop = expr->value()->AsProperty();
+ if (prop != nullptr) {
+ VariableProxy* vp = prop->obj()->AsVariableProxy();
+ if (vp != nullptr && vp->var()->IsParameter() &&
+ vp->var()->index() == 1) {
+ VariableProxy* target = expr->target()->AsVariableProxy();
+ if (target->bounds().lower->Is(Type::Function())) {
+ const AstRawString* name =
+ prop->key()->AsLiteral()->AsRawPropertyName();
+ imported_function_table_.AddImport(target->var(), name->raw_data(),
+ name->length());
}
}
- ArrayLiteral* funcs = expr->value()->AsArrayLiteral();
- if (funcs != nullptr &&
- funcs->bounds().lower->AsArray()->Element()->IsFunction()) {
- VariableProxy* target = expr->target()->AsVariableProxy();
- DCHECK_NOT_NULL(target);
- AddFunctionTable(target, funcs);
- }
+ // Property values in module scope don't emit code, so return.
+ return;
+ }
+ ArrayLiteral* funcs = expr->value()->AsArrayLiteral();
+ if (funcs != nullptr &&
+ funcs->bounds().lower->AsArray()->Element()->IsFunction()) {
+ VariableProxy* target = expr->target()->AsVariableProxy();
+ DCHECK_NOT_NULL(target);
+ AddFunctionTable(target, funcs);
+ // Only add to the function table. No init needed.
+ return;
+ }
+ if (expr->value()->IsCallNew()) {
+ // No init code to emit for CallNew nodes.
return;
}
in_init = true;
@@ -630,6 +696,12 @@
is_set_op_ = true;
RECURSE(Visit(expr->target()));
DCHECK(!is_set_op_);
+ // Assignment to heapf32 from float64 converts.
+ if (TypeOf(expr->value()) == kAstF64 && expr->target()->IsProperty() &&
+ expr->target()->AsProperty()->obj()->bounds().lower->Is(
+ cache_.kFloat32Array)) {
+ current_function_builder_->Emit(kExprF32ConvertF64);
+ }
RECURSE(Visit(expr->value()));
if (in_init) {
UnLoadInitFunction();
@@ -672,7 +744,8 @@
Handle<Object> nvalue = maybe_nvalue.ToHandleChecked();
if (nvalue->IsNumber()) {
int32_t val = static_cast<int32_t>(nvalue->Number());
- byte code[] = {WASM_I32(val)};
+ // TODO(bradnelson): variable size
+ byte code[] = {WASM_I32V(val)};
current_function_builder_->EmitCode(code, sizeof(code));
return;
}
@@ -684,7 +757,7 @@
byte code[] = {WASM_F64(std::numeric_limits<double>::quiet_NaN())};
current_function_builder_->EmitCode(code, sizeof(code));
} else {
- byte code[] = {WASM_I32(0)};
+ byte code[] = {WASM_I32V_1(0)};
current_function_builder_->EmitCode(code, sizeof(code));
}
}
@@ -725,9 +798,9 @@
} else {
UNREACHABLE();
}
- current_function_builder_->EmitWithU8(
- WasmOpcodes::LoadStoreOpcodeOf(mtype, is_set_op_),
- WasmOpcodes::LoadStoreAccessOf(false));
+ // TODO(titzer): use special asm-compatibility opcodes?
+ current_function_builder_->EmitWithU8U8(
+ WasmOpcodes::LoadStoreOpcodeOf(mtype, is_set_op_), 0, 0);
is_set_op_ = false;
if (size == 1) {
// Allow more general expression in byte arrays than the spec
@@ -742,7 +815,8 @@
DCHECK(value->raw_value()->IsNumber());
DCHECK_EQ(kAstI32, TypeOf(value));
int val = static_cast<int>(value->raw_value()->AsNumber());
- byte code[] = {WASM_I32(val * size)};
+ // TODO(bradnelson): variable size
+ byte code[] = {WASM_I32V(val * size)};
current_function_builder_->EmitCode(code, sizeof(code));
return;
}
@@ -765,11 +839,209 @@
UNREACHABLE();
}
+ bool VisitStdlibFunction(Call* call, VariableProxy* expr) {
+ Variable* var = expr->var();
+ AsmTyper::StandardMember standard_object =
+ typer_->VariableAsStandardMember(var);
+ ZoneList<Expression*>* args = call->arguments();
+ LocalType call_type = TypeOf(call);
+ switch (standard_object) {
+ case AsmTyper::kNone: {
+ return false;
+ }
+ case AsmTyper::kMathAcos: {
+ DCHECK_EQ(kAstF64, call_type);
+ current_function_builder_->Emit(kExprF64Acos);
+ break;
+ }
+ case AsmTyper::kMathAsin: {
+ DCHECK_EQ(kAstF64, call_type);
+ current_function_builder_->Emit(kExprF64Asin);
+ break;
+ }
+ case AsmTyper::kMathAtan: {
+ DCHECK_EQ(kAstF64, call_type);
+ current_function_builder_->Emit(kExprF64Atan);
+ break;
+ }
+ case AsmTyper::kMathCos: {
+ DCHECK_EQ(kAstF64, call_type);
+ current_function_builder_->Emit(kExprF64Cos);
+ break;
+ }
+ case AsmTyper::kMathSin: {
+ DCHECK_EQ(kAstF64, call_type);
+ current_function_builder_->Emit(kExprF64Sin);
+ break;
+ }
+ case AsmTyper::kMathTan: {
+ DCHECK_EQ(kAstF64, call_type);
+ current_function_builder_->Emit(kExprF64Tan);
+ break;
+ }
+ case AsmTyper::kMathExp: {
+ DCHECK_EQ(kAstF64, call_type);
+ current_function_builder_->Emit(kExprF64Exp);
+ break;
+ }
+ case AsmTyper::kMathLog: {
+ DCHECK_EQ(kAstF64, call_type);
+ current_function_builder_->Emit(kExprF64Log);
+ break;
+ }
+ case AsmTyper::kMathCeil: {
+ if (call_type == kAstF32) {
+ current_function_builder_->Emit(kExprF32Ceil);
+ } else if (call_type == kAstF64) {
+ current_function_builder_->Emit(kExprF64Ceil);
+ } else {
+ UNREACHABLE();
+ }
+ break;
+ }
+ case AsmTyper::kMathFloor: {
+ if (call_type == kAstF32) {
+ current_function_builder_->Emit(kExprF32Floor);
+ } else if (call_type == kAstF64) {
+ current_function_builder_->Emit(kExprF64Floor);
+ } else {
+ UNREACHABLE();
+ }
+ break;
+ }
+ case AsmTyper::kMathSqrt: {
+ if (call_type == kAstF32) {
+ current_function_builder_->Emit(kExprF32Sqrt);
+ } else if (call_type == kAstF64) {
+ current_function_builder_->Emit(kExprF64Sqrt);
+ } else {
+ UNREACHABLE();
+ }
+ break;
+ }
+ case AsmTyper::kMathAbs: {
+ // TODO(bradnelson): Should this be cast to float?
+ if (call_type == kAstI32) {
+ current_function_builder_->Emit(kExprIfElse);
+ current_function_builder_->Emit(kExprI32LtS);
+ Visit(args->at(0));
+ byte code[] = {WASM_I8(0)};
+ current_function_builder_->EmitCode(code, sizeof(code));
+ current_function_builder_->Emit(kExprI32Sub);
+ current_function_builder_->EmitCode(code, sizeof(code));
+ Visit(args->at(0));
+ } else if (call_type == kAstF32) {
+ current_function_builder_->Emit(kExprF32Abs);
+ } else if (call_type == kAstF64) {
+ current_function_builder_->Emit(kExprF64Abs);
+ } else {
+ UNREACHABLE();
+ }
+ break;
+ }
+ case AsmTyper::kMathMin: {
+ // TODO(bradnelson): Change wasm to match Math.min in asm.js mode.
+ if (call_type == kAstI32) {
+ current_function_builder_->Emit(kExprIfElse);
+ current_function_builder_->Emit(kExprI32LeS);
+ Visit(args->at(0));
+ Visit(args->at(1));
+ } else if (call_type == kAstF32) {
+ current_function_builder_->Emit(kExprF32Min);
+ } else if (call_type == kAstF64) {
+ current_function_builder_->Emit(kExprF64Min);
+ } else {
+ UNREACHABLE();
+ }
+ break;
+ }
+ case AsmTyper::kMathMax: {
+ // TODO(bradnelson): Change wasm to match Math.max in asm.js mode.
+ if (call_type == kAstI32) {
+ current_function_builder_->Emit(kExprIfElse);
+ current_function_builder_->Emit(kExprI32GtS);
+ Visit(args->at(0));
+ Visit(args->at(1));
+ } else if (call_type == kAstF32) {
+ current_function_builder_->Emit(kExprF32Max);
+ } else if (call_type == kAstF64) {
+ current_function_builder_->Emit(kExprF64Max);
+ } else {
+ UNREACHABLE();
+ }
+ break;
+ }
+ case AsmTyper::kMathAtan2: {
+ DCHECK_EQ(kAstF64, call_type);
+ current_function_builder_->Emit(kExprF64Atan2);
+ break;
+ }
+ case AsmTyper::kMathPow: {
+ DCHECK_EQ(kAstF64, call_type);
+ current_function_builder_->Emit(kExprF64Pow);
+ break;
+ }
+ case AsmTyper::kMathImul: {
+ current_function_builder_->Emit(kExprI32Mul);
+ break;
+ }
+ case AsmTyper::kMathFround: {
+ DCHECK(args->length() == 1);
+ Literal* literal = args->at(0)->AsLiteral();
+ if (literal != nullptr) {
+ if (literal->raw_value()->IsNumber()) {
+ float val = static_cast<float>(literal->raw_value()->AsNumber());
+ byte code[] = {WASM_F32(val)};
+ current_function_builder_->EmitCode(code, sizeof(code));
+ return true;
+ }
+ }
+ switch (TypeIndexOf(args->at(0))) {
+ case kInt32:
+ case kFixnum:
+ current_function_builder_->Emit(kExprF32SConvertI32);
+ break;
+ case kUint32:
+ current_function_builder_->Emit(kExprF32UConvertI32);
+ break;
+ case kFloat32:
+ break;
+ case kFloat64:
+ current_function_builder_->Emit(kExprF32ConvertF64);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+ }
+ default: {
+ UNREACHABLE();
+ break;
+ }
+ }
+ VisitCallArgs(call);
+ return true;
+ }
+
+ void VisitCallArgs(Call* expr) {
+ ZoneList<Expression*>* args = expr->arguments();
+ for (int i = 0; i < args->length(); ++i) {
+ Expression* arg = args->at(i);
+ RECURSE(Visit(arg));
+ }
+ }
+
void VisitCall(Call* expr) {
Call::CallType call_type = expr->GetCallType(isolate_);
switch (call_type) {
case Call::OTHER_CALL: {
DCHECK(in_function_);
+ VariableProxy* proxy = expr->expression()->AsVariableProxy();
+ if (proxy != nullptr) {
+ if (VisitStdlibFunction(expr, proxy)) {
+ return;
+ }
+ }
uint16_t index;
VariableProxy* vp = expr->expression()->AsVariableProxy();
if (vp != nullptr &&
@@ -802,10 +1074,11 @@
VariableProxy* var = p->obj()->AsVariableProxy();
DCHECK_NOT_NULL(var);
FunctionTableIndices* indices = LookupFunctionTable(var->var());
- current_function_builder_->EmitWithU8(kExprCallIndirect,
- indices->signature_index);
+ current_function_builder_->EmitWithVarInt(kExprCallIndirect,
+ indices->signature_index);
current_function_builder_->Emit(kExprI32Add);
- byte code[] = {WASM_I32(indices->start_index)};
+ // TODO(bradnelson): variable size
+ byte code[] = {WASM_I32V(indices->start_index)};
current_function_builder_->EmitCode(code, sizeof(code));
RECURSE(Visit(p->key()));
break;
@@ -813,11 +1086,7 @@
default:
UNREACHABLE();
}
- ZoneList<Expression*>* args = expr->arguments();
- for (int i = 0; i < args->length(); ++i) {
- Expression* arg = args->at(i);
- RECURSE(Visit(arg));
- }
+ VisitCallArgs(expr);
}
void VisitCallNew(CallNew* expr) { UNREACHABLE(); }
@@ -828,7 +1097,7 @@
switch (expr->op()) {
case Token::NOT: {
DCHECK_EQ(kAstI32, TypeOf(expr->expression()));
- current_function_builder_->Emit(kExprBoolNot);
+ current_function_builder_->Emit(kExprI32Eqz);
break;
}
default:
@@ -1022,7 +1291,7 @@
} else if (type == kUint32) {
current_function_builder_->Emit(kExprI32RemU);
} else if (type == kFloat64) {
- ModF64(expr);
+ current_function_builder_->Emit(kExprF64Mod);
return;
} else {
UNREACHABLE();
@@ -1030,7 +1299,7 @@
break;
}
case Token::COMMA: {
- current_function_builder_->EmitWithU8(kExprBlock, 2);
+ current_function_builder_->EmitWithVarInt(kExprBlock, 2);
break;
}
default:
@@ -1041,32 +1310,6 @@
}
}
- void ModF64(BinaryOperation* expr) {
- current_function_builder_->EmitWithU8(kExprBlock, 3);
- uint16_t index_0 = current_function_builder_->AddLocal(kAstF64);
- uint16_t index_1 = current_function_builder_->AddLocal(kAstF64);
- current_function_builder_->Emit(kExprSetLocal);
- AddLeb128(index_0, true);
- RECURSE(Visit(expr->left()));
- current_function_builder_->Emit(kExprSetLocal);
- AddLeb128(index_1, true);
- RECURSE(Visit(expr->right()));
- current_function_builder_->Emit(kExprF64Sub);
- current_function_builder_->Emit(kExprGetLocal);
- AddLeb128(index_0, true);
- current_function_builder_->Emit(kExprF64Mul);
- current_function_builder_->Emit(kExprGetLocal);
- AddLeb128(index_1, true);
- // Use trunc instead of two casts
- current_function_builder_->Emit(kExprF64SConvertI32);
- current_function_builder_->Emit(kExprI32SConvertF64);
- current_function_builder_->Emit(kExprF64Div);
- current_function_builder_->Emit(kExprGetLocal);
- AddLeb128(index_0, true);
- current_function_builder_->Emit(kExprGetLocal);
- AddLeb128(index_1, true);
- }
-
void AddLeb128(uint32_t index, bool is_local) {
std::vector<uint8_t> index_vec = UnsignedLEB128From(index);
if (is_local) {
@@ -1262,6 +1505,7 @@
Isolate* isolate_;
Zone* zone_;
Handle<Object> foreign_;
+ AsmTyper* typer_;
TypeCache const& cache_;
ZoneVector<std::pair<BreakableStatement*, bool>> breakable_blocks_;
int block_size_;
@@ -1277,13 +1521,18 @@
};
AsmWasmBuilder::AsmWasmBuilder(Isolate* isolate, Zone* zone,
- FunctionLiteral* literal, Handle<Object> foreign)
- : isolate_(isolate), zone_(zone), literal_(literal), foreign_(foreign) {}
+ FunctionLiteral* literal, Handle<Object> foreign,
+ AsmTyper* typer)
+ : isolate_(isolate),
+ zone_(zone),
+ literal_(literal),
+ foreign_(foreign),
+ typer_(typer) {}
// TODO(aseemgarg): probably should take zone (to write wasm to) as input so
// that zone in constructor may be thrown away once wasm module is written.
WasmModuleIndex* AsmWasmBuilder::Run() {
- AsmWasmBuilderImpl impl(isolate_, zone_, literal_, foreign_);
+ AsmWasmBuilderImpl impl(isolate_, zone_, literal_, foreign_, typer_);
impl.Compile();
WasmModuleWriter* writer = impl.builder_->Build(zone_);
return writer->WriteTo(zone_);