OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_LINKAGE_H_ | 5 #ifndef V8_COMPILER_LINKAGE_H_ |
6 #define V8_COMPILER_LINKAGE_H_ | 6 #define V8_COMPILER_LINKAGE_H_ |
7 | 7 |
8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
9 #include "src/compiler/frame.h" | 9 #include "src/compiler/frame.h" |
10 #include "src/compiler/machine-type.h" | 10 #include "src/compiler/machine-type.h" |
11 #include "src/compiler/operator.h" | 11 #include "src/compiler/operator.h" |
12 #include "src/zone.h" | 12 #include "src/zone.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 class CallInterfaceDescriptor; | 17 class CallInterfaceDescriptor; |
18 | 18 |
19 namespace compiler { | 19 namespace compiler { |
20 | 20 |
| 21 class OsrHelper; |
| 22 |
21 // Describes the location for a parameter or a return value to a call. | 23 // Describes the location for a parameter or a return value to a call. |
22 class LinkageLocation { | 24 class LinkageLocation { |
23 public: | 25 public: |
24 explicit LinkageLocation(int location) : location_(location) {} | 26 explicit LinkageLocation(int location) : location_(location) {} |
25 | 27 |
26 static const int16_t ANY_REGISTER = 32767; | 28 static const int16_t ANY_REGISTER = 1023; |
| 29 static const int16_t MAX_STACK_SLOT = 32767; |
27 | 30 |
28 static LinkageLocation AnyRegister() { return LinkageLocation(ANY_REGISTER); } | 31 static LinkageLocation AnyRegister() { return LinkageLocation(ANY_REGISTER); } |
29 | 32 |
30 private: | 33 private: |
31 friend class CallDescriptor; | 34 friend class CallDescriptor; |
32 friend class OperandGenerator; | 35 friend class OperandGenerator; |
33 int16_t location_; // >= 0 implies register, otherwise stack slot. | 36 // location < 0 -> a stack slot on the caller frame |
| 37 // 0 <= location < 1023 -> a specific machine register |
| 38 // 1023 <= location < 1024 -> any machine register |
| 39 // 1024 <= location -> a stack slot in the callee frame |
| 40 int16_t location_; |
34 }; | 41 }; |
35 | 42 |
36 typedef Signature<LinkageLocation> LocationSignature; | 43 typedef Signature<LinkageLocation> LocationSignature; |
37 | 44 |
38 // Describes a call to various parts of the compiler. Every call has the notion | 45 // Describes a call to various parts of the compiler. Every call has the notion |
39 // of a "target", which is the first input to the call. | 46 // of a "target", which is the first input to the call. |
40 class CallDescriptor FINAL : public ZoneObject { | 47 class CallDescriptor FINAL : public ZoneObject { |
41 public: | 48 public: |
42 // Describes the kind of this call, which determines the target. | 49 // Describes the kind of this call, which determines the target. |
43 enum Kind { | 50 enum Kind { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 227 |
221 // Get the frame offset for a given spill slot. The location depends on the | 228 // Get the frame offset for a given spill slot. The location depends on the |
222 // calling convention and the specific frame layout, and may thus be | 229 // calling convention and the specific frame layout, and may thus be |
223 // architecture-specific. Negative spill slots indicate arguments on the | 230 // architecture-specific. Negative spill slots indicate arguments on the |
224 // caller's frame. The {extra} parameter indicates an additional offset from | 231 // caller's frame. The {extra} parameter indicates an additional offset from |
225 // the frame offset, e.g. to index into part of a double slot. | 232 // the frame offset, e.g. to index into part of a double slot. |
226 FrameOffset GetFrameOffset(int spill_slot, Frame* frame, int extra = 0) const; | 233 FrameOffset GetFrameOffset(int spill_slot, Frame* frame, int extra = 0) const; |
227 | 234 |
228 static bool NeedsFrameState(Runtime::FunctionId function); | 235 static bool NeedsFrameState(Runtime::FunctionId function); |
229 | 236 |
| 237 // Get the location where an incoming OSR value is stored. |
| 238 LinkageLocation GetOsrValueLocation(int index) const; |
| 239 |
230 private: | 240 private: |
231 Zone* const zone_; | 241 Zone* const zone_; |
232 CallDescriptor* const incoming_; | 242 CallDescriptor* const incoming_; |
233 | 243 |
234 DISALLOW_COPY_AND_ASSIGN(Linkage); | 244 DISALLOW_COPY_AND_ASSIGN(Linkage); |
235 }; | 245 }; |
236 | 246 |
237 } // namespace compiler | 247 } // namespace compiler |
238 } // namespace internal | 248 } // namespace internal |
239 } // namespace v8 | 249 } // namespace v8 |
240 | 250 |
241 #endif // V8_COMPILER_LINKAGE_H_ | 251 #endif // V8_COMPILER_LINKAGE_H_ |
OLD | NEW |