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/asmjs/asm-js.h" | 8 #include "src/asmjs/asm-js.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 memory = args.at<i::JSArrayBuffer>(3); | 94 memory = args.at<i::JSArrayBuffer>(3); |
95 } | 95 } |
96 if (args[1]->IsJSObject()) { | 96 if (args[1]->IsJSObject()) { |
97 MaybeHandle<Object> result; | 97 MaybeHandle<Object> result; |
98 result = AsmJs::InstantiateAsmWasm( | 98 result = AsmJs::InstantiateAsmWasm( |
99 isolate, handle(function->shared()->asm_wasm_data()), memory, foreign); | 99 isolate, handle(function->shared()->asm_wasm_data()), memory, foreign); |
100 if (!result.is_null()) { | 100 if (!result.is_null()) { |
101 return *result.ToHandleChecked(); | 101 return *result.ToHandleChecked(); |
102 } | 102 } |
103 } | 103 } |
104 // Remove wasm data and return a smi 0 to indicate failure. | 104 // Remove wasm data, mark as broken for asm->wasm, |
105 // replace code with CompileLazy, and return a smi 0 to indicate failure. | |
105 function->shared()->ClearAsmWasmData(); | 106 function->shared()->ClearAsmWasmData(); |
107 function->shared()->set_is_asm_wasm_broken(true); | |
108 DCHECK(function->code() == | |
109 isolate->builtins()->builtin(Builtins::kInstantiateAsmJs)); | |
110 function->ReplaceCode(isolate->builtins()->builtin(Builtins::kCompileLazy)); | |
111 function->shared()->ReplaceCode( | |
Michael Starzinger
2016/08/12 09:21:55
Replacing the code on the SharedFunctionInfo is da
bradn
2016/08/12 18:50:02
Done.
| |
112 isolate->builtins()->builtin(Builtins::kCompileLazy)); | |
106 return Smi::FromInt(0); | 113 return Smi::FromInt(0); |
107 } | 114 } |
108 | 115 |
109 RUNTIME_FUNCTION(Runtime_NotifyStubFailure) { | 116 RUNTIME_FUNCTION(Runtime_NotifyStubFailure) { |
110 HandleScope scope(isolate); | 117 HandleScope scope(isolate); |
111 DCHECK(args.length() == 0); | 118 DCHECK(args.length() == 0); |
112 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); | 119 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); |
113 DCHECK(AllowHeapAllocation::IsAllowed()); | 120 DCHECK(AllowHeapAllocation::IsAllowed()); |
114 delete deoptimizer; | 121 delete deoptimizer; |
115 return isolate->heap()->undefined_value(); | 122 return isolate->heap()->undefined_value(); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 DCHECK(is_valid_language_mode(args.smi_at(3))); | 436 DCHECK(is_valid_language_mode(args.smi_at(3))); |
430 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); | 437 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); |
431 DCHECK(args[4]->IsSmi()); | 438 DCHECK(args[4]->IsSmi()); |
432 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 439 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
433 isolate); | 440 isolate); |
434 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 441 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
435 language_mode, args.smi_at(4), args.smi_at(5)); | 442 language_mode, args.smi_at(4), args.smi_at(5)); |
436 } | 443 } |
437 } // namespace internal | 444 } // namespace internal |
438 } // namespace v8 | 445 } // namespace v8 |
OLD | NEW |