| 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/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 int16_t location_; // >= 0 implies register, otherwise stack slot. | 36 int16_t location_; // >= 0 implies register, otherwise stack slot. |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 | 39 |
| 40 class CallDescriptor : public ZoneObject { | 40 class CallDescriptor : public ZoneObject { |
| 41 public: | 41 public: |
| 42 // Describes whether the first parameter is a code object, a JSFunction, | 42 // Describes whether the first parameter is a code object, a JSFunction, |
| 43 // or an address--all of which require different machine sequences to call. | 43 // or an address--all of which require different machine sequences to call. |
| 44 enum Kind { kCallCodeObject, kCallJSFunction, kCallAddress }; | 44 enum Kind { kCallCodeObject, kCallJSFunction, kCallAddress }; |
| 45 | 45 |
| 46 enum DeoptimizationSupport { kCanDeoptimize, kCannotDeoptimize }; | 46 // TODO(jarin) kLazyDeoptimization and kNeedsFrameState should be unified. |
| 47 enum DeoptimizationSupport { |
| 48 kNoDeoptimization = 0, |
| 49 kLazyDeoptimization = 1, |
| 50 kNeedsFrameState = 2 |
| 51 }; |
| 47 | 52 |
| 48 CallDescriptor(Kind kind, int8_t return_count, int16_t parameter_count, | 53 CallDescriptor(Kind kind, int8_t return_count, int16_t parameter_count, |
| 49 int16_t input_count, LinkageLocation* locations, | 54 int16_t input_count, LinkageLocation* locations, |
| 50 Operator::Property properties, RegList callee_saved_registers, | 55 Operator::Property properties, RegList callee_saved_registers, |
| 51 DeoptimizationSupport deoptimization_support, | 56 DeoptimizationSupport deoptimization_support, |
| 52 const char* debug_name = "") | 57 const char* debug_name = "") |
| 53 : kind_(kind), | 58 : kind_(kind), |
| 54 return_count_(return_count), | 59 return_count_(return_count), |
| 55 parameter_count_(parameter_count), | 60 parameter_count_(parameter_count), |
| 56 input_count_(input_count), | 61 input_count_(input_count), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 67 | 72 |
| 68 // The number of return values from this call, usually 0 or 1. | 73 // The number of return values from this call, usually 0 or 1. |
| 69 int ReturnCount() const { return return_count_; } | 74 int ReturnCount() const { return return_count_; } |
| 70 | 75 |
| 71 // The number of JavaScript parameters to this call, including receiver, | 76 // The number of JavaScript parameters to this call, including receiver, |
| 72 // but not the context. | 77 // but not the context. |
| 73 int ParameterCount() const { return parameter_count_; } | 78 int ParameterCount() const { return parameter_count_; } |
| 74 | 79 |
| 75 int InputCount() const { return input_count_; } | 80 int InputCount() const { return input_count_; } |
| 76 | 81 |
| 82 int FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } |
| 83 |
| 77 bool CanLazilyDeoptimize() const { | 84 bool CanLazilyDeoptimize() const { |
| 78 return deoptimization_support_ == kCanDeoptimize; | 85 return (deoptimization_support() & kLazyDeoptimization) != 0; |
| 86 } |
| 87 |
| 88 bool NeedsFrameState() const { |
| 89 return (deoptimization_support() & kNeedsFrameState) != 0; |
| 90 } |
| 91 |
| 92 DeoptimizationSupport deoptimization_support() const { |
| 93 return deoptimization_support_; |
| 79 } | 94 } |
| 80 | 95 |
| 81 LinkageLocation GetReturnLocation(int index) { | 96 LinkageLocation GetReturnLocation(int index) { |
| 82 DCHECK(index < return_count_); | 97 DCHECK(index < return_count_); |
| 83 return locations_[0 + index]; // return locations start at 0. | 98 return locations_[0 + index]; // return locations start at 0. |
| 84 } | 99 } |
| 85 | 100 |
| 86 LinkageLocation GetInputLocation(int index) { | 101 LinkageLocation GetInputLocation(int index) { |
| 87 DCHECK(index < input_count_ + 1); // input_count + 1 is the context. | 102 DCHECK(index < input_count_ + 1); // input_count + 1 is the context. |
| 88 return locations_[return_count_ + index]; // inputs start after returns. | 103 return locations_[return_count_ + index]; // inputs start after returns. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 149 |
| 135 // The call descriptor for this compilation unit describes the locations | 150 // The call descriptor for this compilation unit describes the locations |
| 136 // of incoming parameters and the outgoing return value(s). | 151 // of incoming parameters and the outgoing return value(s). |
| 137 CallDescriptor* GetIncomingDescriptor() { return incoming_; } | 152 CallDescriptor* GetIncomingDescriptor() { return incoming_; } |
| 138 CallDescriptor* GetJSCallDescriptor(int parameter_count); | 153 CallDescriptor* GetJSCallDescriptor(int parameter_count); |
| 139 static CallDescriptor* GetJSCallDescriptor(int parameter_count, Zone* zone); | 154 static CallDescriptor* GetJSCallDescriptor(int parameter_count, Zone* zone); |
| 140 CallDescriptor* GetRuntimeCallDescriptor( | 155 CallDescriptor* GetRuntimeCallDescriptor( |
| 141 Runtime::FunctionId function, int parameter_count, | 156 Runtime::FunctionId function, int parameter_count, |
| 142 Operator::Property properties, | 157 Operator::Property properties, |
| 143 CallDescriptor::DeoptimizationSupport can_deoptimize = | 158 CallDescriptor::DeoptimizationSupport can_deoptimize = |
| 144 CallDescriptor::kCannotDeoptimize); | 159 CallDescriptor::kNoDeoptimization); |
| 145 static CallDescriptor* GetRuntimeCallDescriptor( | 160 static CallDescriptor* GetRuntimeCallDescriptor( |
| 146 Runtime::FunctionId function, int parameter_count, | 161 Runtime::FunctionId function, int parameter_count, |
| 147 Operator::Property properties, | 162 Operator::Property properties, |
| 148 CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone); | 163 CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone); |
| 149 | 164 |
| 150 CallDescriptor* GetStubCallDescriptor( | 165 CallDescriptor* GetStubCallDescriptor( |
| 151 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count = 0, | 166 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count = 0, |
| 152 CallDescriptor::DeoptimizationSupport can_deoptimize = | 167 CallDescriptor::DeoptimizationSupport can_deoptimize = |
| 153 CallDescriptor::kCannotDeoptimize); | 168 CallDescriptor::kNoDeoptimization); |
| 154 static CallDescriptor* GetStubCallDescriptor( | 169 static CallDescriptor* GetStubCallDescriptor( |
| 155 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count, | 170 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count, |
| 156 CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone); | 171 CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone); |
| 157 | 172 |
| 158 // Creates a call descriptor for simplified C calls that is appropriate | 173 // Creates a call descriptor for simplified C calls that is appropriate |
| 159 // for the host platform. This simplified calling convention only supports | 174 // for the host platform. This simplified calling convention only supports |
| 160 // integers and pointers of one word size each, i.e. no floating point, | 175 // integers and pointers of one word size each, i.e. no floating point, |
| 161 // structs, pointers to members, etc. | 176 // structs, pointers to members, etc. |
| 162 static CallDescriptor* GetSimplifiedCDescriptor( | 177 static CallDescriptor* GetSimplifiedCDescriptor( |
| 163 Zone* zone, int num_params, MachineType return_type, | 178 Zone* zone, int num_params, MachineType return_type, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 184 | 199 |
| 185 private: | 200 private: |
| 186 CompilationInfo* info_; | 201 CompilationInfo* info_; |
| 187 CallDescriptor* incoming_; | 202 CallDescriptor* incoming_; |
| 188 }; | 203 }; |
| 189 } | 204 } |
| 190 } | 205 } |
| 191 } // namespace v8::internal::compiler | 206 } // namespace v8::internal::compiler |
| 192 | 207 |
| 193 #endif // V8_COMPILER_LINKAGE_H_ | 208 #endif // V8_COMPILER_LINKAGE_H_ |
| OLD | NEW |