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

Unified Diff: src/compiler.cc

Issue 1396493002: [Interpreter] Add ignition-script-filter flag to filter scripts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix cctests Created 5 years, 2 months 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 | src/flag-definitions.h » ('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 fe2a26aa19d8aa14009de2b0d33db326af81840a..d30b96779a1f0bcb6cd34f4e11e072e4b513daf1 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -694,6 +694,24 @@ static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
}
+// Checks whether top level functions should be passed by {raw_filter}.
+// TODO(rmcilroy): Remove filtering once ignition can handle test262 harness.
+static bool TopLevelFunctionPassesFilter(const char* raw_filter) {
+ Vector<const char> filter = CStrVector(raw_filter);
+ return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*');
+}
+
+
+// Checks whether the passed {raw_filter} is a prefix of the given scripts name.
+// TODO(rmcilroy): Remove filtering once ignition can handle test262 harness.
+static bool ScriptPassesFilter(const char* raw_filter, Handle<Script> script) {
+ Vector<const char> filter = CStrVector(raw_filter);
+ if (!script->name()->IsString()) return filter.length() == 0;
+ String* name = String::cast(script->name());
+ return name->IsUtf8EqualTo(filter, true);
+}
+
+
static bool CompileUnoptimizedCode(CompilationInfo* info) {
DCHECK(AllowCompilation::IsAllowed(info->isolate()));
if (!Compiler::Analyze(info->parse_info()) ||
@@ -731,7 +749,8 @@ MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCodeCommon(
SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
MaybeDisableOptimization(shared, lit->dont_optimize_reason());
- if (FLAG_ignition && info->closure()->PassesFilter(FLAG_ignition_filter)) {
+ if (FLAG_ignition && info->closure()->PassesFilter(FLAG_ignition_filter) &&
+ ScriptPassesFilter(FLAG_ignition_script_filter, info->script())) {
// Compile bytecode for the interpreter.
if (!GenerateBytecode(info)) return MaybeHandle<Code>();
} else {
@@ -1153,18 +1172,6 @@ void Compiler::CompileForLiveEdit(Handle<Script> script) {
}
-// Checks whether the passed {raw_filter} is a script filter (i.e. it matches
-// the "s:{name}" pattern) and {name} is a prefix of the given scripts name.
-// TODO(rmcilroy): Remove filtering once ignition can handle test262 harness.
-static bool ScriptPassesFilter(const char* raw_filter, Handle<Script> script) {
- if (!script->name()->IsString()) return false;
- String* name = String::cast(script->name());
- Vector<const char> filter = CStrVector(raw_filter);
- if (filter.length() < 2 || filter[0] != 's' || filter[1] != ':') return false;
- return name->IsUtf8EqualTo(filter.SubVector(2, filter.length()), true);
-}
-
-
static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
Isolate* isolate = info->isolate();
PostponeInterruptsScope postpone(isolate);
@@ -1228,7 +1235,8 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
HistogramTimerScope timer(rate);
// Compile the code.
- if (FLAG_ignition && ScriptPassesFilter(FLAG_ignition_filter, script)) {
+ if (FLAG_ignition && TopLevelFunctionPassesFilter(FLAG_ignition_filter) &&
+ ScriptPassesFilter(FLAG_ignition_script_filter, script)) {
if (!GenerateBytecode(info)) {
return Handle<SharedFunctionInfo>::null();
}
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698