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

Side by Side Diff: src/compiler.cc

Issue 151163005: A64: Synchronize with r16356. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler.h ('k') | src/cpu.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 364 }
365 365
366 const int locals_limit = LUnallocated::kMaxFixedSlotIndex; 366 const int locals_limit = LUnallocated::kMaxFixedSlotIndex;
367 if (!info()->osr_ast_id().IsNone() && 367 if (!info()->osr_ast_id().IsNone() &&
368 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit) { 368 scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit) {
369 info()->set_bailout_reason(kTooManyParametersLocals); 369 info()->set_bailout_reason(kTooManyParametersLocals);
370 return AbortOptimization(); 370 return AbortOptimization();
371 } 371 }
372 372
373 // Take --hydrogen-filter into account. 373 // Take --hydrogen-filter into account.
374 if (!info()->closure()->PassesHydrogenFilter()) { 374 if (!info()->closure()->PassesFilter(FLAG_hydrogen_filter)) {
375 info()->AbortOptimization(); 375 info()->AbortOptimization();
376 return SetLastStatus(BAILED_OUT); 376 return SetLastStatus(BAILED_OUT);
377 } 377 }
378 378
379 // Recompile the unoptimized version of the code if the current version 379 // Recompile the unoptimized version of the code if the current version
380 // doesn't have deoptimization support. Alternatively, we may decide to 380 // doesn't have deoptimization support. Alternatively, we may decide to
381 // run the full code generator to get a baseline for the compile-time 381 // run the full code generator to get a baseline for the compile-time
382 // performance of the hydrogen-based compiler. 382 // performance of the hydrogen-based compiler.
383 bool should_recompile = !info()->shared_info()->has_deoptimization_support(); 383 bool should_recompile = !info()->shared_info()->has_deoptimization_support();
384 if (should_recompile || FLAG_hydrogen_stats) { 384 if (should_recompile || FLAG_hydrogen_stats) {
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 return InstallFullCode(info); 967 return InstallFullCode(info);
968 } 968 }
969 } 969 }
970 } 970 }
971 971
972 ASSERT(info->code().is_null()); 972 ASSERT(info->code().is_null());
973 return false; 973 return false;
974 } 974 }
975 975
976 976
977 void Compiler::RecompileParallel(Handle<JSFunction> closure) { 977 void Compiler::RecompileConcurrent(Handle<JSFunction> closure) {
978 ASSERT(closure->IsMarkedForParallelRecompilation()); 978 ASSERT(closure->IsMarkedForConcurrentRecompilation());
979 979
980 Isolate* isolate = closure->GetIsolate(); 980 Isolate* isolate = closure->GetIsolate();
981 // Here we prepare compile data for the parallel recompilation thread, but 981 // Here we prepare compile data for the concurrent recompilation thread, but
982 // this still happens synchronously and interrupts execution. 982 // this still happens synchronously and interrupts execution.
983 Logger::TimerEventScope timer( 983 Logger::TimerEventScope timer(
984 isolate, Logger::TimerEventScope::v8_recompile_synchronous); 984 isolate, Logger::TimerEventScope::v8_recompile_synchronous);
985 985
986 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { 986 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) {
987 if (FLAG_trace_parallel_recompilation) { 987 if (FLAG_trace_concurrent_recompilation) {
988 PrintF(" ** Compilation queue full, will retry optimizing "); 988 PrintF(" ** Compilation queue full, will retry optimizing ");
989 closure->PrintName(); 989 closure->PrintName();
990 PrintF(" on next run.\n"); 990 PrintF(" on next run.\n");
991 } 991 }
992 return; 992 return;
993 } 993 }
994 994
995 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); 995 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure));
996 VMState<COMPILER> state(isolate); 996 VMState<COMPILER> state(isolate);
997 PostponeInterruptsScope postpone(isolate); 997 PostponeInterruptsScope postpone(isolate);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 } 1048 }
1049 1049
1050 1050
1051 void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) { 1051 void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) {
1052 SmartPointer<CompilationInfo> info(optimizing_compiler->info()); 1052 SmartPointer<CompilationInfo> info(optimizing_compiler->info());
1053 // The function may have already been optimized by OSR. Simply continue. 1053 // The function may have already been optimized by OSR. Simply continue.
1054 // Except when OSR already disabled optimization for some reason. 1054 // Except when OSR already disabled optimization for some reason.
1055 if (info->shared_info()->optimization_disabled()) { 1055 if (info->shared_info()->optimization_disabled()) {
1056 info->AbortOptimization(); 1056 info->AbortOptimization();
1057 InstallFullCode(*info); 1057 InstallFullCode(*info);
1058 if (FLAG_trace_parallel_recompilation) { 1058 if (FLAG_trace_concurrent_recompilation) {
1059 PrintF(" ** aborting optimization for "); 1059 PrintF(" ** aborting optimization for ");
1060 info->closure()->PrintName(); 1060 info->closure()->PrintName();
1061 PrintF(" as it has been disabled.\n"); 1061 PrintF(" as it has been disabled.\n");
1062 } 1062 }
1063 ASSERT(!info->closure()->IsMarkedForInstallingRecompiledCode()); 1063 ASSERT(!info->closure()->IsMarkedForInstallingRecompiledCode());
1064 return; 1064 return;
1065 } 1065 }
1066 1066
1067 Isolate* isolate = info->isolate(); 1067 Isolate* isolate = info->isolate();
1068 VMState<COMPILER> state(isolate); 1068 VMState<COMPILER> state(isolate);
(...skipping 19 matching lines...) Expand all
1088 1088
1089 InstallCodeCommon(*info); 1089 InstallCodeCommon(*info);
1090 if (status == OptimizingCompiler::SUCCEEDED) { 1090 if (status == OptimizingCompiler::SUCCEEDED) {
1091 Handle<Code> code = info->code(); 1091 Handle<Code> code = info->code();
1092 ASSERT(info->shared_info()->scope_info() != ScopeInfo::Empty(isolate)); 1092 ASSERT(info->shared_info()->scope_info() != ScopeInfo::Empty(isolate));
1093 info->closure()->ReplaceCode(*code); 1093 info->closure()->ReplaceCode(*code);
1094 if (info->shared_info()->SearchOptimizedCodeMap( 1094 if (info->shared_info()->SearchOptimizedCodeMap(
1095 info->closure()->context()->native_context()) == -1) { 1095 info->closure()->context()->native_context()) == -1) {
1096 InsertCodeIntoOptimizedCodeMap(*info); 1096 InsertCodeIntoOptimizedCodeMap(*info);
1097 } 1097 }
1098 if (FLAG_trace_parallel_recompilation) { 1098 if (FLAG_trace_concurrent_recompilation) {
1099 PrintF(" ** Optimized code for "); 1099 PrintF(" ** Optimized code for ");
1100 info->closure()->PrintName(); 1100 info->closure()->PrintName();
1101 PrintF(" installed.\n"); 1101 PrintF(" installed.\n");
1102 } 1102 }
1103 } else { 1103 } else {
1104 info->AbortOptimization(); 1104 info->AbortOptimization();
1105 InstallFullCode(*info); 1105 InstallFullCode(*info);
1106 } 1106 }
1107 // Optimized code is finally replacing unoptimized code. Reset the latter's 1107 // Optimized code is finally replacing unoptimized code. Reset the latter's
1108 // profiler ticks to prevent too soon re-opt after a deopt. 1108 // profiler ticks to prevent too soon re-opt after a deopt.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 // Log the code generation. If source information is available include 1211 // Log the code generation. If source information is available include
1212 // script name and line number. Check explicitly whether logging is 1212 // script name and line number. Check explicitly whether logging is
1213 // enabled as finding the line number is not free. 1213 // enabled as finding the line number is not free.
1214 if (info->isolate()->logger()->is_logging_code_events() || 1214 if (info->isolate()->logger()->is_logging_code_events() ||
1215 info->isolate()->cpu_profiler()->is_profiling()) { 1215 info->isolate()->cpu_profiler()->is_profiling()) {
1216 Handle<Script> script = info->script(); 1216 Handle<Script> script = info->script();
1217 Handle<Code> code = info->code(); 1217 Handle<Code> code = info->code();
1218 if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) 1218 if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile))
1219 return; 1219 return;
1220 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; 1220 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1;
1221 int column_num =
1222 GetScriptColumnNumber(script, shared->start_position()) + 1;
1221 USE(line_num); 1223 USE(line_num);
1222 if (script->name()->IsString()) { 1224 if (script->name()->IsString()) {
1223 PROFILE(info->isolate(), 1225 PROFILE(info->isolate(),
1224 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), 1226 CodeCreateEvent(Logger::ToNativeByScript(tag, *script),
1225 *code, 1227 *code,
1226 *shared, 1228 *shared,
1227 info, 1229 info,
1228 String::cast(script->name()), 1230 String::cast(script->name()),
1229 line_num)); 1231 line_num,
1232 column_num));
1230 } else { 1233 } else {
1231 PROFILE(info->isolate(), 1234 PROFILE(info->isolate(),
1232 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), 1235 CodeCreateEvent(Logger::ToNativeByScript(tag, *script),
1233 *code, 1236 *code,
1234 *shared, 1237 *shared,
1235 info, 1238 info,
1236 info->isolate()->heap()->empty_string(), 1239 info->isolate()->heap()->empty_string(),
1237 line_num)); 1240 line_num,
1241 column_num));
1238 } 1242 }
1239 } 1243 }
1240 1244
1241 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 1245 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
1242 Handle<Script>(info->script()), 1246 Handle<Script>(info->script()),
1243 Handle<Code>(info->code()), 1247 Handle<Code>(info->code()),
1244 info)); 1248 info));
1245 } 1249 }
1246 1250
1247 1251
(...skipping 12 matching lines...) Expand all
1260 size += info_->zone()->allocation_size() - info_zone_start_allocation_size_; 1264 size += info_->zone()->allocation_size() - info_zone_start_allocation_size_;
1261 int64_t ticks = OS::Ticks() - start_ticks_; 1265 int64_t ticks = OS::Ticks() - start_ticks_;
1262 isolate()->GetHStatistics()->SaveTiming(name_, ticks, size); 1266 isolate()->GetHStatistics()->SaveTiming(name_, ticks, size);
1263 } 1267 }
1264 } 1268 }
1265 1269
1266 1270
1267 bool CompilationPhase::ShouldProduceTraceOutput() const { 1271 bool CompilationPhase::ShouldProduceTraceOutput() const {
1268 // Trace if the appropriate trace flag is set and the phase name's first 1272 // Trace if the appropriate trace flag is set and the phase name's first
1269 // character is in the FLAG_trace_phase command line parameter. 1273 // character is in the FLAG_trace_phase command line parameter.
1270 bool tracing_on = info()->IsStub() ? 1274 AllowHandleDereference allow_deref;
1271 FLAG_trace_hydrogen_stubs : 1275 bool tracing_on = info()->IsStub()
1272 FLAG_trace_hydrogen; 1276 ? FLAG_trace_hydrogen_stubs
1277 : (FLAG_trace_hydrogen &&
1278 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1273 return (tracing_on && 1279 return (tracing_on &&
1274 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1280 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1275 } 1281 }
1276 1282
1277 } } // namespace v8::internal 1283 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/cpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698