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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 290 |
291 bool has_global_object() const { | 291 bool has_global_object() const { |
292 return !closure().is_null() && | 292 return !closure().is_null() && |
293 (closure()->context()->global_object() != NULL); | 293 (closure()->context()->global_object() != NULL); |
294 } | 294 } |
295 | 295 |
296 JSGlobalObject* global_object() const { | 296 JSGlobalObject* global_object() const { |
297 return has_global_object() ? closure()->context()->global_object() : NULL; | 297 return has_global_object() ? closure()->context()->global_object() : NULL; |
298 } | 298 } |
299 | 299 |
| 300 bool has_native_context() const { return has_global_object(); } |
| 301 |
| 302 Context* native_context() const { |
| 303 return has_native_context() ? global_object()->native_context() : nullptr; |
| 304 } |
| 305 |
300 // Accessors for the different compilation modes. | 306 // Accessors for the different compilation modes. |
301 bool IsOptimizing() const { return mode_ == OPTIMIZE; } | 307 bool IsOptimizing() const { return mode_ == OPTIMIZE; } |
302 bool IsStub() const { return mode_ == STUB; } | 308 bool IsStub() const { return mode_ == STUB; } |
303 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { | 309 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { |
304 DCHECK(has_shared_info()); | 310 DCHECK(has_shared_info()); |
305 SetMode(OPTIMIZE); | 311 SetMode(OPTIMIZE); |
306 osr_ast_id_ = osr_ast_id; | 312 osr_ast_id_ = osr_ast_id; |
307 unoptimized_code_ = unoptimized; | 313 unoptimized_code_ = unoptimized; |
308 optimization_id_ = isolate()->NextOptimizationId(); | 314 optimization_id_ = isolate()->NextOptimizationId(); |
309 set_output_code_kind(Code::OPTIMIZED_FUNCTION); | 315 set_output_code_kind(Code::OPTIMIZED_FUNCTION); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 size_t info_zone_start_allocation_size_; | 728 size_t info_zone_start_allocation_size_; |
723 base::ElapsedTimer timer_; | 729 base::ElapsedTimer timer_; |
724 | 730 |
725 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 731 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
726 }; | 732 }; |
727 | 733 |
728 } // namespace internal | 734 } // namespace internal |
729 } // namespace v8 | 735 } // namespace v8 |
730 | 736 |
731 #endif // V8_COMPILER_H_ | 737 #endif // V8_COMPILER_H_ |
OLD | NEW |