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