| 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" |
| 11 #include "src/compilation-dependencies.h" | 11 #include "src/compilation-dependencies.h" |
| 12 #include "src/signature.h" | 12 #include "src/signature.h" |
| 13 #include "src/zone.h" | 13 #include "src/zone.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 | 17 |
| 18 class AstValueFactory; | 18 class AstValueFactory; |
| 19 class HydrogenCodeStub; | 19 class HydrogenCodeStub; |
| 20 class JavaScriptFrame; | 20 class JavaScriptFrame; |
| 21 class ParseInfo; | 21 class ParseInfo; |
| 22 class ScriptData; | 22 class ScriptData; |
| 23 | 23 |
| 24 struct OffsetRange { | |
| 25 OffsetRange(int from, int to) : from(from), to(to) {} | |
| 26 int from; | |
| 27 int to; | |
| 28 }; | |
| 29 | |
| 30 | 24 |
| 31 // This class encapsulates encoding and decoding of sources positions from | 25 // This class encapsulates encoding and decoding of sources positions from |
| 32 // which hydrogen values originated. | 26 // which hydrogen values originated. |
| 33 // When FLAG_track_hydrogen_positions is set this object encodes the | 27 // When FLAG_track_hydrogen_positions is set this object encodes the |
| 34 // identifier of the inlining and absolute offset from the start of the | 28 // identifier of the inlining and absolute offset from the start of the |
| 35 // inlined function. | 29 // inlined function. |
| 36 // When the flag is not set we simply track absolute offset from the | 30 // When the flag is not set we simply track absolute offset from the |
| 37 // script start. | 31 // script start. |
| 38 class SourcePosition { | 32 class SourcePosition { |
| 39 public: | 33 public: |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 int prologue_offset() const { | 348 int prologue_offset() const { |
| 355 DCHECK_NE(Code::kPrologueOffsetNotSet, prologue_offset_); | 349 DCHECK_NE(Code::kPrologueOffsetNotSet, prologue_offset_); |
| 356 return prologue_offset_; | 350 return prologue_offset_; |
| 357 } | 351 } |
| 358 | 352 |
| 359 void set_prologue_offset(int prologue_offset) { | 353 void set_prologue_offset(int prologue_offset) { |
| 360 DCHECK_EQ(Code::kPrologueOffsetNotSet, prologue_offset_); | 354 DCHECK_EQ(Code::kPrologueOffsetNotSet, prologue_offset_); |
| 361 prologue_offset_ = prologue_offset; | 355 prologue_offset_ = prologue_offset; |
| 362 } | 356 } |
| 363 | 357 |
| 364 // Adds offset range [from, to) where fp register does not point | |
| 365 // to the current frame base. Used in CPU profiler to detect stack | |
| 366 // samples where top frame is not set up. | |
| 367 inline void AddNoFrameRange(int from, int to) { | |
| 368 if (no_frame_ranges_) no_frame_ranges_->Add(OffsetRange(from, to)); | |
| 369 } | |
| 370 | |
| 371 List<OffsetRange>* ReleaseNoFrameRanges() { | |
| 372 List<OffsetRange>* result = no_frame_ranges_; | |
| 373 no_frame_ranges_ = NULL; | |
| 374 return result; | |
| 375 } | |
| 376 | |
| 377 int start_position_for(uint32_t inlining_id) { | 358 int start_position_for(uint32_t inlining_id) { |
| 378 return inlined_function_infos_.at(inlining_id).start_position; | 359 return inlined_function_infos_.at(inlining_id).start_position; |
| 379 } | 360 } |
| 380 const std::vector<InlinedFunctionInfo>& inlined_function_infos() { | 361 const std::vector<InlinedFunctionInfo>& inlined_function_infos() { |
| 381 return inlined_function_infos_; | 362 return inlined_function_infos_; |
| 382 } | 363 } |
| 383 | 364 |
| 384 void LogDeoptCallPosition(int pc_offset, int inlining_id); | 365 void LogDeoptCallPosition(int pc_offset, int inlining_id); |
| 385 int TraceInlinedFunction(Handle<SharedFunctionInfo> shared, | 366 int TraceInlinedFunction(Handle<SharedFunctionInfo> shared, |
| 386 SourcePosition position, int pareint_id); | 367 SourcePosition position, int pareint_id); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 | 465 |
| 485 DeferredHandles* deferred_handles_; | 466 DeferredHandles* deferred_handles_; |
| 486 | 467 |
| 487 // Dependencies for this compilation, e.g. stable maps. | 468 // Dependencies for this compilation, e.g. stable maps. |
| 488 CompilationDependencies dependencies_; | 469 CompilationDependencies dependencies_; |
| 489 | 470 |
| 490 BailoutReason bailout_reason_; | 471 BailoutReason bailout_reason_; |
| 491 | 472 |
| 492 int prologue_offset_; | 473 int prologue_offset_; |
| 493 | 474 |
| 494 List<OffsetRange>* no_frame_ranges_; | |
| 495 std::vector<InlinedFunctionInfo> inlined_function_infos_; | 475 std::vector<InlinedFunctionInfo> inlined_function_infos_; |
| 496 bool track_positions_; | 476 bool track_positions_; |
| 497 | 477 |
| 498 InlinedFunctionList inlined_functions_; | 478 InlinedFunctionList inlined_functions_; |
| 499 | 479 |
| 500 // A copy of shared_info()->opt_count() to avoid handle deref | 480 // A copy of shared_info()->opt_count() to avoid handle deref |
| 501 // during graph optimization. | 481 // during graph optimization. |
| 502 int opt_count_; | 482 int opt_count_; |
| 503 | 483 |
| 504 // Number of parameters used for compilation of stubs that require arguments. | 484 // Number of parameters used for compilation of stubs that require arguments. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 size_t info_zone_start_allocation_size_; | 693 size_t info_zone_start_allocation_size_; |
| 714 base::ElapsedTimer timer_; | 694 base::ElapsedTimer timer_; |
| 715 | 695 |
| 716 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 696 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 717 }; | 697 }; |
| 718 | 698 |
| 719 } // namespace internal | 699 } // namespace internal |
| 720 } // namespace v8 | 700 } // namespace v8 |
| 721 | 701 |
| 722 #endif // V8_COMPILER_H_ | 702 #endif // V8_COMPILER_H_ |
| OLD | NEW |