Index: src/runtime/runtime-compiler.cc |
diff --git a/src/runtime/runtime-compiler.cc b/src/runtime/runtime-compiler.cc |
index c0950456f9b82d88802caa7e1e1b913ffbc11f02..0d2e671ac95489c1bbe2172f9714af96697d6b1f 100644 |
--- a/src/runtime/runtime-compiler.cc |
+++ b/src/runtime/runtime-compiler.cc |
@@ -13,6 +13,7 @@ |
#include "src/messages.h" |
#include "src/v8threads.h" |
#include "src/vm-state-inl.h" |
+#include "src/wasm/wasm-js.h" |
namespace v8 { |
namespace internal { |
@@ -89,6 +90,31 @@ RUNTIME_FUNCTION(Runtime_NotifyStubFailure) { |
return isolate->heap()->undefined_value(); |
} |
+RUNTIME_FUNCTION(Runtime_InstantiateAsmJs) { |
Michael Starzinger
2016/06/29 08:29:23
nit: Lets move this up one function so that it is
bradn
2016/06/30 07:59:36
Done.
|
+ HandleScope scope(isolate); |
+ DCHECK_EQ(args.length(), 4); |
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
+ |
+ Handle<JSObject> foreign; |
+ if (args[2]->IsJSObject()) { |
+ foreign = args.at<i::JSObject>(2); |
+ } |
+ Handle<JSArrayBuffer> memory; |
+ if (args[3]->IsJSArrayBuffer()) { |
+ memory = args.at<i::JSArrayBuffer>(3); |
+ } |
+ Handle<Object> result; |
+ if (args[1]->IsJSObject() && |
+ WasmJs::InstantiateAsmWasm(isolate, |
+ handle(function->shared()->asm_wasm_data()), |
+ memory, foreign, &result)) { |
+ return *result; |
+ } else { |
+ // Remove wasm data and return a smi 0 to indicate failure. |
+ function->shared()->ClearAsmWasmData(); |
+ return Smi::FromInt(0); |
+ } |
+} |
class ActivationsFinder : public ThreadVisitor { |
public: |