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

Unified Diff: src/compiler.cc

Issue 2582623002: Revert of [wasm] simpler detection if we compiled asm-wasm (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index ba62de6298abb5cf8d65923e2889ec7358e3c6ee..b8fbbcfa2c31dea9d7fc002d6dcc7389d096ee65 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -1345,12 +1345,22 @@
}
}
-bool ContainsAsmModule(Handle<Script> script) {
- WeakFixedArray::Iterator iter(script->shared_function_infos());
- DisallowHeapAllocation no_gc;
-
- while (SharedFunctionInfo* info = iter.Next<SharedFunctionInfo>()) {
- if (info->HasAsmWasmData()) return true;
+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;
}
@@ -1497,7 +1507,7 @@
compilation_cache->PutScript(source, context, language_mode, result);
if (FLAG_serialize_toplevel &&
compile_options == ScriptCompiler::kProduceCodeCache &&
- !ContainsAsmModule(script)) {
+ !ContainsAsmModule(info.scope(), &zone)) {
HistogramTimerScope histogram_timer(
isolate->counters()->compile_serialize());
RuntimeCallTimerScope runtimeTimer(isolate,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698