Index: src/runtime/runtime-wasm.cc |
diff --git a/src/runtime/runtime-wasm.cc b/src/runtime/runtime-wasm.cc |
index 61ba1f7a3d1b868d501c24e4037198cd1b55f8c5..fc8d6a09ea2d5d91d3499cc413bdc9374a4b4236 100644 |
--- a/src/runtime/runtime-wasm.cc |
+++ b/src/runtime/runtime-wasm.cc |
@@ -55,6 +55,11 @@ RUNTIME_FUNCTION(Runtime_WasmGrowMemory) { |
CONVERT_UINT32_ARG_CHECKED(delta_pages, 0); |
Handle<WasmInstanceObject> instance(GetWasmInstanceOnStackTop(isolate), |
isolate); |
+ |
+ // Set the current isolate's context. |
+ DCHECK_NULL(isolate->context()); |
+ isolate->set_context(instance->compiled_module()->ptr_to_native_context()); |
+ |
return *isolate->factory()->NewNumberFromInt( |
wasm::GrowMemory(isolate, instance, delta_pages)); |
} |
@@ -147,6 +152,10 @@ RUNTIME_FUNCTION(Runtime_WasmThrow) { |
const int32_t thrown_value = (upper << 16) | lower; |
+ // Set the current isolate's context. |
+ DCHECK_NULL(isolate->context()); |
+ isolate->set_context(GetWasmContextOnStackTop(isolate)); |
+ |
return isolate->Throw(*isolate->factory()->NewNumberFromInt(thrown_value)); |
} |
@@ -178,8 +187,9 @@ RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) { |
CHECK(arg_buffer_obj->IsSmi()); |
uint8_t* arg_buffer = reinterpret_cast<uint8_t*>(*arg_buffer_obj); |
- DCHECK_EQ(isolate->context(), |
- instance->compiled_module()->ptr_to_native_context()); |
+ // Set the current isolate's context. |
+ DCHECK_NULL(isolate->context()); |
+ isolate->set_context(instance->compiled_module()->ptr_to_native_context()); |
instance->debug_info()->RunInterpreter(func_index, arg_buffer); |
return isolate->heap()->undefined_value(); |