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

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

Issue 2253613004: [wasm] Fix asm.js module instantiation on retry. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | test/mjsunit/asm/asm-validation.js » ('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/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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 86 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
87 87
88 Handle<JSObject> foreign; 88 Handle<JSObject> foreign;
89 if (args[2]->IsJSObject()) { 89 if (args[2]->IsJSObject()) {
90 foreign = args.at<i::JSObject>(2); 90 foreign = args.at<i::JSObject>(2);
91 } 91 }
92 Handle<JSArrayBuffer> memory; 92 Handle<JSArrayBuffer> memory;
93 if (args[3]->IsJSArrayBuffer()) { 93 if (args[3]->IsJSArrayBuffer()) {
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() && function->shared()->HasAsmWasmData()) {
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, mark as broken for asm->wasm, 104 // Remove wasm data, mark as broken for asm->wasm,
105 // replace code with CompileLazy, and return a smi 0 to indicate failure. 105 // replace code with CompileLazy, and return a smi 0 to indicate failure.
106 function->shared()->ClearAsmWasmData(); 106 if (function->shared()->HasAsmWasmData()) {
107 function->shared()->ClearAsmWasmData();
108 }
107 function->shared()->set_is_asm_wasm_broken(true); 109 function->shared()->set_is_asm_wasm_broken(true);
108 DCHECK(function->code() == 110 DCHECK(function->code() ==
109 isolate->builtins()->builtin(Builtins::kInstantiateAsmJs)); 111 isolate->builtins()->builtin(Builtins::kInstantiateAsmJs));
110 function->ReplaceCode(isolate->builtins()->builtin(Builtins::kCompileLazy)); 112 function->ReplaceCode(isolate->builtins()->builtin(Builtins::kCompileLazy));
111 if (function->shared()->code() == 113 if (function->shared()->code() ==
112 isolate->builtins()->builtin(Builtins::kInstantiateAsmJs)) { 114 isolate->builtins()->builtin(Builtins::kInstantiateAsmJs)) {
113 function->shared()->ReplaceCode( 115 function->shared()->ReplaceCode(
114 isolate->builtins()->builtin(Builtins::kCompileLazy)); 116 isolate->builtins()->builtin(Builtins::kCompileLazy));
115 } 117 }
116 return Smi::FromInt(0); 118 return Smi::FromInt(0);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 DCHECK(is_valid_language_mode(args.smi_at(3))); 441 DCHECK(is_valid_language_mode(args.smi_at(3)));
440 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); 442 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3));
441 DCHECK(args[4]->IsSmi()); 443 DCHECK(args[4]->IsSmi());
442 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), 444 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(),
443 isolate); 445 isolate);
444 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, 446 return CompileGlobalEval(isolate, args.at<String>(1), outer_info,
445 language_mode, args.smi_at(4), args.smi_at(5)); 447 language_mode, args.smi_at(4), args.smi_at(5));
446 } 448 }
447 } // namespace internal 449 } // namespace internal
448 } // namespace v8 450 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/asm/asm-validation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698