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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler.h" 5 #include "src/compiler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/asmjs/asm-js.h" 10 #include "src/asmjs/asm-js.h"
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 if (callback == NULL) { 1338 if (callback == NULL) {
1339 // No callback set and code generation disallowed. 1339 // No callback set and code generation disallowed.
1340 return false; 1340 return false;
1341 } else { 1341 } else {
1342 // Callback set. Let it decide if code generation is allowed. 1342 // Callback set. Let it decide if code generation is allowed.
1343 VMState<EXTERNAL> state(isolate); 1343 VMState<EXTERNAL> state(isolate);
1344 return callback(v8::Utils::ToLocal(context)); 1344 return callback(v8::Utils::ToLocal(context));
1345 } 1345 }
1346 } 1346 }
1347 1347
1348 bool ContainsAsmModule(Handle<Script> script) { 1348 bool ContainsAsmModule(const Scope* scope, Zone* zone) {
1349 WeakFixedArray::Iterator iter(script->shared_function_infos()); 1349 DCHECK_NOT_NULL(scope);
1350 DisallowHeapAllocation no_gc; 1350 DCHECK_NOT_NULL(zone);
1351 1351 ZoneQueue<const Scope*> worklist(zone);
1352 while (SharedFunctionInfo* info = iter.Next<SharedFunctionInfo>()) { 1352 // We assume scopes form a tree, so no need to check for cycles
1353 if (info->HasAsmWasmData()) return true; 1353 worklist.push(scope);
1354 while (!worklist.empty()) {
1355 const Scope* s = worklist.front();
1356 worklist.pop();
1357 if (s->IsAsmModule()) {
1358 return true;
1359 }
1360 for (const Scope* child = s->inner_scope(); child != nullptr;
1361 child = child->sibling()) {
1362 worklist.push(child);
1363 }
1354 } 1364 }
1355 return false; 1365 return false;
1356 } 1366 }
1357 1367
1358 } // namespace 1368 } // namespace
1359 1369
1360 MaybeHandle<JSFunction> Compiler::GetFunctionFromString( 1370 MaybeHandle<JSFunction> Compiler::GetFunctionFromString(
1361 Handle<Context> context, Handle<String> source, 1371 Handle<Context> context, Handle<String> source,
1362 ParseRestriction restriction) { 1372 ParseRestriction restriction) {
1363 Isolate* const isolate = context->GetIsolate(); 1373 Isolate* const isolate = context->GetIsolate();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 info.PrepareForSerializing(); 1500 info.PrepareForSerializing();
1491 } 1501 }
1492 1502
1493 parse_info.set_language_mode( 1503 parse_info.set_language_mode(
1494 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); 1504 static_cast<LanguageMode>(parse_info.language_mode() | language_mode));
1495 result = CompileToplevel(&info); 1505 result = CompileToplevel(&info);
1496 if (extension == NULL && !result.is_null()) { 1506 if (extension == NULL && !result.is_null()) {
1497 compilation_cache->PutScript(source, context, language_mode, result); 1507 compilation_cache->PutScript(source, context, language_mode, result);
1498 if (FLAG_serialize_toplevel && 1508 if (FLAG_serialize_toplevel &&
1499 compile_options == ScriptCompiler::kProduceCodeCache && 1509 compile_options == ScriptCompiler::kProduceCodeCache &&
1500 !ContainsAsmModule(script)) { 1510 !ContainsAsmModule(info.scope(), &zone)) {
1501 HistogramTimerScope histogram_timer( 1511 HistogramTimerScope histogram_timer(
1502 isolate->counters()->compile_serialize()); 1512 isolate->counters()->compile_serialize());
1503 RuntimeCallTimerScope runtimeTimer(isolate, 1513 RuntimeCallTimerScope runtimeTimer(isolate,
1504 &RuntimeCallStats::CompileSerialize); 1514 &RuntimeCallStats::CompileSerialize);
1505 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), 1515 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
1506 "V8.CompileSerialize"); 1516 "V8.CompileSerialize");
1507 *cached_data = CodeSerializer::Serialize(isolate, result, source); 1517 *cached_data = CodeSerializer::Serialize(isolate, result, source);
1508 if (FLAG_profile_deserialization) { 1518 if (FLAG_profile_deserialization) {
1509 PrintF("[Compiling and serializing took %0.3f ms]\n", 1519 PrintF("[Compiling and serializing took %0.3f ms]\n",
1510 timer.Elapsed().InMillisecondsF()); 1520 timer.Elapsed().InMillisecondsF());
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 DCHECK(shared->is_compiled()); 1746 DCHECK(shared->is_compiled());
1737 function->set_literals(cached.literals); 1747 function->set_literals(cached.literals);
1738 } else if (shared->is_compiled()) { 1748 } else if (shared->is_compiled()) {
1739 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1749 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1740 JSFunction::EnsureLiterals(function); 1750 JSFunction::EnsureLiterals(function);
1741 } 1751 }
1742 } 1752 }
1743 1753
1744 } // namespace internal 1754 } // namespace internal
1745 } // namespace v8 1755 } // namespace v8
OLDNEW
« 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