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

Side by Side Diff: src/compiler.cc

Issue 12832002: Parallel recompilation: fewer handle dereferences and tighter checks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 9 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/code-stubs-hydrogen.cc ('k') | src/execution.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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return AbortOptimization(); 389 return AbortOptimization();
390 } 390 }
391 } 391 }
392 392
393 return SetLastStatus(SUCCEEDED); 393 return SetLastStatus(SUCCEEDED);
394 } 394 }
395 395
396 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() { 396 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() {
397 AssertNoAllocation no_gc; 397 AssertNoAllocation no_gc;
398 NoHandleAllocation no_handles(isolate()); 398 NoHandleAllocation no_handles(isolate());
399 NoHandleDereference no_deref(isolate()); 399 HandleDereferenceGuard no_deref(isolate(), HandleDereferenceGuard::DISALLOW);
400 400
401 ASSERT(last_status() == SUCCEEDED); 401 ASSERT(last_status() == SUCCEEDED);
402 Timer t(this, &time_taken_to_optimize_); 402 Timer t(this, &time_taken_to_optimize_);
403 ASSERT(graph_ != NULL); 403 ASSERT(graph_ != NULL);
404 SmartArrayPointer<char> bailout_reason; 404 SmartArrayPointer<char> bailout_reason;
405 if (!graph_->Optimize(&bailout_reason)) { 405 if (!graph_->Optimize(&bailout_reason)) {
406 if (!bailout_reason.is_empty()) graph_builder_->Bailout(*bailout_reason); 406 if (!bailout_reason.is_empty()) graph_builder_->Bailout(*bailout_reason);
407 return SetLastStatus(BAILED_OUT); 407 return SetLastStatus(BAILED_OUT);
408 } else { 408 } else {
409 chunk_ = LChunk::NewChunk(graph_); 409 chunk_ = LChunk::NewChunk(graph_);
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 LanguageMode language_mode = info->function()->language_mode(); 936 LanguageMode language_mode = info->function()->language_mode();
937 info->SetLanguageMode(language_mode); 937 info->SetLanguageMode(language_mode);
938 shared->set_language_mode(language_mode); 938 shared->set_language_mode(language_mode);
939 info->SaveHandles(); 939 info->SaveHandles();
940 940
941 if (Rewriter::Rewrite(*info) && Scope::Analyze(*info)) { 941 if (Rewriter::Rewrite(*info) && Scope::Analyze(*info)) {
942 OptimizingCompiler* compiler = 942 OptimizingCompiler* compiler =
943 new(info->zone()) OptimizingCompiler(*info); 943 new(info->zone()) OptimizingCompiler(*info);
944 OptimizingCompiler::Status status = compiler->CreateGraph(); 944 OptimizingCompiler::Status status = compiler->CreateGraph();
945 if (status == OptimizingCompiler::SUCCEEDED) { 945 if (status == OptimizingCompiler::SUCCEEDED) {
946 // Do a scavenge to put off the next scavenge as far as possible.
947 // This may ease the issue that GVN blocks the next scavenge.
948 isolate->heap()->CollectGarbage(NEW_SPACE, "parallel recompile");
946 closure->MarkInRecompileQueue(); 949 closure->MarkInRecompileQueue();
947 shared->code()->set_profiler_ticks(0); 950 shared->code()->set_profiler_ticks(0);
948 info.Detach(); 951 info.Detach();
949 isolate->optimizing_compiler_thread()->QueueForOptimization(compiler); 952 isolate->optimizing_compiler_thread()->QueueForOptimization(compiler);
950 } else if (status == OptimizingCompiler::BAILED_OUT) { 953 } else if (status == OptimizingCompiler::BAILED_OUT) {
951 isolate->clear_pending_exception(); 954 isolate->clear_pending_exception();
952 InstallFullCode(*info); 955 InstallFullCode(*info);
953 } 956 }
954 } 957 }
955 } 958 }
(...skipping 13 matching lines...) Expand all
969 *replacement_code); 972 *replacement_code);
970 } 973 }
971 974
972 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); 975 if (isolate->has_pending_exception()) isolate->clear_pending_exception();
973 } 976 }
974 977
975 978
976 void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) { 979 void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) {
977 SmartPointer<CompilationInfo> info(optimizing_compiler->info()); 980 SmartPointer<CompilationInfo> info(optimizing_compiler->info());
978 ASSERT(info->closure()->IsMarkedForInstallingRecompiledCode()); 981 ASSERT(info->closure()->IsMarkedForInstallingRecompiledCode());
982 // While waiting for the optimizer thread, OSR may have already done all
983 // the work and disabled optimization of this function for some reason.
984 if (info->shared_info()->optimization_disabled()) {
985 info->SetCode(Handle<Code>(info->shared_info()->code()));
986 InstallFullCode(*info);
987 return;
988 }
979 989
980 Isolate* isolate = info->isolate(); 990 Isolate* isolate = info->isolate();
981 VMState state(isolate, PARALLEL_COMPILER); 991 VMState state(isolate, PARALLEL_COMPILER);
982 Logger::TimerEventScope timer( 992 Logger::TimerEventScope timer(
983 isolate, Logger::TimerEventScope::v8_recompile_synchronous); 993 isolate, Logger::TimerEventScope::v8_recompile_synchronous);
984 // If crankshaft succeeded, install the optimized code else install 994 // If crankshaft succeeded, install the optimized code else install
985 // the unoptimized code. 995 // the unoptimized code.
986 OptimizingCompiler::Status status = optimizing_compiler->last_status(); 996 OptimizingCompiler::Status status = optimizing_compiler->last_status();
987 if (status != OptimizingCompiler::SUCCEEDED) { 997 if (status != OptimizingCompiler::SUCCEEDED) {
988 optimizing_compiler->info()->set_bailout_reason( 998 optimizing_compiler->info()->set_bailout_reason(
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 } 1152 }
1143 } 1153 }
1144 1154
1145 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 1155 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
1146 Handle<Script>(info->script()), 1156 Handle<Script>(info->script()),
1147 Handle<Code>(info->code()), 1157 Handle<Code>(info->code()),
1148 info)); 1158 info));
1149 } 1159 }
1150 1160
1151 } } // namespace v8::internal 1161 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/execution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698