OLD | NEW |
---|---|
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/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
11 #include "src/full-codegen/full-codegen.h" | 11 #include "src/full-codegen/full-codegen.h" |
12 #include "src/isolate-inl.h" | 12 #include "src/isolate-inl.h" |
13 #include "src/messages.h" | 13 #include "src/messages.h" |
14 #include "src/v8threads.h" | 14 #include "src/v8threads.h" |
15 #include "src/vm-state-inl.h" | 15 #include "src/vm-state-inl.h" |
16 #include "src/wasm/wasm-js.h" | |
16 | 17 |
17 namespace v8 { | 18 namespace v8 { |
18 namespace internal { | 19 namespace internal { |
19 | 20 |
20 RUNTIME_FUNCTION(Runtime_CompileLazy) { | 21 RUNTIME_FUNCTION(Runtime_CompileLazy) { |
21 HandleScope scope(isolate); | 22 HandleScope scope(isolate); |
22 DCHECK_EQ(1, args.length()); | 23 DCHECK_EQ(1, args.length()); |
23 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 24 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
24 | 25 |
25 #ifdef DEBUG | 26 #ifdef DEBUG |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 | 83 |
83 RUNTIME_FUNCTION(Runtime_NotifyStubFailure) { | 84 RUNTIME_FUNCTION(Runtime_NotifyStubFailure) { |
84 HandleScope scope(isolate); | 85 HandleScope scope(isolate); |
85 DCHECK(args.length() == 0); | 86 DCHECK(args.length() == 0); |
86 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); | 87 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); |
87 DCHECK(AllowHeapAllocation::IsAllowed()); | 88 DCHECK(AllowHeapAllocation::IsAllowed()); |
88 delete deoptimizer; | 89 delete deoptimizer; |
89 return isolate->heap()->undefined_value(); | 90 return isolate->heap()->undefined_value(); |
90 } | 91 } |
91 | 92 |
93 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.
| |
94 HandleScope scope(isolate); | |
95 DCHECK_EQ(args.length(), 4); | |
96 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | |
97 | |
98 Handle<JSObject> foreign; | |
99 if (args[2]->IsJSObject()) { | |
100 foreign = args.at<i::JSObject>(2); | |
101 } | |
102 Handle<JSArrayBuffer> memory; | |
103 if (args[3]->IsJSArrayBuffer()) { | |
104 memory = args.at<i::JSArrayBuffer>(3); | |
105 } | |
106 Handle<Object> result; | |
107 if (args[1]->IsJSObject() && | |
108 WasmJs::InstantiateAsmWasm(isolate, | |
109 handle(function->shared()->asm_wasm_data()), | |
110 memory, foreign, &result)) { | |
111 return *result; | |
112 } else { | |
113 // Remove wasm data and return a smi 0 to indicate failure. | |
114 function->shared()->ClearAsmWasmData(); | |
115 return Smi::FromInt(0); | |
116 } | |
117 } | |
92 | 118 |
93 class ActivationsFinder : public ThreadVisitor { | 119 class ActivationsFinder : public ThreadVisitor { |
94 public: | 120 public: |
95 Code* code_; | 121 Code* code_; |
96 bool has_code_activations_; | 122 bool has_code_activations_; |
97 | 123 |
98 explicit ActivationsFinder(Code* code) | 124 explicit ActivationsFinder(Code* code) |
99 : code_(code), has_code_activations_(false) {} | 125 : code_(code), has_code_activations_(false) {} |
100 | 126 |
101 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { | 127 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 DCHECK(is_valid_language_mode(args.smi_at(3))); | 396 DCHECK(is_valid_language_mode(args.smi_at(3))); |
371 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); | 397 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); |
372 DCHECK(args[4]->IsSmi()); | 398 DCHECK(args[4]->IsSmi()); |
373 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 399 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
374 isolate); | 400 isolate); |
375 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 401 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
376 language_mode, args.smi_at(4), args.smi_at(5)); | 402 language_mode, args.smi_at(4), args.smi_at(5)); |
377 } | 403 } |
378 } // namespace internal | 404 } // namespace internal |
379 } // namespace v8 | 405 } // namespace v8 |
OLD | NEW |