Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index da440f019c18dd190e8eaa8afe5e13384a0c5aaa..a45d7aacc9679079ac36e6efcd14557f63600057 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -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, |