[wasm] simpler detection if we compiled asm-wasm

BUG=643595

Review-Url: https://codereview.chromium.org/2582583002
Cr-Original-Commit-Position: refs/heads/master@{#41738}
Committed: cb433bed0b
Review-Url: https://codereview.chromium.org/2582583002
Cr-Commit-Position: refs/heads/master@{#41743}
This commit is contained in:
mtrofin 2016-12-15 22:13:30 -08:00 committed by Commit bot
parent 7333663dc9
commit 93e53da4c8

View File

@ -1366,22 +1366,11 @@ 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);
}
bool ContainsAsmModule(Handle<Script> script) {
DisallowHeapAllocation no_gc;
SharedFunctionInfo::ScriptIterator iter(script);
while (SharedFunctionInfo* info = iter.Next()) {
if (info->HasAsmWasmData()) return true;
}
return false;
}
@ -1528,7 +1517,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
compilation_cache->PutScript(source, context, language_mode, result);
if (FLAG_serialize_toplevel &&
compile_options == ScriptCompiler::kProduceCodeCache &&
!ContainsAsmModule(info.scope(), &zone)) {
!ContainsAsmModule(script)) {
HistogramTimerScope histogram_timer(
isolate->counters()->compile_serialize());
RuntimeCallTimerScope runtimeTimer(isolate,