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

Side by Side Diff: src/runtime/runtime-compiler.cc

Issue 2057403003: Hooking up asm-wasm conversion. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | src/s390/builtins-s390.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/asmjs/asm-js.h"
8 #include "src/compiler.h" 9 #include "src/compiler.h"
9 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
10 #include "src/frames-inl.h" 11 #include "src/frames-inl.h"
11 #include "src/full-codegen/full-codegen.h" 12 #include "src/full-codegen/full-codegen.h"
12 #include "src/isolate-inl.h" 13 #include "src/isolate-inl.h"
13 #include "src/messages.h" 14 #include "src/messages.h"
14 #include "src/v8threads.h" 15 #include "src/v8threads.h"
15 #include "src/vm-state-inl.h" 16 #include "src/vm-state-inl.h"
16 17
17 namespace v8 { 18 namespace v8 {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 73 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
73 StackLimitCheck check(isolate); 74 StackLimitCheck check(isolate);
74 if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow(); 75 if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
75 if (!Compiler::CompileOptimized(function, Compiler::NOT_CONCURRENT)) { 76 if (!Compiler::CompileOptimized(function, Compiler::NOT_CONCURRENT)) {
76 return isolate->heap()->exception(); 77 return isolate->heap()->exception();
77 } 78 }
78 DCHECK(function->is_compiled()); 79 DCHECK(function->is_compiled());
79 return function->code(); 80 return function->code();
80 } 81 }
81 82
83 RUNTIME_FUNCTION(Runtime_InstantiateAsmJs) {
84 HandleScope scope(isolate);
85 DCHECK_EQ(args.length(), 4);
86 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
87
88 Handle<JSObject> foreign;
89 if (args[2]->IsJSObject()) {
90 foreign = args.at<i::JSObject>(2);
91 }
92 Handle<JSArrayBuffer> memory;
93 if (args[3]->IsJSArrayBuffer()) {
94 memory = args.at<i::JSArrayBuffer>(3);
95 }
96 if (args[1]->IsJSObject()) {
97 MaybeHandle<Object> result;
98 result = AsmJs::InstantiateAsmWasm(
99 isolate, handle(function->shared()->asm_wasm_data()), memory, foreign);
100 if (!result.is_null()) {
101 return *result.ToHandleChecked();
102 }
103 }
104 // Remove wasm data and return a smi 0 to indicate failure.
105 function->shared()->ClearAsmWasmData();
106 return Smi::FromInt(0);
107 }
82 108
83 RUNTIME_FUNCTION(Runtime_NotifyStubFailure) { 109 RUNTIME_FUNCTION(Runtime_NotifyStubFailure) {
84 HandleScope scope(isolate); 110 HandleScope scope(isolate);
85 DCHECK(args.length() == 0); 111 DCHECK(args.length() == 0);
86 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); 112 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate);
87 DCHECK(AllowHeapAllocation::IsAllowed()); 113 DCHECK(AllowHeapAllocation::IsAllowed());
88 delete deoptimizer; 114 delete deoptimizer;
89 return isolate->heap()->undefined_value(); 115 return isolate->heap()->undefined_value();
90 } 116 }
91 117
92
93 class ActivationsFinder : public ThreadVisitor { 118 class ActivationsFinder : public ThreadVisitor {
94 public: 119 public:
95 Code* code_; 120 Code* code_;
96 bool has_code_activations_; 121 bool has_code_activations_;
97 122
98 explicit ActivationsFinder(Code* code) 123 explicit ActivationsFinder(Code* code)
99 : code_(code), has_code_activations_(false) {} 124 : code_(code), has_code_activations_(false) {}
100 125
101 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { 126 void VisitThread(Isolate* isolate, ThreadLocalTop* top) {
102 JavaScriptFrameIterator it(isolate, top); 127 JavaScriptFrameIterator it(isolate, top);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 DCHECK(is_valid_language_mode(args.smi_at(3))); 395 DCHECK(is_valid_language_mode(args.smi_at(3)));
371 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); 396 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3));
372 DCHECK(args[4]->IsSmi()); 397 DCHECK(args[4]->IsSmi());
373 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), 398 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(),
374 isolate); 399 isolate);
375 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, 400 return CompileGlobalEval(isolate, args.at<String>(1), outer_info,
376 language_mode, args.smi_at(4), args.smi_at(5)); 401 language_mode, args.smi_at(4), args.smi_at(5));
377 } 402 }
378 } // namespace internal 403 } // namespace internal
379 } // namespace v8 404 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/s390/builtins-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698