Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: src/builtins.cc

Issue 2057403003: Hooking up asm-wasm conversion. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mrege Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins.h ('k') | src/compiler.cc » ('j') | src/objects-debug.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index dcbeb2a6287eb8d3f09d30f6737e7aad9850b8a5..6e045eb9828665fa60556410d12c383f98c5e6e1 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -28,6 +28,7 @@
#include "src/string-builder.h"
#include "src/uri.h"
#include "src/vm-state-inl.h"
+#include "src/wasm/wasm-js.h"
namespace v8 {
namespace internal {
@@ -5351,6 +5352,35 @@ BUILTIN(HandleApiCallAsConstructor) {
return HandleApiCallAsFunctionOrConstructor(isolate, true, args);
}
+BUILTIN(CompileAsmJs) {
Michael Starzinger 2016/06/13 14:10:43 nit: Could we call this InstantiateAsmJs (or simil
bradnelson 2016/06/27 07:56:10 Done.
+ HandleScope handleScope(isolate);
+ Handle<JSObject> foreign;
+ if (args.length() > 2) {
+ foreign = args.at<i::JSObject>(2);
+ }
+ Handle<JSArrayBuffer> memory;
+ if (args.length() > 3 && args[3]->IsJSArrayBuffer()) {
+ memory = args.at<i::JSArrayBuffer>(3);
+ }
+ Handle<JSFunction> function = args.target<i::JSFunction>();
+ Handle<Object> result;
+ if (args.length() > 1 &&
+ WasmJs::InstantiateAsmWasm(isolate,
+ handle(function->shared()->asm_wasm_data()),
+ memory, foreign, &result)) {
+ return *result;
+ } else {
+ function->shared()->ClearAsmWasmData();
+ StackLimitCheck check(isolate);
+ if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
+ if (!Compiler::CompileBaseline(function)) {
+ return isolate->heap()->exception();
+ }
+ DCHECK(function->is_compiled());
+ return function->code();
Michael Starzinger 2016/06/13 14:10:43 This will return the compiled code to JavaScript.
bradnelson 2016/06/27 07:56:10 Struggled with this a bit. I don't believe it can
+ }
+}
+
namespace {
void Generate_LoadIC_Miss(CodeStubAssembler* assembler) {
« no previous file with comments | « src/builtins.h ('k') | src/compiler.cc » ('j') | src/objects-debug.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698