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

Unified Diff: src/compiler.cc

Issue 2582583002: [wasm] simpler detection if we compiled asm-wasm (Closed)
Patch Set: using new iterator 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 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,
« 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