Chromium Code Reviews| Index: src/compiler/wasm-compiler.cc |
| diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc |
| index 797ba412a29e701b683faad39dae713e7432cc56..81861e1196dd8ba14931c3dd968bbb678e8df97d 100644 |
| --- a/src/compiler/wasm-compiler.cc |
| +++ b/src/compiler/wasm-compiler.cc |
| @@ -2230,16 +2230,15 @@ Node* WasmGraphBuilder::BuildChangeFloat64ToTagged(Node* value) { |
| return value; |
| } |
| -Node* WasmGraphBuilder::ToJS(Node* node, wasm::LocalType type) { |
| +Node* WasmGraphBuilder::ToJS(Node* node, Handle<Context> context, |
| + wasm::LocalType type) { |
| switch (type) { |
| case wasm::kAstI32: |
| return BuildChangeInt32ToTagged(node); |
| case wasm::kAstI64: |
| - DCHECK(module_ && !module_->instance->context.is_null()); |
| // Throw a TypeError. |
| return BuildCallToRuntime(Runtime::kWasmThrowTypeError, jsgraph(), |
| - module_->instance->context, nullptr, 0, effect_, |
| - *control_); |
| + context, nullptr, 0, effect_, *control_); |
| case wasm::kAstF32: |
| node = graph()->NewNode(jsgraph()->machine()->ChangeFloat32ToFloat64(), |
| node); |
| @@ -2503,7 +2502,8 @@ Node* WasmGraphBuilder::BuildHeapNumberValueIndexConstant() { |
| return jsgraph()->IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag); |
| } |
| -void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code, |
| +void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Context> context, |
| + Handle<Code> wasm_code, |
| wasm::FunctionSig* sig) { |
| int wasm_count = static_cast<int>(sig->parameter_count()); |
| int param_count; |
| @@ -2520,7 +2520,7 @@ void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code, |
| *control_ = start; |
| *effect_ = start; |
| // Create the context parameter |
| - Node* context = graph()->NewNode( |
| + Node* context_node = graph()->NewNode( |
| jsgraph()->common()->Parameter( |
| Linkage::GetJSCallContextParamIndex(wasm_count + 1), "%context"), |
| graph()->start()); |
| @@ -2532,7 +2532,7 @@ void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code, |
| for (int i = 0; i < wasm_count; ++i) { |
| Node* param = |
| graph()->NewNode(jsgraph()->common()->Parameter(i + 1), start); |
| - Node* wasm_param = FromJS(param, context, sig->GetParam(i)); |
| + Node* wasm_param = FromJS(param, context_node, sig->GetParam(i)); |
| args[pos++] = wasm_param; |
| if (jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kAstI64) { |
| // We make up the high word with SAR to get the proper sign extension. |
| @@ -2558,8 +2558,9 @@ void WasmGraphBuilder::BuildJSToWasmWrapper(Handle<Code> wasm_code, |
| retval = graph()->NewNode(jsgraph()->common()->Projection(0), retval, |
| graph()->start()); |
| } |
| - Node* jsval = ToJS( |
| - retval, sig->return_count() == 0 ? wasm::kAstStmt : sig->GetReturn()); |
| + Node* jsval = |
| + ToJS(retval, context, |
|
titzer
2016/08/22 08:28:14
Maybe this take a context_node, since we already h
|
| + sig->return_count() == 0 ? wasm::kAstStmt : sig->GetReturn()); |
| Node* ret = |
| graph()->NewNode(jsgraph()->common()->Return(), jsval, call, start); |
| @@ -2637,7 +2638,7 @@ void WasmGraphBuilder::BuildWasmToJSWrapper(Handle<Context> context, |
| for (int i = 0; i < wasm_count; ++i) { |
| Node* param = |
| graph()->NewNode(jsgraph()->common()->Parameter(param_index++), start); |
| - args[pos++] = ToJS(param, sig->GetParam(i)); |
| + args[pos++] = ToJS(param, context, sig->GetParam(i)); |
| if (jsgraph()->machine()->Is32() && sig->GetParam(i) == wasm::kAstI64) { |
| // On 32 bit platforms we have to skip the high word of int64 parameters. |
| param_index++; |
| @@ -2940,7 +2941,8 @@ static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, |
| *script_str, 0, 0)); |
| } |
| -Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::ModuleEnv* module, |
| +Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, Handle<Context> context, |
| + wasm::ModuleEnv* module, |
| Handle<Code> wasm_code, uint32_t index) { |
| const wasm::WasmFunction* func = &module->module->functions[index]; |
| @@ -2960,7 +2962,7 @@ Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::ModuleEnv* module, |
| builder.set_control_ptr(&control); |
| builder.set_effect_ptr(&effect); |
| builder.set_module(module); |
| - builder.BuildJSToWasmWrapper(wasm_code, func->sig); |
| + builder.BuildJSToWasmWrapper(context, wasm_code, func->sig); |
| //---------------------------------------------------------------------------- |
| // Run the compilation pipeline. |