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