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/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compiler/frame.h" | 10 #include "src/compiler/frame.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 class CallDescriptor V8_FINAL : public ZoneObject { | 39 class CallDescriptor V8_FINAL : public ZoneObject { |
40 public: | 40 public: |
41 // Describes whether the first parameter is a code object, a JSFunction, | 41 // Describes whether the first parameter is a code object, a JSFunction, |
42 // or an address--all of which require different machine sequences to call. | 42 // or an address--all of which require different machine sequences to call. |
43 enum Kind { kCallCodeObject, kCallJSFunction, kCallAddress }; | 43 enum Kind { kCallCodeObject, kCallJSFunction, kCallAddress }; |
44 | 44 |
45 enum Flag { | 45 enum Flag { |
46 // TODO(jarin) kLazyDeoptimization and kNeedsFrameState should be unified. | 46 // TODO(jarin) kLazyDeoptimization and kNeedsFrameState should be unified. |
47 kNoFlags = 0u, | 47 kNoFlags = 0u, |
48 kLazyDeoptimization = 1u << 0, | 48 kNeedsFrameState = 1u << 0, |
49 kNeedsFrameState = 1u << 1, | 49 kPatchableCallSite = 1u << 1, |
50 kPatchableCallSite = 1u << 2, | 50 kNeedsNopAfterCall = 1u << 2, |
51 kNeedsNopAfterCall = 1u << 3, | |
52 kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall | 51 kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall |
53 }; | 52 }; |
54 DEFINE_FLAGS(Flags, Flag); | 53 DEFINE_FLAGS(Flags, Flag); |
55 | 54 |
56 CallDescriptor(Kind kind, int8_t return_count, int16_t parameter_count, | 55 CallDescriptor(Kind kind, int8_t return_count, int16_t parameter_count, |
57 int16_t input_count, LinkageLocation* locations, | 56 int16_t input_count, LinkageLocation* locations, |
58 Operator::Property properties, RegList callee_saved_registers, | 57 Operator::Property properties, RegList callee_saved_registers, |
59 Flags flags, const char* debug_name = "") | 58 Flags flags, const char* debug_name = "") |
60 : kind_(kind), | 59 : kind_(kind), |
61 return_count_(return_count), | 60 return_count_(return_count), |
(...skipping 16 matching lines...) Expand all Loading... |
78 // The number of JavaScript parameters to this call, including receiver, | 77 // The number of JavaScript parameters to this call, including receiver, |
79 // but not the context. | 78 // but not the context. |
80 int ParameterCount() const { return parameter_count_; } | 79 int ParameterCount() const { return parameter_count_; } |
81 | 80 |
82 int InputCount() const { return input_count_; } | 81 int InputCount() const { return input_count_; } |
83 | 82 |
84 int FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } | 83 int FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } |
85 | 84 |
86 Flags flags() const { return flags_; } | 85 Flags flags() const { return flags_; } |
87 | 86 |
88 bool CanLazilyDeoptimize() const { return flags() & kLazyDeoptimization; } | |
89 bool NeedsFrameState() const { return flags() & kNeedsFrameState; } | 87 bool NeedsFrameState() const { return flags() & kNeedsFrameState; } |
90 | 88 |
91 LinkageLocation GetReturnLocation(int index) { | 89 LinkageLocation GetReturnLocation(int index) { |
92 DCHECK(index < return_count_); | 90 DCHECK(index < return_count_); |
93 return locations_[0 + index]; // return locations start at 0. | 91 return locations_[0 + index]; // return locations start at 0. |
94 } | 92 } |
95 | 93 |
96 LinkageLocation GetInputLocation(int index) { | 94 LinkageLocation GetInputLocation(int index) { |
97 DCHECK(index < input_count_ + 1); // input_count + 1 is the context. | 95 DCHECK(index < input_count_ + 1); // input_count + 1 is the context. |
98 return locations_[return_count_ + index]; // inputs start after returns. | 96 return locations_[return_count_ + index]; // inputs start after returns. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 private: | 194 private: |
197 CompilationInfo* info_; | 195 CompilationInfo* info_; |
198 CallDescriptor* incoming_; | 196 CallDescriptor* incoming_; |
199 }; | 197 }; |
200 | 198 |
201 } // namespace compiler | 199 } // namespace compiler |
202 } // namespace internal | 200 } // namespace internal |
203 } // namespace v8 | 201 } // namespace v8 |
204 | 202 |
205 #endif // V8_COMPILER_LINKAGE_H_ | 203 #endif // V8_COMPILER_LINKAGE_H_ |
OLD | NEW |