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

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

Issue 2687973003: Revert of [Compiler] Enable handles created during parsing and scope analysis to be deferred. (Closed)
Patch Set: 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_;
110 } 111 }
111 112
112 int CompilationInfo::num_parameters() const { 113 int CompilationInfo::num_parameters() const {
113 return !IsStub() ? scope()->num_parameters() : parameter_count_; 114 return !IsStub() ? scope()->num_parameters() : parameter_count_;
114 } 115 }
115 116
116 int CompilationInfo::num_parameters_including_this() const { 117 int CompilationInfo::num_parameters_including_this() const {
117 return num_parameters() + (is_this_defined() ? 1 : 0); 118 return num_parameters() + (is_this_defined() ? 1 : 0);
118 } 119 }
119 120
120 bool CompilationInfo::is_this_defined() const { return !IsStub(); } 121 bool CompilationInfo::is_this_defined() const { return !IsStub(); }
121 122
122 // Primitive functions are unlikely to be picked up by the stack-walking 123 // Primitive functions are unlikely to be picked up by the stack-walking
123 // profiler, so they trigger their own optimization when they're called 124 // profiler, so they trigger their own optimization when they're called
124 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. 125 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time.
125 bool CompilationInfo::ShouldSelfOptimize() { 126 bool CompilationInfo::ShouldSelfOptimize() {
126 return FLAG_opt && FLAG_crankshaft && 127 return FLAG_opt && FLAG_crankshaft &&
127 !(literal()->flags() & AstProperties::kDontSelfOptimize) && 128 !(literal()->flags() & AstProperties::kDontSelfOptimize) &&
128 !literal()->dont_optimize() && 129 !literal()->dont_optimize() &&
129 literal()->scope()->AllowsLazyCompilation() && 130 literal()->scope()->AllowsLazyCompilation() &&
130 !shared_info()->optimization_disabled(); 131 !shared_info()->optimization_disabled();
131 } 132 }
132 133
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
144 void CompilationInfo::ReopenHandlesInNewHandleScope() { 134 void CompilationInfo::ReopenHandlesInNewHandleScope() {
145 if (!closure_.is_null()) { 135 closure_ = Handle<JSFunction>(*closure_);
146 closure_ = Handle<JSFunction>(*closure_);
147 }
148 } 136 }
149 137
150 bool CompilationInfo::has_simple_parameters() { 138 bool CompilationInfo::has_simple_parameters() {
151 return scope()->has_simple_parameters(); 139 return scope()->has_simple_parameters();
152 } 140 }
153 141
154 std::unique_ptr<char[]> CompilationInfo::GetDebugName() const { 142 std::unique_ptr<char[]> CompilationInfo::GetDebugName() const {
155 if (parse_info() && parse_info()->literal()) { 143 if (parse_info() && parse_info()->literal()) {
156 AllowHandleDereference allow_deref; 144 AllowHandleDereference allow_deref;
157 return parse_info()->literal()->debug_name()->ToCString(); 145 return parse_info()->literal()->debug_name()->ToCString();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 inlined_function, handle(inlined_function->code()), pos)); 231 inlined_function, handle(inlined_function->code()), pos));
244 return id; 232 return id;
245 } 233 }
246 234
247 Code::Kind CompilationInfo::output_code_kind() const { 235 Code::Kind CompilationInfo::output_code_kind() const {
248 return Code::ExtractKindFromFlags(code_flags_); 236 return Code::ExtractKindFromFlags(code_flags_);
249 } 237 }
250 238
251 } // namespace internal 239 } // namespace internal
252 } // namespace v8 240 } // 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