| 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" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 std::ostream& operator<<(std::ostream& os, const CallDescriptor& d); | 256 std::ostream& operator<<(std::ostream& os, const CallDescriptor& d); |
| 257 std::ostream& operator<<(std::ostream& os, const CallDescriptor::Kind& k); | 257 std::ostream& operator<<(std::ostream& os, const CallDescriptor::Kind& k); |
| 258 | 258 |
| 259 // Defines the linkage for a compilation, including the calling conventions | 259 // Defines the linkage for a compilation, including the calling conventions |
| 260 // for incoming parameters and return value(s) as well as the outgoing calling | 260 // for incoming parameters and return value(s) as well as the outgoing calling |
| 261 // convention for any kind of call. Linkage is generally architecture-specific. | 261 // convention for any kind of call. Linkage is generally architecture-specific. |
| 262 // | 262 // |
| 263 // Can be used to translate {arg_index} (i.e. index of the call node input) as | 263 // Can be used to translate {arg_index} (i.e. index of the call node input) as |
| 264 // well as {param_index} (i.e. as stored in parameter nodes) into an operator | 264 // well as {param_index} (i.e. as stored in parameter nodes) into an operator |
| 265 // representing the architecture-specific location. The following call node | 265 // representing the architecture-specific location. The following call node |
| 266 // layouts are supported (where {n} is the number value inputs): | 266 // layouts are supported (where {n} is the number of value inputs): |
| 267 // | 267 // |
| 268 // #0 #1 #2 #3 [...] #n | 268 // #0 #1 #2 #3 [...] #n |
| 269 // Call[CodeStub] code, arg 1, arg 2, arg 3, [...], context | 269 // Call[CodeStub] code, arg 1, arg 2, arg 3, [...], context |
| 270 // Call[JSFunction] function, rcvr, arg 1, arg 2, [...], #arg, context | 270 // Call[JSFunction] function, rcvr, arg 1, arg 2, [...], new, #arg, context |
| 271 // Call[Runtime] CEntryStub, arg 1, arg 2, arg 3, [...], fun, #arg, context | 271 // Call[Runtime] CEntryStub, arg 1, arg 2, arg 3, [...], fun, #arg, context |
| 272 class Linkage : public ZoneObject { | 272 class Linkage : public ZoneObject { |
| 273 public: | 273 public: |
| 274 explicit Linkage(CallDescriptor* incoming) : incoming_(incoming) {} | 274 explicit Linkage(CallDescriptor* incoming) : incoming_(incoming) {} |
| 275 | 275 |
| 276 static CallDescriptor* ComputeIncoming(Zone* zone, CompilationInfo* info); | 276 static CallDescriptor* ComputeIncoming(Zone* zone, CompilationInfo* info); |
| 277 | 277 |
| 278 // The call descriptor for this compilation unit describes the locations | 278 // The call descriptor for this compilation unit describes the locations |
| 279 // of incoming parameters and the outgoing return value(s). | 279 // of incoming parameters and the outgoing return value(s). |
| 280 CallDescriptor* GetIncomingDescriptor() const { return incoming_; } | 280 CallDescriptor* GetIncomingDescriptor() const { return incoming_; } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 // calling convention and the specific frame layout, and may thus be | 333 // calling convention and the specific frame layout, and may thus be |
| 334 // architecture-specific. Negative spill slots indicate arguments on the | 334 // architecture-specific. Negative spill slots indicate arguments on the |
| 335 // caller's frame. | 335 // caller's frame. |
| 336 FrameOffset GetFrameOffset(int spill_slot, Frame* frame) const; | 336 FrameOffset GetFrameOffset(int spill_slot, Frame* frame) const; |
| 337 | 337 |
| 338 static int FrameStateInputCount(Runtime::FunctionId function); | 338 static int FrameStateInputCount(Runtime::FunctionId function); |
| 339 | 339 |
| 340 // Get the location where an incoming OSR value is stored. | 340 // Get the location where an incoming OSR value is stored. |
| 341 LinkageLocation GetOsrValueLocation(int index) const; | 341 LinkageLocation GetOsrValueLocation(int index) const; |
| 342 | 342 |
| 343 // A special parameter index for JSCalls that represents the closure. | 343 // A special {Parameter} index for JSCalls that represents the new target. |
| 344 static const int kJSFunctionCallClosureParamIndex = -1; | 344 static int GetJSCallNewTargetParamIndex(int parameter_count) { |
| 345 return parameter_count + 0; // Parameter (arity + 0) is special. |
| 346 } |
| 347 |
| 348 // A special {Parameter} index for JSCalls that represents the argument count. |
| 349 static int GetJSCallArgCountParamIndex(int parameter_count) { |
| 350 return parameter_count + 1; // Parameter (arity + 1) is special. |
| 351 } |
| 352 |
| 353 // A special {Parameter} index for JSCalls that represents the context. |
| 354 static int GetJSCallContextParamIndex(int parameter_count) { |
| 355 return parameter_count + 2; // Parameter (arity + 2) is special. |
| 356 } |
| 357 |
| 358 // A special {Parameter} index for JSCalls that represents the closure. |
| 359 static const int kJSCallClosureParamIndex = -1; |
| 345 | 360 |
| 346 // A special {OsrValue} index to indicate the context spill slot. | 361 // A special {OsrValue} index to indicate the context spill slot. |
| 347 static const int kOsrContextSpillSlotIndex = -1; | 362 static const int kOsrContextSpillSlotIndex = -1; |
| 348 | 363 |
| 349 // Special parameter indices used to pass fixed register data through | 364 // Special parameter indices used to pass fixed register data through |
| 350 // interpreter dispatches. | 365 // interpreter dispatches. |
| 351 static const int kInterpreterAccumulatorParameter = 0; | 366 static const int kInterpreterAccumulatorParameter = 0; |
| 352 static const int kInterpreterRegisterFileParameter = 1; | 367 static const int kInterpreterRegisterFileParameter = 1; |
| 353 static const int kInterpreterBytecodeOffsetParameter = 2; | 368 static const int kInterpreterBytecodeOffsetParameter = 2; |
| 354 static const int kInterpreterBytecodeArrayParameter = 3; | 369 static const int kInterpreterBytecodeArrayParameter = 3; |
| 355 static const int kInterpreterDispatchTableParameter = 4; | 370 static const int kInterpreterDispatchTableParameter = 4; |
| 356 static const int kInterpreterContextParameter = 5; | 371 static const int kInterpreterContextParameter = 5; |
| 357 | 372 |
| 358 private: | 373 private: |
| 359 CallDescriptor* const incoming_; | 374 CallDescriptor* const incoming_; |
| 360 | 375 |
| 361 DISALLOW_COPY_AND_ASSIGN(Linkage); | 376 DISALLOW_COPY_AND_ASSIGN(Linkage); |
| 362 }; | 377 }; |
| 363 | 378 |
| 364 } // namespace compiler | 379 } // namespace compiler |
| 365 } // namespace internal | 380 } // namespace internal |
| 366 } // namespace v8 | 381 } // namespace v8 |
| 367 | 382 |
| 368 #endif // V8_COMPILER_LINKAGE_H_ | 383 #endif // V8_COMPILER_LINKAGE_H_ |
| OLD | NEW |