| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 281 |
| 282 void SetBytecodeArray(Handle<BytecodeArray> bytecode_array) { | 282 void SetBytecodeArray(Handle<BytecodeArray> bytecode_array) { |
| 283 bytecode_array_ = bytecode_array; | 283 bytecode_array_ = bytecode_array; |
| 284 } | 284 } |
| 285 | 285 |
| 286 bool ShouldTrapOnDeopt() const { | 286 bool ShouldTrapOnDeopt() const { |
| 287 return (FLAG_trap_on_deopt && IsOptimizing()) || | 287 return (FLAG_trap_on_deopt && IsOptimizing()) || |
| 288 (FLAG_trap_on_stub_deopt && IsStub()); | 288 (FLAG_trap_on_stub_deopt && IsStub()); |
| 289 } | 289 } |
| 290 | 290 |
| 291 bool has_native_context() const { | 291 bool has_global_object() const { |
| 292 return !closure().is_null() && (closure()->native_context() != nullptr); | 292 return !closure().is_null() && |
| 293 (closure()->context()->global_object() != NULL); |
| 293 } | 294 } |
| 294 | 295 |
| 295 Context* native_context() const { | 296 JSGlobalObject* global_object() const { |
| 296 return has_native_context() ? closure()->native_context() : nullptr; | 297 return has_global_object() ? closure()->context()->global_object() : NULL; |
| 297 } | 298 } |
| 298 | 299 |
| 299 bool has_global_object() const { return has_native_context(); } | 300 bool has_native_context() const { return has_global_object(); } |
| 300 | 301 |
| 301 JSGlobalObject* global_object() const { | 302 Context* native_context() const { |
| 302 return has_global_object() ? native_context()->global_object() : nullptr; | 303 return has_native_context() ? global_object()->native_context() : nullptr; |
| 303 } | 304 } |
| 304 | 305 |
| 305 // Accessors for the different compilation modes. | 306 // Accessors for the different compilation modes. |
| 306 bool IsOptimizing() const { return mode_ == OPTIMIZE; } | 307 bool IsOptimizing() const { return mode_ == OPTIMIZE; } |
| 307 bool IsStub() const { return mode_ == STUB; } | 308 bool IsStub() const { return mode_ == STUB; } |
| 308 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { | 309 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { |
| 309 DCHECK(has_shared_info()); | 310 DCHECK(has_shared_info()); |
| 310 SetMode(OPTIMIZE); | 311 SetMode(OPTIMIZE); |
| 311 osr_ast_id_ = osr_ast_id; | 312 osr_ast_id_ = osr_ast_id; |
| 312 unoptimized_code_ = unoptimized; | 313 unoptimized_code_ = unoptimized; |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 size_t info_zone_start_allocation_size_; | 728 size_t info_zone_start_allocation_size_; |
| 728 base::ElapsedTimer timer_; | 729 base::ElapsedTimer timer_; |
| 729 | 730 |
| 730 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 731 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 731 }; | 732 }; |
| 732 | 733 |
| 733 } // namespace internal | 734 } // namespace internal |
| 734 } // namespace v8 | 735 } // namespace v8 |
| 735 | 736 |
| 736 #endif // V8_COMPILER_H_ | 737 #endif // V8_COMPILER_H_ |
| OLD | NEW |