[Interpreter] Add ignition-script-filter flag to filter scripts.
Add a flag to explicitly filter scripts in ignition and use it for the test262 variant. The previous approach of overloading ignition-filter meant that only top-level code was getting compiled through ignition. BUG=v8:4280 LOG=N Review URL: https://codereview.chromium.org/1396493002 Cr-Commit-Position: refs/heads/master@{#31164}
This commit is contained in:
parent
93ae81101a
commit
6e64a057e3
@ -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();
|
||||
}
|
||||
|
@ -285,6 +285,8 @@ DEFINE_BOOL(string_slices, true, "use string slices")
|
||||
DEFINE_BOOL(ignition, false, "use ignition interpreter")
|
||||
DEFINE_IMPLICATION(ignition, vector_stores)
|
||||
DEFINE_STRING(ignition_filter, "~~", "filter for ignition interpreter")
|
||||
DEFINE_STRING(ignition_script_filter, "",
|
||||
"script filter for ignition interpreter")
|
||||
DEFINE_BOOL(print_bytecode, false,
|
||||
"print bytecode generated by ignition interpreter")
|
||||
DEFINE_BOOL(trace_ignition_codegen, false,
|
||||
|
@ -107,7 +107,7 @@ class Test262TestSuite(testsuite.TestSuite):
|
||||
self.harness = [os.path.join(self.harnesspath, f)
|
||||
for f in TEST_262_HARNESS_FILES]
|
||||
self.harness += [os.path.join(self.root, "harness-adapt.js")]
|
||||
self.ignition_filter = "--ignition-filter=s:" + self.testroot
|
||||
self.ignition_script_filter = "--ignition-script-filter=" + self.testroot
|
||||
self.ParseTestRecord = None
|
||||
|
||||
def ListTests(self, context):
|
||||
@ -131,8 +131,9 @@ class Test262TestSuite(testsuite.TestSuite):
|
||||
def GetFlagsForTestCase(self, testcase, context):
|
||||
# TODO(rmcilroy) Remove ignition filter modification once ignition can
|
||||
# support the test262 test harness code.
|
||||
flags = [ self.ignition_filter if "ignition-filter" in flag else flag
|
||||
for flag in testcase.flags]
|
||||
flags = testcase.flags
|
||||
if '--ignition' in flags:
|
||||
flags += [self.ignition_script_filter]
|
||||
|
||||
return (flags + context.mode_flags + self.harness +
|
||||
self.GetIncludesForTest(testcase) + ["--harmony"] +
|
||||
|
Loading…
Reference in New Issue
Block a user