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/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 bool has_global_object() const { return has_native_context(); } | 241 bool has_global_object() const { return has_native_context(); } |
242 | 242 |
243 JSGlobalObject* global_object() const { | 243 JSGlobalObject* global_object() const { |
244 return has_global_object() ? native_context()->global_object() : nullptr; | 244 return has_global_object() ? native_context()->global_object() : nullptr; |
245 } | 245 } |
246 | 246 |
247 // Accessors for the different compilation modes. | 247 // Accessors for the different compilation modes. |
248 bool IsOptimizing() const { return mode_ == OPTIMIZE; } | 248 bool IsOptimizing() const { return mode_ == OPTIMIZE; } |
249 bool IsStub() const { return mode_ == STUB; } | 249 bool IsStub() const { return mode_ == STUB; } |
250 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { | 250 void SetOptimizing() { |
251 DCHECK(has_shared_info()); | 251 DCHECK(has_shared_info()); |
252 SetMode(OPTIMIZE); | 252 SetMode(OPTIMIZE); |
253 osr_ast_id_ = osr_ast_id; | |
254 unoptimized_code_ = unoptimized; | |
255 optimization_id_ = isolate()->NextOptimizationId(); | 253 optimization_id_ = isolate()->NextOptimizationId(); |
256 code_flags_ = | 254 code_flags_ = |
257 Code::KindField::update(code_flags_, Code::OPTIMIZED_FUNCTION); | 255 Code::KindField::update(code_flags_, Code::OPTIMIZED_FUNCTION); |
258 } | 256 } |
| 257 void SetOptimizingForOsr(BailoutId osr_ast_id, Handle<Code> unoptimized) { |
| 258 SetOptimizing(); |
| 259 osr_ast_id_ = osr_ast_id; |
| 260 unoptimized_code_ = unoptimized; |
| 261 } |
259 | 262 |
260 // Deoptimization support. | 263 // Deoptimization support. |
261 bool HasDeoptimizationSupport() const { | 264 bool HasDeoptimizationSupport() const { |
262 return GetFlag(kDeoptimizationSupport); | 265 return GetFlag(kDeoptimizationSupport); |
263 } | 266 } |
264 void EnableDeoptimizationSupport() { | 267 void EnableDeoptimizationSupport() { |
265 DCHECK_EQ(BASE, mode_); | 268 DCHECK_EQ(BASE, mode_); |
266 SetFlag(kDeoptimizationSupport); | 269 SetFlag(kDeoptimizationSupport); |
267 } | 270 } |
268 bool ShouldEnsureSpaceForLazyDeopt() { return !IsStub(); } | 271 bool ShouldEnsureSpaceForLazyDeopt() { return !IsStub(); } |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 size_t info_zone_start_allocation_size_; | 665 size_t info_zone_start_allocation_size_; |
663 base::ElapsedTimer timer_; | 666 base::ElapsedTimer timer_; |
664 | 667 |
665 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 668 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
666 }; | 669 }; |
667 | 670 |
668 } // namespace internal | 671 } // namespace internal |
669 } // namespace v8 | 672 } // namespace v8 |
670 | 673 |
671 #endif // V8_COMPILER_H_ | 674 #endif // V8_COMPILER_H_ |
OLD | NEW |