Chromium Code Reviews| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 InlinedFunctionInfo(int parent_id, SourcePosition inline_position, | 90 InlinedFunctionInfo(int parent_id, SourcePosition inline_position, |
| 91 int script_id, int start_position) | 91 int script_id, int start_position) |
| 92 : parent_id(parent_id), | 92 : parent_id(parent_id), |
| 93 inline_position(inline_position), | 93 inline_position(inline_position), |
| 94 script_id(script_id), | 94 script_id(script_id), |
| 95 start_position(start_position) {} | 95 start_position(start_position) {} |
| 96 int parent_id; | 96 int parent_id; |
| 97 SourcePosition inline_position; | 97 SourcePosition inline_position; |
| 98 int script_id; | 98 int script_id; |
| 99 int start_position; | 99 int start_position; |
| 100 std::vector<int> deopt_pc_offsets; | 100 std::vector<size_t> deopt_pc_offsets; |
| 101 | 101 |
| 102 static const int kNoParentId = -1; | 102 static const int kNoParentId = -1; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 | 105 |
| 106 // CompilationInfo encapsulates some information known at compile time. It | 106 // CompilationInfo encapsulates some information known at compile time. It |
| 107 // is constructed based on the resources available at compile-time. | 107 // is constructed based on the resources available at compile-time. |
| 108 class CompilationInfo { | 108 class CompilationInfo { |
| 109 public: | 109 public: |
| 110 // Various configuration flags for a compilation, as well as some properties | 110 // Various configuration flags for a compilation, as well as some properties |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 | 330 |
| 331 void set_prologue_offset(int prologue_offset) { | 331 void set_prologue_offset(int prologue_offset) { |
| 332 DCHECK_EQ(Code::kPrologueOffsetNotSet, prologue_offset_); | 332 DCHECK_EQ(Code::kPrologueOffsetNotSet, prologue_offset_); |
| 333 prologue_offset_ = prologue_offset; | 333 prologue_offset_ = prologue_offset; |
| 334 } | 334 } |
| 335 | 335 |
| 336 // Adds offset range [from, to) where fp register does not point | 336 // Adds offset range [from, to) where fp register does not point |
| 337 // to the current frame base. Used in CPU profiler to detect stack | 337 // to the current frame base. Used in CPU profiler to detect stack |
| 338 // samples where top frame is not set up. | 338 // samples where top frame is not set up. |
| 339 inline void AddNoFrameRange(int from, int to) { | 339 inline void AddNoFrameRange(int from, int to) { |
| 340 if (no_frame_ranges_) no_frame_ranges_->Add(OffsetRange(from, to)); | 340 if (!no_frame_ranges_.is_empty()) |
| 341 no_frame_ranges_->Add(OffsetRange(from, to)); | |
| 341 } | 342 } |
| 342 | 343 |
| 343 List<OffsetRange>* ReleaseNoFrameRanges() { | 344 List<OffsetRange>* ReleaseNoFrameRanges() { |
| 344 List<OffsetRange>* result = no_frame_ranges_; | 345 return no_frame_ranges_.Detach(); |
| 345 no_frame_ranges_ = NULL; | |
| 346 return result; | |
| 347 } | 346 } |
| 348 | 347 |
| 349 int start_position_for(uint32_t inlining_id) { | 348 int start_position_for(uint32_t inlining_id) { |
| 350 return inlined_function_infos_.at(inlining_id).start_position; | 349 return inlined_function_infos_->at(inlining_id).start_position; |
| 350 } | |
| 351 std::vector<InlinedFunctionInfo>* ReleaseInlinedFunctionInfos() { | |
| 352 return inlined_function_infos_.Detach(); | |
|
Sven Panne
2015/03/23 10:13:27
This is horribly complicated: Can't we simply retu
| |
| 351 } | 353 } |
| 352 | 354 |
| 353 void LogDeoptCallPosition(int pc_offset, int inlining_id); | 355 void LogDeoptCallPosition(int pc_offset, int inlining_id); |
| 354 int TraceInlinedFunction(Handle<SharedFunctionInfo> shared, | 356 int TraceInlinedFunction(Handle<SharedFunctionInfo> shared, |
| 355 SourcePosition position, int pareint_id); | 357 SourcePosition position, int pareint_id); |
| 356 | 358 |
| 357 Handle<Foreign> object_wrapper() { | 359 Handle<Foreign> object_wrapper() { |
| 358 if (object_wrapper_.is_null()) { | 360 if (object_wrapper_.is_null()) { |
| 359 object_wrapper_ = | 361 object_wrapper_ = |
| 360 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); | 362 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 Zone* zone_; | 454 Zone* zone_; |
| 453 | 455 |
| 454 DeferredHandles* deferred_handles_; | 456 DeferredHandles* deferred_handles_; |
| 455 | 457 |
| 456 ZoneList<Handle<HeapObject> >* dependencies_[DependentCode::kGroupCount]; | 458 ZoneList<Handle<HeapObject> >* dependencies_[DependentCode::kGroupCount]; |
| 457 | 459 |
| 458 BailoutReason bailout_reason_; | 460 BailoutReason bailout_reason_; |
| 459 | 461 |
| 460 int prologue_offset_; | 462 int prologue_offset_; |
| 461 | 463 |
| 462 List<OffsetRange>* no_frame_ranges_; | 464 SmartPointer<List<OffsetRange>> no_frame_ranges_; |
| 463 std::vector<InlinedFunctionInfo> inlined_function_infos_; | 465 SmartPointer<std::vector<InlinedFunctionInfo>> inlined_function_infos_; |
|
Sven Panne
2015/03/23 10:13:26
Following the KISS principle, leave the instance f
| |
| 464 bool track_positions_; | 466 bool track_positions_; |
| 465 | 467 |
| 466 // A copy of shared_info()->opt_count() to avoid handle deref | 468 // A copy of shared_info()->opt_count() to avoid handle deref |
| 467 // during graph optimization. | 469 // during graph optimization. |
| 468 int opt_count_; | 470 int opt_count_; |
| 469 | 471 |
| 470 // Number of parameters used for compilation of stubs that require arguments. | 472 // Number of parameters used for compilation of stubs that require arguments. |
| 471 int parameter_count_; | 473 int parameter_count_; |
| 472 | 474 |
| 473 Handle<Foreign> object_wrapper_; | 475 Handle<Foreign> object_wrapper_; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 701 Zone zone_; | 703 Zone zone_; |
| 702 size_t info_zone_start_allocation_size_; | 704 size_t info_zone_start_allocation_size_; |
| 703 base::ElapsedTimer timer_; | 705 base::ElapsedTimer timer_; |
| 704 | 706 |
| 705 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 707 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 706 }; | 708 }; |
| 707 | 709 |
| 708 } } // namespace v8::internal | 710 } } // namespace v8::internal |
| 709 | 711 |
| 710 #endif // V8_COMPILER_H_ | 712 #endif // V8_COMPILER_H_ |
| OLD | NEW |