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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // If FLAG_hydrogen_track_positions is set contains bitfields InliningIdField | 79 // If FLAG_hydrogen_track_positions is set contains bitfields InliningIdField |
80 // and PositionField. | 80 // and PositionField. |
81 // Otherwise contains absolute offset from the script start. | 81 // Otherwise contains absolute offset from the script start. |
82 uint32_t value_; | 82 uint32_t value_; |
83 }; | 83 }; |
84 | 84 |
85 | 85 |
86 std::ostream& operator<<(std::ostream& os, const SourcePosition& p); | 86 std::ostream& operator<<(std::ostream& os, const SourcePosition& p); |
87 | 87 |
88 | 88 |
89 class InlinedFunctionInfo { | 89 struct InlinedFunctionInfo { |
90 public: | 90 InlinedFunctionInfo(int parent_id, SourcePosition inline_position, |
91 explicit InlinedFunctionInfo(Handle<SharedFunctionInfo> shared) | 91 int script_id, int start_position) |
92 : shared_(shared), start_position_(shared->start_position()) {} | 92 : parent_id(parent_id), |
| 93 inline_position(inline_position), |
| 94 script_id(script_id), |
| 95 start_position(start_position) {} |
| 96 int parent_id; |
| 97 SourcePosition inline_position; |
| 98 int script_id; |
| 99 int start_position; |
93 | 100 |
94 Handle<SharedFunctionInfo> shared() const { return shared_; } | 101 static const int kNoParentId = -1; |
95 int start_position() const { return start_position_; } | |
96 | |
97 private: | |
98 Handle<SharedFunctionInfo> shared_; | |
99 int start_position_; | |
100 }; | 102 }; |
101 | 103 |
102 | 104 |
103 // CompilationInfo encapsulates some information known at compile time. It | 105 // CompilationInfo encapsulates some information known at compile time. It |
104 // is constructed based on the resources available at compile-time. | 106 // is constructed based on the resources available at compile-time. |
105 class CompilationInfo { | 107 class CompilationInfo { |
106 public: | 108 public: |
107 // Various configuration flags for a compilation, as well as some properties | 109 // Various configuration flags for a compilation, as well as some properties |
108 // of the compiled code produced by a compilation. | 110 // of the compiled code produced by a compilation. |
109 enum Flag { | 111 enum Flag { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 333 |
332 List<OffsetRange>* ReleaseNoFrameRanges() { | 334 List<OffsetRange>* ReleaseNoFrameRanges() { |
333 List<OffsetRange>* result = no_frame_ranges_; | 335 List<OffsetRange>* result = no_frame_ranges_; |
334 no_frame_ranges_ = NULL; | 336 no_frame_ranges_ = NULL; |
335 return result; | 337 return result; |
336 } | 338 } |
337 | 339 |
338 List<InlinedFunctionInfo>* inlined_function_infos() { | 340 List<InlinedFunctionInfo>* inlined_function_infos() { |
339 return inlined_function_infos_; | 341 return inlined_function_infos_; |
340 } | 342 } |
341 List<int>* inlining_id_to_function_id() { | |
342 return inlining_id_to_function_id_; | |
343 } | |
344 int TraceInlinedFunction(Handle<SharedFunctionInfo> shared, | 343 int TraceInlinedFunction(Handle<SharedFunctionInfo> shared, |
345 SourcePosition position); | 344 SourcePosition position, int pareint_id); |
346 | 345 |
347 Handle<Foreign> object_wrapper() { | 346 Handle<Foreign> object_wrapper() { |
348 if (object_wrapper_.is_null()) { | 347 if (object_wrapper_.is_null()) { |
349 object_wrapper_ = | 348 object_wrapper_ = |
350 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); | 349 isolate()->factory()->NewForeign(reinterpret_cast<Address>(this)); |
351 } | 350 } |
352 return object_wrapper_; | 351 return object_wrapper_; |
353 } | 352 } |
354 | 353 |
355 void AbortDueToDependencyChange() { | 354 void AbortDueToDependencyChange() { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 DeferredHandles* deferred_handles_; | 442 DeferredHandles* deferred_handles_; |
444 | 443 |
445 ZoneList<Handle<HeapObject> >* dependencies_[DependentCode::kGroupCount]; | 444 ZoneList<Handle<HeapObject> >* dependencies_[DependentCode::kGroupCount]; |
446 | 445 |
447 BailoutReason bailout_reason_; | 446 BailoutReason bailout_reason_; |
448 | 447 |
449 int prologue_offset_; | 448 int prologue_offset_; |
450 | 449 |
451 List<OffsetRange>* no_frame_ranges_; | 450 List<OffsetRange>* no_frame_ranges_; |
452 List<InlinedFunctionInfo>* inlined_function_infos_; | 451 List<InlinedFunctionInfo>* inlined_function_infos_; |
453 List<int>* inlining_id_to_function_id_; | |
454 | 452 |
455 // A copy of shared_info()->opt_count() to avoid handle deref | 453 // A copy of shared_info()->opt_count() to avoid handle deref |
456 // during graph optimization. | 454 // during graph optimization. |
457 int opt_count_; | 455 int opt_count_; |
458 | 456 |
459 // Number of parameters used for compilation of stubs that require arguments. | 457 // Number of parameters used for compilation of stubs that require arguments. |
460 int parameter_count_; | 458 int parameter_count_; |
461 | 459 |
462 Handle<Foreign> object_wrapper_; | 460 Handle<Foreign> object_wrapper_; |
463 | 461 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 Zone zone_; | 689 Zone zone_; |
692 size_t info_zone_start_allocation_size_; | 690 size_t info_zone_start_allocation_size_; |
693 base::ElapsedTimer timer_; | 691 base::ElapsedTimer timer_; |
694 | 692 |
695 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 693 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
696 }; | 694 }; |
697 | 695 |
698 } } // namespace v8::internal | 696 } } // namespace v8::internal |
699 | 697 |
700 #endif // V8_COMPILER_H_ | 698 #endif // V8_COMPILER_H_ |
OLD | NEW |