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 if (function->shared()->code() == |
| 112 isolate->builtins()->builtin(Builtins::kInstantiateAsmJs)) { |
| 113 function->shared()->ReplaceCode( |
| 114 isolate->builtins()->builtin(Builtins::kCompileLazy)); |
| 115 } |
106 return Smi::FromInt(0); | 116 return Smi::FromInt(0); |
107 } | 117 } |
108 | 118 |
109 RUNTIME_FUNCTION(Runtime_NotifyStubFailure) { | 119 RUNTIME_FUNCTION(Runtime_NotifyStubFailure) { |
110 HandleScope scope(isolate); | 120 HandleScope scope(isolate); |
111 DCHECK(args.length() == 0); | 121 DCHECK(args.length() == 0); |
112 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); | 122 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); |
113 DCHECK(AllowHeapAllocation::IsAllowed()); | 123 DCHECK(AllowHeapAllocation::IsAllowed()); |
114 delete deoptimizer; | 124 delete deoptimizer; |
115 return isolate->heap()->undefined_value(); | 125 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))); | 439 DCHECK(is_valid_language_mode(args.smi_at(3))); |
430 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); | 440 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); |
431 DCHECK(args[4]->IsSmi()); | 441 DCHECK(args[4]->IsSmi()); |
432 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 442 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
433 isolate); | 443 isolate); |
434 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 444 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
435 language_mode, args.smi_at(4), args.smi_at(5)); | 445 language_mode, args.smi_at(4), args.smi_at(5)); |
436 } | 446 } |
437 } // namespace internal | 447 } // namespace internal |
438 } // namespace v8 | 448 } // namespace v8 |
OLD | NEW |