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

Side by Side Diff: src/compiler.cc

Issue 1389353002: [interpreter] Make --ignition-filter script filtering explicit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Small reordering. 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/objects.h » ('j') | 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 8
9 #include "src/ast-numbering.h" 9 #include "src/ast-numbering.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 if (!CompileUnoptimizedCode(&info)) return; 1146 if (!CompileUnoptimizedCode(&info)) return;
1147 if (info.has_shared_info()) { 1147 if (info.has_shared_info()) {
1148 Handle<ScopeInfo> scope_info = 1148 Handle<ScopeInfo> scope_info =
1149 ScopeInfo::Create(info.isolate(), info.zone(), info.scope()); 1149 ScopeInfo::Create(info.isolate(), info.zone(), info.scope());
1150 info.shared_info()->set_scope_info(*scope_info); 1150 info.shared_info()->set_scope_info(*scope_info);
1151 } 1151 }
1152 tracker.RecordRootFunctionInfo(info.code()); 1152 tracker.RecordRootFunctionInfo(info.code());
1153 } 1153 }
1154 1154
1155 1155
1156 // Checks whether the passed {raw_filter} is a script filter (i.e. it matches
1157 // the "s:{name}" pattern) and {name} is a prefix of the given scripts name.
1158 // TODO(rmcilroy): Remove filtering once ignition can handle test262 harness.
1159 static bool ScriptPassesFilter(const char* raw_filter, Handle<Script> script) {
1160 if (!script->name()->IsString()) return false;
1161 String* name = String::cast(script->name());
1162 Vector<const char> filter = CStrVector(raw_filter);
1163 if (filter.length() < 2 || filter[0] != 's' || filter[1] != ':') return false;
1164 return name->IsUtf8EqualTo(filter.SubVector(2, filter.length()), true);
1165 }
1166
1167
1156 static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { 1168 static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
1157 Isolate* isolate = info->isolate(); 1169 Isolate* isolate = info->isolate();
1158 PostponeInterruptsScope postpone(isolate); 1170 PostponeInterruptsScope postpone(isolate);
1159 DCHECK(!isolate->native_context().is_null()); 1171 DCHECK(!isolate->native_context().is_null());
1160 ParseInfo* parse_info = info->parse_info(); 1172 ParseInfo* parse_info = info->parse_info();
1161 Handle<Script> script = parse_info->script(); 1173 Handle<Script> script = parse_info->script();
1162 1174
1163 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? 1175 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile?
1164 FixedArray* array = isolate->native_context()->embedder_data(); 1176 FixedArray* array = isolate->native_context()->embedder_data();
1165 script->set_context_data(array->get(v8::Context::kDebugIdIndex)); 1177 script->set_context_data(array->get(v8::Context::kDebugIdIndex));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 LiveEditFunctionTracker live_edit_tracker(isolate, lit); 1220 LiveEditFunctionTracker live_edit_tracker(isolate, lit);
1209 1221
1210 // Measure how long it takes to do the compilation; only take the 1222 // Measure how long it takes to do the compilation; only take the
1211 // rest of the function into account to avoid overlap with the 1223 // rest of the function into account to avoid overlap with the
1212 // parsing statistics. 1224 // parsing statistics.
1213 HistogramTimer* rate = info->is_eval() 1225 HistogramTimer* rate = info->is_eval()
1214 ? info->isolate()->counters()->compile_eval() 1226 ? info->isolate()->counters()->compile_eval()
1215 : info->isolate()->counters()->compile(); 1227 : info->isolate()->counters()->compile();
1216 HistogramTimerScope timer(rate); 1228 HistogramTimerScope timer(rate);
1217 1229
1218 Handle<String> script_name =
1219 script->name()->IsString()
1220 ? Handle<String>(String::cast(script->name()))
1221 : isolate->factory()->empty_string();
1222
1223 // Compile the code. 1230 // Compile the code.
1224 if (FLAG_ignition && script_name->PassesFilter(FLAG_ignition_filter)) { 1231 if (FLAG_ignition && ScriptPassesFilter(FLAG_ignition_filter, script)) {
1225 if (!GenerateBytecode(info)) { 1232 if (!GenerateBytecode(info)) {
1226 return Handle<SharedFunctionInfo>::null(); 1233 return Handle<SharedFunctionInfo>::null();
1227 } 1234 }
1228 } else { 1235 } else {
1229 if (!CompileUnoptimizedCode(info)) { 1236 if (!CompileUnoptimizedCode(info)) {
1230 return Handle<SharedFunctionInfo>::null(); 1237 return Handle<SharedFunctionInfo>::null();
1231 } 1238 }
1232 } 1239 }
1233 1240
1234 // Allocate function. 1241 // Allocate function.
(...skipping 10 matching lines...) Expand all
1245 1252
1246 DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position()); 1253 DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position());
1247 SharedFunctionInfo::InitFromFunctionLiteral(result, lit); 1254 SharedFunctionInfo::InitFromFunctionLiteral(result, lit);
1248 SharedFunctionInfo::SetScript(result, script); 1255 SharedFunctionInfo::SetScript(result, script);
1249 result->set_is_toplevel(true); 1256 result->set_is_toplevel(true);
1250 if (info->is_eval()) { 1257 if (info->is_eval()) {
1251 // Eval scripts cannot be (re-)compiled without context. 1258 // Eval scripts cannot be (re-)compiled without context.
1252 result->set_allows_lazy_compilation_without_context(false); 1259 result->set_allows_lazy_compilation_without_context(false);
1253 } 1260 }
1254 1261
1262 Handle<String> script_name =
1263 script->name()->IsString()
1264 ? Handle<String>(String::cast(script->name()))
1265 : isolate->factory()->empty_string();
1255 Logger::LogEventsAndTags log_tag = info->is_eval() 1266 Logger::LogEventsAndTags log_tag = info->is_eval()
1256 ? Logger::EVAL_TAG 1267 ? Logger::EVAL_TAG
1257 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script); 1268 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script);
1258 1269
1259 PROFILE(isolate, CodeCreateEvent( 1270 PROFILE(isolate, CodeCreateEvent(
1260 log_tag, *info->code(), *result, info, *script_name)); 1271 log_tag, *info->code(), *result, info, *script_name));
1261 1272
1262 // Hint to the runtime system used when allocating space for initial 1273 // Hint to the runtime system used when allocating space for initial
1263 // property space by setting the expected number of properties for 1274 // property space by setting the expected number of properties for
1264 // the instances of the function. 1275 // the instances of the function.
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 } 1791 }
1781 1792
1782 #if DEBUG 1793 #if DEBUG
1783 void CompilationInfo::PrintAstForTesting() { 1794 void CompilationInfo::PrintAstForTesting() {
1784 PrintF("--- Source from AST ---\n%s\n", 1795 PrintF("--- Source from AST ---\n%s\n",
1785 PrettyPrinter(isolate(), zone()).PrintProgram(literal())); 1796 PrettyPrinter(isolate(), zone()).PrintProgram(literal()));
1786 } 1797 }
1787 #endif 1798 #endif
1788 } // namespace internal 1799 } // namespace internal
1789 } // namespace v8 1800 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698