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/frames.h" | 12 #include "src/frames.h" |
13 #include "src/runtime/runtime.h" | 13 #include "src/runtime/runtime.h" |
14 #include "src/zone.h" | 14 #include "src/zone.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 class CallInterfaceDescriptor; | 19 class CallInterfaceDescriptor; |
20 class CompilationInfo; | 20 class CompilationInfo; |
21 | 21 |
22 namespace compiler { | 22 namespace compiler { |
23 | 23 |
24 const RegList kNoCalleeSaved = 0; | 24 const RegList kNoCalleeSaved = 0; |
25 | 25 |
| 26 class FrameAccessState; |
26 class Node; | 27 class Node; |
27 class OsrHelper; | 28 class OsrHelper; |
28 | 29 |
29 // Describes the location for a parameter or a return value to a call. | 30 // Describes the location for a parameter or a return value to a call. |
30 class LinkageLocation { | 31 class LinkageLocation { |
31 public: | 32 public: |
32 bool operator==(const LinkageLocation& other) const { | 33 bool operator==(const LinkageLocation& other) const { |
33 return bit_field_ == other.bit_field_; | 34 return bit_field_ == other.bit_field_; |
34 } | 35 } |
35 | 36 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 182 |
182 // Returns the kind of this call. | 183 // Returns the kind of this call. |
183 Kind kind() const { return kind_; } | 184 Kind kind() const { return kind_; } |
184 | 185 |
185 // Returns {true} if this descriptor is a call to a C function. | 186 // Returns {true} if this descriptor is a call to a C function. |
186 bool IsCFunctionCall() const { return kind_ == kCallAddress; } | 187 bool IsCFunctionCall() const { return kind_ == kCallAddress; } |
187 | 188 |
188 // Returns {true} if this descriptor is a call to a JSFunction. | 189 // Returns {true} if this descriptor is a call to a JSFunction. |
189 bool IsJSFunctionCall() const { return kind_ == kCallJSFunction; } | 190 bool IsJSFunctionCall() const { return kind_ == kCallJSFunction; } |
190 | 191 |
| 192 bool RequiresFrameAsIncoming() const { |
| 193 return IsCFunctionCall() || IsJSFunctionCall(); |
| 194 } |
| 195 |
191 // The number of return values from this call. | 196 // The number of return values from this call. |
192 size_t ReturnCount() const { return machine_sig_->return_count(); } | 197 size_t ReturnCount() const { return machine_sig_->return_count(); } |
193 | 198 |
194 // The number of C parameters to this call. | 199 // The number of C parameters to this call. |
195 size_t CParameterCount() const { return machine_sig_->parameter_count(); } | 200 size_t CParameterCount() const { return machine_sig_->parameter_count(); } |
196 | 201 |
197 // The number of stack parameters to the call. | 202 // The number of stack parameters to the call. |
198 size_t StackParameterCount() const { return stack_param_count_; } | 203 size_t StackParameterCount() const { return stack_param_count_; } |
199 | 204 |
200 // The number of parameters to the JS function call. | 205 // The number of parameters to the JS function call. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 return incoming_->GetReturnType(index); | 350 return incoming_->GetReturnType(index); |
346 } | 351 } |
347 | 352 |
348 bool ParameterHasSecondaryLocation(int index) const; | 353 bool ParameterHasSecondaryLocation(int index) const; |
349 LinkageLocation GetParameterSecondaryLocation(int index) const; | 354 LinkageLocation GetParameterSecondaryLocation(int index) const; |
350 | 355 |
351 // Get the frame offset for a given spill slot. The location depends on the | 356 // Get the frame offset for a given spill slot. The location depends on the |
352 // calling convention and the specific frame layout, and may thus be | 357 // calling convention and the specific frame layout, and may thus be |
353 // architecture-specific. Negative spill slots indicate arguments on the | 358 // architecture-specific. Negative spill slots indicate arguments on the |
354 // caller's frame. | 359 // caller's frame. |
355 FrameOffset GetFrameOffset(int spill_slot, Frame* frame) const; | 360 FrameOffset GetFrameOffset(int spill_slot, |
| 361 FrameAccessState* frame_access_state) const; |
356 | 362 |
357 static int FrameStateInputCount(Runtime::FunctionId function); | 363 static int FrameStateInputCount(Runtime::FunctionId function); |
358 | 364 |
359 // Get the location where an incoming OSR value is stored. | 365 // Get the location where an incoming OSR value is stored. |
360 LinkageLocation GetOsrValueLocation(int index) const; | 366 LinkageLocation GetOsrValueLocation(int index) const; |
361 | 367 |
362 // A special {Parameter} index for JSCalls that represents the new target. | 368 // A special {Parameter} index for JSCalls that represents the new target. |
363 static int GetJSCallNewTargetParamIndex(int parameter_count) { | 369 static int GetJSCallNewTargetParamIndex(int parameter_count) { |
364 return parameter_count + 0; // Parameter (arity + 0) is special. | 370 return parameter_count + 0; // Parameter (arity + 0) is special. |
365 } | 371 } |
(...skipping 27 matching lines...) Expand all Loading... |
393 CallDescriptor* const incoming_; | 399 CallDescriptor* const incoming_; |
394 | 400 |
395 DISALLOW_COPY_AND_ASSIGN(Linkage); | 401 DISALLOW_COPY_AND_ASSIGN(Linkage); |
396 }; | 402 }; |
397 | 403 |
398 } // namespace compiler | 404 } // namespace compiler |
399 } // namespace internal | 405 } // namespace internal |
400 } // namespace v8 | 406 } // namespace v8 |
401 | 407 |
402 #endif // V8_COMPILER_LINKAGE_H_ | 408 #endif // V8_COMPILER_LINKAGE_H_ |
OLD | NEW |