[wasm] disable serialization for asm-wasm
Determine if the scope of the function to be serialized includes asm- wasm, and if so, bypass serialization, since we do not support it in that scenario. In this change, we do so regardless of whether the asm-wasm path was successful. This is so we keep the design simple, since the guidance to developers, moving forward, is to use wasm. BUG=643595 Review-Url: https://codereview.chromium.org/2573193002 Cr-Commit-Position: refs/heads/master@{#41704}
This commit is contained in:
parent
37253381e2
commit
77b50a8e12
@ -1345,6 +1345,26 @@ bool CodeGenerationFromStringsAllowed(Isolate* isolate,
|
||||
}
|
||||
}
|
||||
|
||||
bool ContainsAsmModule(const Scope* scope, Zone* zone) {
|
||||
DCHECK_NOT_NULL(scope);
|
||||
DCHECK_NOT_NULL(zone);
|
||||
ZoneQueue<const Scope*> worklist(zone);
|
||||
// We assume scopes form a tree, so no need to check for cycles
|
||||
worklist.push(scope);
|
||||
while (!worklist.empty()) {
|
||||
const Scope* s = worklist.front();
|
||||
worklist.pop();
|
||||
if (s->IsAsmModule()) {
|
||||
return true;
|
||||
}
|
||||
for (const Scope* child = s->inner_scope(); child != nullptr;
|
||||
child = child->sibling()) {
|
||||
worklist.push(child);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
MaybeHandle<JSFunction> Compiler::GetFunctionFromString(
|
||||
@ -1486,7 +1506,8 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
|
||||
if (extension == NULL && !result.is_null()) {
|
||||
compilation_cache->PutScript(source, context, language_mode, result);
|
||||
if (FLAG_serialize_toplevel &&
|
||||
compile_options == ScriptCompiler::kProduceCodeCache) {
|
||||
compile_options == ScriptCompiler::kProduceCodeCache &&
|
||||
!ContainsAsmModule(info.scope(), &zone)) {
|
||||
HistogramTimerScope histogram_timer(
|
||||
isolate->counters()->compile_serialize());
|
||||
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||
|
11
test/mjsunit/regress/wasm/regression-643595.js
Normal file
11
test/mjsunit/regress/wasm/regression-643595.js
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2016 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// Flags: --cache=code --validate-asm
|
||||
|
||||
(function f() {
|
||||
"use asm";
|
||||
function g() { }
|
||||
return { g: g };
|
||||
})();
|
Loading…
Reference in New Issue
Block a user