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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 return !closure().is_null() && | 285 return !closure().is_null() && |
286 (closure()->context()->global_object() != NULL); | 286 (closure()->context()->global_object() != NULL); |
287 } | 287 } |
288 | 288 |
289 GlobalObject* global_object() const { | 289 GlobalObject* global_object() const { |
290 return has_global_object() ? closure()->context()->global_object() : NULL; | 290 return has_global_object() ? closure()->context()->global_object() : NULL; |
291 } | 291 } |
292 | 292 |
293 // Accessors for the different compilation modes. | 293 // Accessors for the different compilation modes. |
294 bool IsOptimizing() const { return mode_ == OPTIMIZE; } | 294 bool IsOptimizing() const { return mode_ == OPTIMIZE; } |
295 bool IsOptimizable() const { return mode_ == BASE; } | |
296 bool IsStub() const { return mode_ == STUB; } | 295 bool IsStub() const { return mode_ == STUB; } |
297 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { | 296 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { |
298 DCHECK(!shared_info().is_null()); | 297 DCHECK(!shared_info().is_null()); |
299 SetMode(OPTIMIZE); | 298 SetMode(OPTIMIZE); |
300 osr_ast_id_ = osr_ast_id; | 299 osr_ast_id_ = osr_ast_id; |
301 unoptimized_code_ = unoptimized; | 300 unoptimized_code_ = unoptimized; |
302 optimization_id_ = isolate()->NextOptimizationId(); | 301 optimization_id_ = isolate()->NextOptimizationId(); |
303 } | 302 } |
304 | 303 |
305 void SetFunctionType(Type::FunctionType* function_type) { | 304 void SetFunctionType(Type::FunctionType* function_type) { |
306 function_type_ = function_type; | 305 function_type_ = function_type; |
307 } | 306 } |
308 Type::FunctionType* function_type() const { return function_type_; } | 307 Type::FunctionType* function_type() const { return function_type_; } |
309 | 308 |
310 void SetStub(CodeStub* code_stub) { | 309 void SetStub(CodeStub* code_stub) { |
311 SetMode(STUB); | 310 SetMode(STUB); |
312 code_stub_ = code_stub; | 311 code_stub_ = code_stub; |
313 } | 312 } |
314 | 313 |
315 // Deoptimization support. | 314 // Deoptimization support. |
316 bool HasDeoptimizationSupport() const { | 315 bool HasDeoptimizationSupport() const { |
317 return GetFlag(kDeoptimizationSupport); | 316 return GetFlag(kDeoptimizationSupport); |
318 } | 317 } |
319 void EnableDeoptimizationSupport() { | 318 void EnableDeoptimizationSupport() { |
320 DCHECK(IsOptimizable()); | 319 DCHECK_EQ(BASE, mode_); |
321 SetFlag(kDeoptimizationSupport); | 320 SetFlag(kDeoptimizationSupport); |
322 } | 321 } |
323 | 322 |
324 // Determines whether or not to insert a self-optimization header. | 323 // Determines whether or not to insert a self-optimization header. |
325 bool ShouldSelfOptimize(); | 324 bool ShouldSelfOptimize(); |
326 | 325 |
327 void set_deferred_handles(DeferredHandles* deferred_handles) { | 326 void set_deferred_handles(DeferredHandles* deferred_handles) { |
328 DCHECK(deferred_handles_ == NULL); | 327 DCHECK(deferred_handles_ == NULL); |
329 deferred_handles_ = deferred_handles; | 328 deferred_handles_ = deferred_handles; |
330 } | 329 } |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 Zone zone_; | 699 Zone zone_; |
701 size_t info_zone_start_allocation_size_; | 700 size_t info_zone_start_allocation_size_; |
702 base::ElapsedTimer timer_; | 701 base::ElapsedTimer timer_; |
703 | 702 |
704 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 703 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
705 }; | 704 }; |
706 | 705 |
707 } } // namespace v8::internal | 706 } } // namespace v8::internal |
708 | 707 |
709 #endif // V8_COMPILER_H_ | 708 #endif // V8_COMPILER_H_ |
OLD | NEW |