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

Side by Side Diff: src/compilation-info.cc

Issue 2650883002: Reland: [Compiler] Enable handles created during parsing and scope analysis to be deferred. (Closed)
Patch Set: Remove unused variable Created 3 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
« no previous file with comments | « src/compilation-info.h ('k') | src/compiler.cc » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/compilation-info.h" 5 #include "src/compilation-info.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/debug/debug.h" 10 #include "src/debug/debug.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 parameter_count_(0), 100 parameter_count_(0),
101 optimization_id_(-1), 101 optimization_id_(-1),
102 osr_expr_stack_height_(-1), 102 osr_expr_stack_height_(-1),
103 debug_name_(debug_name) {} 103 debug_name_(debug_name) {}
104 104
105 CompilationInfo::~CompilationInfo() { 105 CompilationInfo::~CompilationInfo() {
106 if (GetFlag(kDisableFutureOptimization) && has_shared_info()) { 106 if (GetFlag(kDisableFutureOptimization) && has_shared_info()) {
107 shared_info()->DisableOptimization(bailout_reason()); 107 shared_info()->DisableOptimization(bailout_reason());
108 } 108 }
109 dependencies()->Rollback(); 109 dependencies()->Rollback();
110 delete deferred_handles_;
111 } 110 }
112 111
113 int CompilationInfo::num_parameters() const { 112 int CompilationInfo::num_parameters() const {
114 return !IsStub() ? scope()->num_parameters() : parameter_count_; 113 return !IsStub() ? scope()->num_parameters() : parameter_count_;
115 } 114 }
116 115
117 int CompilationInfo::num_parameters_including_this() const { 116 int CompilationInfo::num_parameters_including_this() const {
118 return num_parameters() + (is_this_defined() ? 1 : 0); 117 return num_parameters() + (is_this_defined() ? 1 : 0);
119 } 118 }
120 119
121 bool CompilationInfo::is_this_defined() const { return !IsStub(); } 120 bool CompilationInfo::is_this_defined() const { return !IsStub(); }
122 121
123 // Primitive functions are unlikely to be picked up by the stack-walking 122 // Primitive functions are unlikely to be picked up by the stack-walking
124 // profiler, so they trigger their own optimization when they're called 123 // profiler, so they trigger their own optimization when they're called
125 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. 124 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time.
126 bool CompilationInfo::ShouldSelfOptimize() { 125 bool CompilationInfo::ShouldSelfOptimize() {
127 return FLAG_opt && FLAG_crankshaft && 126 return FLAG_opt && FLAG_crankshaft &&
128 !(literal()->flags() & AstProperties::kDontSelfOptimize) && 127 !(literal()->flags() & AstProperties::kDontSelfOptimize) &&
129 !literal()->dont_optimize() && 128 !literal()->dont_optimize() &&
130 literal()->scope()->AllowsLazyCompilation() && 129 literal()->scope()->AllowsLazyCompilation() &&
131 !shared_info()->optimization_disabled(); 130 !shared_info()->optimization_disabled();
132 } 131 }
133 132
133 void CompilationInfo::set_deferred_handles(
134 std::shared_ptr<DeferredHandles> deferred_handles) {
135 DCHECK(deferred_handles_.get() == nullptr);
136 deferred_handles_.swap(deferred_handles);
137 }
138
139 void CompilationInfo::set_deferred_handles(DeferredHandles* deferred_handles) {
140 DCHECK(deferred_handles_.get() == nullptr);
141 deferred_handles_.reset(deferred_handles);
142 }
143
134 void CompilationInfo::ReopenHandlesInNewHandleScope() { 144 void CompilationInfo::ReopenHandlesInNewHandleScope() {
135 closure_ = Handle<JSFunction>(*closure_); 145 if (!closure_.is_null()) {
146 closure_ = Handle<JSFunction>(*closure_);
147 }
136 } 148 }
137 149
138 bool CompilationInfo::has_simple_parameters() { 150 bool CompilationInfo::has_simple_parameters() {
139 return scope()->has_simple_parameters(); 151 return scope()->has_simple_parameters();
140 } 152 }
141 153
142 std::unique_ptr<char[]> CompilationInfo::GetDebugName() const { 154 std::unique_ptr<char[]> CompilationInfo::GetDebugName() const {
143 if (parse_info() && parse_info()->literal()) { 155 if (parse_info() && parse_info()->literal()) {
144 AllowHandleDereference allow_deref; 156 AllowHandleDereference allow_deref;
145 return parse_info()->literal()->debug_name()->ToCString(); 157 return parse_info()->literal()->debug_name()->ToCString();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 inlined_function, handle(inlined_function->code()), pos)); 243 inlined_function, handle(inlined_function->code()), pos));
232 return id; 244 return id;
233 } 245 }
234 246
235 Code::Kind CompilationInfo::output_code_kind() const { 247 Code::Kind CompilationInfo::output_code_kind() const {
236 return Code::ExtractKindFromFlags(code_flags_); 248 return Code::ExtractKindFromFlags(code_flags_);
237 } 249 }
238 250
239 } // namespace internal 251 } // namespace internal
240 } // namespace v8 252 } // namespace v8
OLDNEW
« no previous file with comments | « src/compilation-info.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698