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

Unified Diff: src/compiler.cc

Issue 2573193002: [wasm] disable serialization for asm-wasm (Closed)
Patch Set: Comment 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 | test/mjsunit/regress/wasm/regression-643595.js » ('j') | 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 c3361de7176777fcfc5bb4c7419ad9be287699cf..b8fbbcfa2c31dea9d7fc002d6dcc7389d096ee65 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -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
Yang 2016/12/15 05:41:09 I think this can be done a lot easier. We have all
+ 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,
« no previous file with comments | « no previous file | test/mjsunit/regress/wasm/regression-643595.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698