| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_COMPILER_H_ | 5 #ifndef V8_COMPILER_H_ |
| 6 #define V8_COMPILER_H_ | 6 #define V8_COMPILER_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/ast.h" | 9 #include "src/ast.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 Zone* zone() { return zone_; } | 156 Zone* zone() { return zone_; } |
| 157 bool is_osr() const { return !osr_ast_id_.IsNone(); } | 157 bool is_osr() const { return !osr_ast_id_.IsNone(); } |
| 158 Handle<Code> code() const { return code_; } | 158 Handle<Code> code() const { return code_; } |
| 159 CodeStub* code_stub() const { return code_stub_; } | 159 CodeStub* code_stub() const { return code_stub_; } |
| 160 BailoutId osr_ast_id() const { return osr_ast_id_; } | 160 BailoutId osr_ast_id() const { return osr_ast_id_; } |
| 161 Handle<Code> unoptimized_code() const { return unoptimized_code_; } | 161 Handle<Code> unoptimized_code() const { return unoptimized_code_; } |
| 162 int opt_count() const { return opt_count_; } | 162 int opt_count() const { return opt_count_; } |
| 163 int num_parameters() const; | 163 int num_parameters() const; |
| 164 int num_heap_slots() const; | 164 int num_heap_slots() const; |
| 165 Code::Flags flags() const; | 165 Code::Flags flags() const; |
| 166 bool has_scope() const { return scope() != nullptr; } |
| 166 | 167 |
| 167 void set_parameter_count(int parameter_count) { | 168 void set_parameter_count(int parameter_count) { |
| 168 DCHECK(IsStub()); | 169 DCHECK(IsStub()); |
| 169 parameter_count_ = parameter_count; | 170 parameter_count_ = parameter_count; |
| 170 } | 171 } |
| 171 | 172 |
| 172 bool is_tracking_positions() const { return track_positions_; } | 173 bool is_tracking_positions() const { return track_positions_; } |
| 173 | 174 |
| 174 bool is_calling() const { | 175 bool is_calling() const { |
| 175 return GetFlag(kDeferredCalling) || GetFlag(kNonDeferredCalling); | 176 return GetFlag(kDeferredCalling) || GetFlag(kNonDeferredCalling); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 bool IsOptimizable() const { return mode_ == BASE; } | 264 bool IsOptimizable() const { return mode_ == BASE; } |
| 264 bool IsStub() const { return mode_ == STUB; } | 265 bool IsStub() const { return mode_ == STUB; } |
| 265 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { | 266 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { |
| 266 DCHECK(!shared_info().is_null()); | 267 DCHECK(!shared_info().is_null()); |
| 267 SetMode(OPTIMIZE); | 268 SetMode(OPTIMIZE); |
| 268 osr_ast_id_ = osr_ast_id; | 269 osr_ast_id_ = osr_ast_id; |
| 269 unoptimized_code_ = unoptimized; | 270 unoptimized_code_ = unoptimized; |
| 270 optimization_id_ = isolate()->NextOptimizationId(); | 271 optimization_id_ = isolate()->NextOptimizationId(); |
| 271 } | 272 } |
| 272 | 273 |
| 274 void SetStub(CodeStub* code_stub) { |
| 275 SetMode(STUB); |
| 276 code_stub_ = code_stub; |
| 277 } |
| 278 |
| 273 // Deoptimization support. | 279 // Deoptimization support. |
| 274 bool HasDeoptimizationSupport() const { | 280 bool HasDeoptimizationSupport() const { |
| 275 return GetFlag(kDeoptimizationSupport); | 281 return GetFlag(kDeoptimizationSupport); |
| 276 } | 282 } |
| 277 void EnableDeoptimizationSupport() { | 283 void EnableDeoptimizationSupport() { |
| 278 DCHECK(IsOptimizable()); | 284 DCHECK(IsOptimizable()); |
| 279 SetFlag(kDeoptimizationSupport); | 285 SetFlag(kDeoptimizationSupport); |
| 280 } | 286 } |
| 281 | 287 |
| 282 // Determines whether or not to insert a self-optimization header. | 288 // Determines whether or not to insert a self-optimization header. |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 Zone zone_; | 706 Zone zone_; |
| 701 size_t info_zone_start_allocation_size_; | 707 size_t info_zone_start_allocation_size_; |
| 702 base::ElapsedTimer timer_; | 708 base::ElapsedTimer timer_; |
| 703 | 709 |
| 704 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 710 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 705 }; | 711 }; |
| 706 | 712 |
| 707 } } // namespace v8::internal | 713 } } // namespace v8::internal |
| 708 | 714 |
| 709 #endif // V8_COMPILER_H_ | 715 #endif // V8_COMPILER_H_ |
| OLD | NEW |