[compiler] Don't canonicalize handles in Crankshaft.

R=mstarzinger@chromium.org
BUG=v8:5309

Review-Url: https://codereview.chromium.org/2274253003
Cr-Commit-Position: refs/heads/master@{#38903}
This commit is contained in:
bmeurer 2016-08-25 04:56:13 -07:00 committed by Commit bot
parent ede28d900c
commit b550c07734

View File

@ -66,7 +66,7 @@ PARSE_INFO_GETTER(Handle<SharedFunctionInfo>, shared_info)
// A wrapper around a CompilationInfo that detaches the Handles from // A wrapper around a CompilationInfo that detaches the Handles from
// the underlying DeferredHandleScope and stores them in info_ on // the underlying DeferredHandleScope and stores them in info_ on
// destruction. // destruction.
class CompilationHandleScope BASE_EMBEDDED { class CompilationHandleScope final {
public: public:
explicit CompilationHandleScope(CompilationInfo* info) explicit CompilationHandleScope(CompilationInfo* info)
: deferred_(info->isolate()), info_(info) {} : deferred_(info->isolate()), info_(info) {}
@ -698,9 +698,6 @@ bool GetOptimizedCodeNow(CompilationJob* job) {
CompilationInfo* info = job->info(); CompilationInfo* info = job->info();
Isolate* isolate = info->isolate(); Isolate* isolate = info->isolate();
// All handles below this point will be canonicalized.
CanonicalHandleScope canonical(isolate);
// Parsing is not required when optimizing from existing bytecode. // Parsing is not required when optimizing from existing bytecode.
if (!info->is_optimizing_from_bytecode()) { if (!info->is_optimizing_from_bytecode()) {
if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; if (!Compiler::ParseAndAnalyze(info->parse_info())) return false;
@ -709,10 +706,6 @@ bool GetOptimizedCodeNow(CompilationJob* job) {
JSFunction::EnsureLiterals(info->closure()); JSFunction::EnsureLiterals(info->closure());
// Reopen handles in the new CompilationHandleScope.
info->ReopenHandlesInNewHandleScope();
info->parse_info()->ReopenHandlesInNewHandleScope();
TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); TimerEventScope<TimerEventRecompileSynchronous> timer(isolate);
RuntimeCallTimerScope runtimeTimer(isolate, RuntimeCallTimerScope runtimeTimer(isolate,
&RuntimeCallStats::RecompileSynchronous); &RuntimeCallStats::RecompileSynchronous);
@ -760,12 +753,6 @@ bool GetOptimizedCodeLater(CompilationJob* job) {
return false; return false;
} }
// All handles below this point will be canonicalized and allocated in a
// deferred handle scope that is detached and handed off to the background
// thread when we return.
CompilationHandleScope handle_scope(info);
CanonicalHandleScope canonical(isolate);
// Parsing is not required when optimizing from existing bytecode. // Parsing is not required when optimizing from existing bytecode.
if (!info->is_optimizing_from_bytecode()) { if (!info->is_optimizing_from_bytecode()) {
if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; if (!Compiler::ParseAndAnalyze(info->parse_info())) return false;
@ -774,10 +761,6 @@ bool GetOptimizedCodeLater(CompilationJob* job) {
JSFunction::EnsureLiterals(info->closure()); JSFunction::EnsureLiterals(info->closure());
// Reopen handles in the new CompilationHandleScope.
info->ReopenHandlesInNewHandleScope();
info->parse_info()->ReopenHandlesInNewHandleScope();
TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate());
RuntimeCallTimerScope runtimeTimer(info->isolate(), RuntimeCallTimerScope runtimeTimer(info->isolate(),
&RuntimeCallStats::RecompileSynchronous); &RuntimeCallStats::RecompileSynchronous);
@ -879,6 +862,22 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
parse_info->set_lazy(false); parse_info->set_lazy(false);
} }
// In case of concurrent recompilation, all handles below this point will be
// allocated in a deferred handle scope that is detached and handed off to
// the background thread when we return.
std::unique_ptr<CompilationHandleScope> compilation;
if (mode == Compiler::CONCURRENT) {
compilation.reset(new CompilationHandleScope(info));
}
// In case of TurboFan, all handles below will be canonicalized.
std::unique_ptr<CanonicalHandleScope> canonical;
if (use_turbofan) canonical.reset(new CanonicalHandleScope(info->isolate()));
// Reopen handles in the new CompilationHandleScope.
info->ReopenHandlesInNewHandleScope();
parse_info->ReopenHandlesInNewHandleScope();
if (mode == Compiler::CONCURRENT) { if (mode == Compiler::CONCURRENT) {
if (GetOptimizedCodeLater(job.get())) { if (GetOptimizedCodeLater(job.get())) {
job.release(); // The background recompile job owns this now. job.release(); // The background recompile job owns this now.