Index: src/asmjs/asm-js.cc |
diff --git a/src/asmjs/asm-js.cc b/src/asmjs/asm-js.cc |
index 95253deedf0e876ce3cb7d75a32889eef4ebffa0..98271a51518447f46d11737115e7774f30604f15 100644 |
--- a/src/asmjs/asm-js.cc |
+++ b/src/asmjs/asm-js.cc |
@@ -256,8 +256,18 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(i::Isolate* isolate, |
ErrorThrower thrower(isolate, "Asm.js -> WebAssembly instantiation"); |
+ // Create the ffi object for foreign functions {"": foreign}. |
+ Handle<JSObject> ffi_object; |
+ if (!foreign.is_null()) { |
+ Handle<JSFunction> object_function = Handle<JSFunction>( |
+ isolate->native_context()->object_function(), isolate); |
+ ffi_object = isolate->factory()->NewJSObject(object_function); |
+ JSObject::AddProperty(ffi_object, isolate->factory()->empty_string(), |
+ foreign, NONE); |
+ } |
+ |
i::MaybeHandle<i::JSObject> maybe_module_object = |
- i::wasm::WasmModule::Instantiate(isolate, &thrower, module, foreign, |
+ i::wasm::WasmModule::Instantiate(isolate, &thrower, module, ffi_object, |
memory); |
if (maybe_module_object.is_null()) { |
return MaybeHandle<Object>(); |