OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_SOURCE_POSITION_H_ | 5 #ifndef V8_SOURCE_POSITION_H_ |
6 #define V8_SOURCE_POSITION_H_ | 6 #define V8_SOURCE_POSITION_H_ |
7 | 7 |
8 #include <ostream> | 8 #include <ostream> |
9 | 9 |
10 #include "src/assembler.h" | |
11 #include "src/flags.h" | 10 #include "src/flags.h" |
| 11 #include "src/globals.h" |
12 #include "src/utils.h" | 12 #include "src/utils.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 // This class encapsulates encoding and decoding of sources positions from | 17 // This class encapsulates encoding and decoding of sources positions from |
18 // which hydrogen values originated. | 18 // which hydrogen values originated. |
19 // When FLAG_track_hydrogen_positions is set this object encodes the | 19 // When FLAG_track_hydrogen_positions is set this object encodes the |
20 // identifier of the inlining and absolute offset from the start of the | 20 // identifier of the inlining and absolute offset from the start of the |
21 // inlined function. | 21 // inlined function. |
(...skipping 20 matching lines...) Expand all Loading... |
42 void set_inlining_id(uint32_t inlining_id) { | 42 void set_inlining_id(uint32_t inlining_id) { |
43 if (FLAG_hydrogen_track_positions) { | 43 if (FLAG_hydrogen_track_positions) { |
44 value_ = | 44 value_ = |
45 static_cast<uint32_t>(InliningIdField::update(value_, inlining_id)); | 45 static_cast<uint32_t>(InliningIdField::update(value_, inlining_id)); |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 uint32_t raw() const { return value_; } | 49 uint32_t raw() const { return value_; } |
50 | 50 |
51 private: | 51 private: |
52 static const uint32_t kNoPosition = | 52 static const uint32_t kNoPosition = static_cast<uint32_t>(kNoSourcePosition); |
53 static_cast<uint32_t>(RelocInfo::kNoPosition); | |
54 typedef BitField<uint32_t, 0, 9> InliningIdField; | 53 typedef BitField<uint32_t, 0, 9> InliningIdField; |
55 | 54 |
56 // Offset from the start of the inlined function. | 55 // Offset from the start of the inlined function. |
57 typedef BitField<uint32_t, 9, 23> PositionField; | 56 typedef BitField<uint32_t, 9, 23> PositionField; |
58 | 57 |
59 friend class HPositionInfo; | 58 friend class HPositionInfo; |
60 friend class Deoptimizer; | 59 friend class Deoptimizer; |
61 | 60 |
62 static SourcePosition FromRaw(uint32_t raw_position) { | 61 static SourcePosition FromRaw(uint32_t raw_position) { |
63 SourcePosition position; | 62 SourcePosition position; |
(...skipping 14 matching lines...) Expand all Loading... |
78 return os << "<" << p.inlining_id() << ":" << p.position() << ">"; | 77 return os << "<" << p.inlining_id() << ":" << p.position() << ">"; |
79 } else { | 78 } else { |
80 return os << "<0:" << p.raw() << ">"; | 79 return os << "<0:" << p.raw() << ">"; |
81 } | 80 } |
82 } | 81 } |
83 | 82 |
84 } // namespace internal | 83 } // namespace internal |
85 } // namespace v8 | 84 } // namespace v8 |
86 | 85 |
87 #endif // V8_SOURCE_POSITION_H_ | 86 #endif // V8_SOURCE_POSITION_H_ |
OLD | NEW |