| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 IsStub() const { return mode_ == STUB; } | 295 bool IsStub() const { return mode_ == STUB; } |
| 296 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { | 296 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { |
| 297 DCHECK(has_shared_info()); | 297 DCHECK(has_shared_info()); |
| 298 SetMode(OPTIMIZE); | 298 SetMode(OPTIMIZE); |
| 299 osr_ast_id_ = osr_ast_id; | 299 osr_ast_id_ = osr_ast_id; |
| 300 unoptimized_code_ = unoptimized; | 300 unoptimized_code_ = unoptimized; |
| 301 optimization_id_ = isolate()->NextOptimizationId(); | 301 optimization_id_ = isolate()->NextOptimizationId(); |
| 302 set_output_code_kind(Code::OPTIMIZED_FUNCTION); |
| 302 } | 303 } |
| 303 | 304 |
| 304 void SetFunctionType(Type::FunctionType* function_type) { | 305 void SetFunctionType(Type::FunctionType* function_type) { |
| 305 function_type_ = function_type; | 306 function_type_ = function_type; |
| 306 } | 307 } |
| 307 Type::FunctionType* function_type() const { return function_type_; } | 308 Type::FunctionType* function_type() const { return function_type_; } |
| 308 | 309 |
| 309 void SetStub(CodeStub* code_stub); | 310 void SetStub(CodeStub* code_stub); |
| 310 | 311 |
| 311 // Deoptimization support. | 312 // Deoptimization support. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 typedef std::vector<Handle<SharedFunctionInfo>> InlinedFunctionList; | 406 typedef std::vector<Handle<SharedFunctionInfo>> InlinedFunctionList; |
| 406 InlinedFunctionList const& inlined_functions() const { | 407 InlinedFunctionList const& inlined_functions() const { |
| 407 return inlined_functions_; | 408 return inlined_functions_; |
| 408 } | 409 } |
| 409 void AddInlinedFunction(Handle<SharedFunctionInfo> inlined_function) { | 410 void AddInlinedFunction(Handle<SharedFunctionInfo> inlined_function) { |
| 410 inlined_functions_.push_back(inlined_function); | 411 inlined_functions_.push_back(inlined_function); |
| 411 } | 412 } |
| 412 | 413 |
| 413 base::SmartArrayPointer<char> GetDebugName() const; | 414 base::SmartArrayPointer<char> GetDebugName() const; |
| 414 | 415 |
| 416 Code::Kind output_code_kind() const { return output_code_kind_; } |
| 417 |
| 418 void set_output_code_kind(Code::Kind kind) { output_code_kind_ = kind; } |
| 419 |
| 415 protected: | 420 protected: |
| 416 ParseInfo* parse_info_; | 421 ParseInfo* parse_info_; |
| 417 | 422 |
| 418 void DisableFutureOptimization() { | 423 void DisableFutureOptimization() { |
| 419 if (GetFlag(kDisableFutureOptimization) && has_shared_info()) { | 424 if (GetFlag(kDisableFutureOptimization) && has_shared_info()) { |
| 420 shared_info()->DisableOptimization(bailout_reason()); | 425 shared_info()->DisableOptimization(bailout_reason()); |
| 421 } | 426 } |
| 422 } | 427 } |
| 423 | 428 |
| 424 private: | 429 private: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 444 void SetFlag(Flag flag) { flags_ |= flag; } | 449 void SetFlag(Flag flag) { flags_ |= flag; } |
| 445 | 450 |
| 446 void SetFlag(Flag flag, bool value) { | 451 void SetFlag(Flag flag, bool value) { |
| 447 flags_ = value ? flags_ | flag : flags_ & ~flag; | 452 flags_ = value ? flags_ | flag : flags_ & ~flag; |
| 448 } | 453 } |
| 449 | 454 |
| 450 bool GetFlag(Flag flag) const { return (flags_ & flag) != 0; } | 455 bool GetFlag(Flag flag) const { return (flags_ & flag) != 0; } |
| 451 | 456 |
| 452 unsigned flags_; | 457 unsigned flags_; |
| 453 | 458 |
| 459 Code::Kind output_code_kind_; |
| 460 |
| 454 // For compiled stubs, the stub object | 461 // For compiled stubs, the stub object |
| 455 CodeStub* code_stub_; | 462 CodeStub* code_stub_; |
| 456 // The compiled code. | 463 // The compiled code. |
| 457 Handle<Code> code_; | 464 Handle<Code> code_; |
| 458 | 465 |
| 459 // Used by codegen, ultimately kept rooted by the SharedFunctionInfo. | 466 // Used by codegen, ultimately kept rooted by the SharedFunctionInfo. |
| 460 Handle<TypeFeedbackVector> feedback_vector_; | 467 Handle<TypeFeedbackVector> feedback_vector_; |
| 461 | 468 |
| 462 // Compilation mode flag and whether deoptimization is allowed. | 469 // Compilation mode flag and whether deoptimization is allowed. |
| 463 Mode mode_; | 470 Mode mode_; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 Zone zone_; | 708 Zone zone_; |
| 702 size_t info_zone_start_allocation_size_; | 709 size_t info_zone_start_allocation_size_; |
| 703 base::ElapsedTimer timer_; | 710 base::ElapsedTimer timer_; |
| 704 | 711 |
| 705 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 712 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 706 }; | 713 }; |
| 707 | 714 |
| 708 } } // namespace v8::internal | 715 } } // namespace v8::internal |
| 709 | 716 |
| 710 #endif // V8_COMPILER_H_ | 717 #endif // V8_COMPILER_H_ |
| OLD | NEW |