| 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_CALL_INTERFACE_DESCRIPTOR_H_ | 5 #ifndef V8_CALL_INTERFACE_DESCRIPTOR_H_ |
| 6 #define V8_CALL_INTERFACE_DESCRIPTOR_H_ | 6 #define V8_CALL_INTERFACE_DESCRIPTOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| 11 #include "src/globals.h" | 11 #include "src/globals.h" |
| 12 #include "src/macro-assembler.h" | 12 #include "src/macro-assembler.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 class PlatformInterfaceDescriptor; | 17 class PlatformInterfaceDescriptor; |
| 18 | 18 |
| 19 #define INTERFACE_DESCRIPTOR_LIST(V) \ | 19 #define INTERFACE_DESCRIPTOR_LIST(V) \ |
| 20 V(Void) \ | 20 V(Void) \ |
| 21 V(ContextOnly) \ | 21 V(ContextOnly) \ |
| 22 V(Load) \ | 22 V(Load) \ |
| 23 V(LoadWithVector) \ | 23 V(LoadWithVector) \ |
| 24 V(LoadField) \ | 24 V(LoadField) \ |
| 25 V(LoadICProtoArray) \ | 25 V(LoadICProtoArray) \ |
| 26 V(LoadGlobal) \ | 26 V(LoadGlobal) \ |
| 27 V(LoadGlobalWithVector) \ | 27 V(LoadGlobalWithVector) \ |
| 28 V(Store) \ | 28 V(Store) \ |
| 29 V(StoreWithVector) \ | 29 V(StoreWithVector) \ |
| 30 V(StoreNamedTransition) \ | 30 V(StoreNamedTransition) \ |
| 31 V(StoreTransition) \ | 31 V(StoreTransition) \ |
| 32 V(VarArgFunction) \ | 32 V(VarArgFunction) \ |
| 33 V(FastNewClosure) \ | 33 V(FastNewClosure) \ |
| 34 V(FastNewFunctionContext) \ | 34 V(FastNewFunctionContext) \ |
| 35 V(FastNewObject) \ | 35 V(FastNewObject) \ |
| 36 V(FastNewArguments) \ | 36 V(FastNewArguments) \ |
| 37 V(TypeConversion) \ | 37 V(TypeConversion) \ |
| 38 V(Typeof) \ | 38 V(Typeof) \ |
| 39 V(FastCloneRegExp) \ | 39 V(FastCloneRegExp) \ |
| 40 V(FastCloneShallowArray) \ | 40 V(FastCloneShallowArray) \ |
| 41 V(FastCloneShallowObject) \ | 41 V(FastCloneShallowObject) \ |
| 42 V(CreateAllocationSite) \ | 42 V(CreateAllocationSite) \ |
| 43 V(CreateWeakCell) \ | 43 V(CreateWeakCell) \ |
| 44 V(CallFunction) \ | 44 V(CallFunction) \ |
| 45 V(CallIC) \ | 45 V(CallIC) \ |
| 46 V(CallICTrampoline) \ | 46 V(CallICTrampoline) \ |
| 47 V(CallForwardVarargs) \ | 47 V(CallForwardVarargs) \ |
| 48 V(CallConstruct) \ | 48 V(CallConstruct) \ |
| 49 V(CallTrampoline) \ | 49 V(CallTrampoline) \ |
| 50 V(ConstructStub) \ | 50 V(ConstructStub) \ |
| 51 V(ConstructTrampoline) \ | 51 V(ConstructTrampoline) \ |
| 52 V(RegExpExec) \ | 52 V(RegExpExec) \ |
| 53 V(RegExpReplace) \ | 53 V(RegExpReplace) \ |
| 54 V(RegExpSplit) \ | 54 V(RegExpSplit) \ |
| 55 V(CopyFastSmiOrObjectElements) \ | 55 V(CopyFastSmiOrObjectElements) \ |
| 56 V(TransitionElementsKind) \ | 56 V(TransitionElementsKind) \ |
| 57 V(AllocateHeapNumber) \ | 57 V(AllocateHeapNumber) \ |
| 58 V(Builtin) \ | 58 V(Builtin) \ |
| 59 V(ArrayConstructor) \ | 59 V(ArrayConstructor) \ |
| 60 V(ForEach) \ | 60 V(IteratingArrayBuiltin) \ |
| 61 V(ArrayNoArgumentConstructor) \ | 61 V(IteratingArrayBuiltinLoopContinuation) \ |
| 62 V(ArraySingleArgumentConstructor) \ | 62 V(ArrayNoArgumentConstructor) \ |
| 63 V(ArrayNArgumentsConstructor) \ | 63 V(ArraySingleArgumentConstructor) \ |
| 64 V(Compare) \ | 64 V(ArrayNArgumentsConstructor) \ |
| 65 V(BinaryOp) \ | 65 V(Compare) \ |
| 66 V(BinaryOpWithAllocationSite) \ | 66 V(BinaryOp) \ |
| 67 V(BinaryOpWithVector) \ | 67 V(BinaryOpWithAllocationSite) \ |
| 68 V(CountOp) \ | 68 V(BinaryOpWithVector) \ |
| 69 V(StringAdd) \ | 69 V(CountOp) \ |
| 70 V(StringCharAt) \ | 70 V(StringAdd) \ |
| 71 V(StringCharCodeAt) \ | 71 V(StringCharAt) \ |
| 72 V(StringCompare) \ | 72 V(StringCharCodeAt) \ |
| 73 V(StringIndexOf) \ | 73 V(StringCompare) \ |
| 74 V(SubString) \ | 74 V(StringIndexOf) \ |
| 75 V(Keyed) \ | 75 V(SubString) \ |
| 76 V(Named) \ | 76 V(Keyed) \ |
| 77 V(CreateIterResultObject) \ | 77 V(Named) \ |
| 78 V(HasProperty) \ | 78 V(CreateIterResultObject) \ |
| 79 V(ForInFilter) \ | 79 V(HasProperty) \ |
| 80 V(ForInNext) \ | 80 V(ForInFilter) \ |
| 81 V(ForInPrepare) \ | 81 V(ForInNext) \ |
| 82 V(GetProperty) \ | 82 V(ForInPrepare) \ |
| 83 V(CallHandler) \ | 83 V(GetProperty) \ |
| 84 V(ArgumentAdaptor) \ | 84 V(CallHandler) \ |
| 85 V(ApiCallback) \ | 85 V(ArgumentAdaptor) \ |
| 86 V(ApiGetter) \ | 86 V(ApiCallback) \ |
| 87 V(MathPowTagged) \ | 87 V(ApiGetter) \ |
| 88 V(MathPowInteger) \ | 88 V(MathPowTagged) \ |
| 89 V(GrowArrayElements) \ | 89 V(MathPowInteger) \ |
| 90 V(NewArgumentsElements) \ | 90 V(GrowArrayElements) \ |
| 91 V(InterpreterDispatch) \ | 91 V(NewArgumentsElements) \ |
| 92 V(InterpreterPushArgsAndCall) \ | 92 V(InterpreterDispatch) \ |
| 93 V(InterpreterPushArgsAndConstruct) \ | 93 V(InterpreterPushArgsAndCall) \ |
| 94 V(InterpreterPushArgsAndConstructArray) \ | 94 V(InterpreterPushArgsAndConstruct) \ |
| 95 V(InterpreterCEntry) \ | 95 V(InterpreterPushArgsAndConstructArray) \ |
| 96 V(ResumeGenerator) \ | 96 V(InterpreterCEntry) \ |
| 97 V(FrameDropperTrampoline) \ | 97 V(ResumeGenerator) \ |
| 98 V(PromiseHandleReject) \ | 98 V(FrameDropperTrampoline) \ |
| 99 V(PromiseHandleReject) \ |
| 99 V(WasmRuntimeCall) | 100 V(WasmRuntimeCall) |
| 100 | 101 |
| 101 class V8_EXPORT_PRIVATE CallInterfaceDescriptorData { | 102 class V8_EXPORT_PRIVATE CallInterfaceDescriptorData { |
| 102 public: | 103 public: |
| 103 CallInterfaceDescriptorData() : register_param_count_(-1), param_count_(-1) {} | 104 CallInterfaceDescriptorData() : register_param_count_(-1), param_count_(-1) {} |
| 104 | 105 |
| 105 // A copy of the passed in registers and param_representations is made | 106 // A copy of the passed in registers and param_representations is made |
| 106 // and owned by the CallInterfaceDescriptorData. | 107 // and owned by the CallInterfaceDescriptorData. |
| 107 | 108 |
| 108 void InitializePlatformSpecific( | 109 void InitializePlatformSpecific( |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 public: | 280 public: |
| 280 | 281 |
| 281 #define DEFINE_PARAMETERS(...) \ | 282 #define DEFINE_PARAMETERS(...) \ |
| 282 enum ParameterIndices { \ | 283 enum ParameterIndices { \ |
| 283 __VA_ARGS__, \ | 284 __VA_ARGS__, \ |
| 284 \ | 285 \ |
| 285 kParameterCount, \ | 286 kParameterCount, \ |
| 286 kContext = kParameterCount /* implicit parameter */ \ | 287 kContext = kParameterCount /* implicit parameter */ \ |
| 287 }; | 288 }; |
| 288 | 289 |
| 289 #define DECLARE_BUILTIN_DESCRIPTOR(name) \ | 290 #define DECLARE_BUILTIN_DESCRIPTOR(name) \ |
| 290 DECLARE_DESCRIPTOR_WITH_BASE(name, BuiltinDescriptor) \ | 291 DECLARE_DESCRIPTOR_WITH_BASE(name, BuiltinDescriptor) \ |
| 291 protected: \ | 292 protected: \ |
| 292 void InitializePlatformIndependent(CallInterfaceDescriptorData* data) \ | 293 void InitializePlatformIndependent(CallInterfaceDescriptorData* data) \ |
| 293 override { \ | 294 override { \ |
| 294 MachineType machine_types[] = {MachineType::AnyTagged(), \ | 295 MachineType machine_types[] = {MachineType::AnyTagged(), \ |
| 295 MachineType::AnyTagged(), \ | 296 MachineType::AnyTagged(), \ |
| 296 MachineType::Int32()}; \ | 297 MachineType::Int32()}; \ |
| 297 int argc = kStackParameterCount + 1 - arraysize(machine_types); \ | 298 data->InitializePlatformIndependent(arraysize(machine_types), \ |
| 298 data->InitializePlatformIndependent(arraysize(machine_types), argc, \ | 299 kStackParameterCount, machine_types); \ |
| 299 machine_types); \ | 300 } \ |
| 300 } \ | 301 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) \ |
| 301 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) \ | 302 override { \ |
| 302 override { \ | 303 Register registers[] = {TargetRegister(), NewTargetRegister(), \ |
| 303 Register registers[] = {TargetRegister(), NewTargetRegister(), \ | 304 ArgumentsCountRegister()}; \ |
| 304 ArgumentsCountRegister()}; \ | 305 data->InitializePlatformSpecific(arraysize(registers), registers); \ |
| 305 data->InitializePlatformSpecific(arraysize(registers), registers); \ | 306 } \ |
| 306 } \ | 307 \ |
| 307 \ | |
| 308 public: | 308 public: |
| 309 | 309 |
| 310 #define DEFINE_BUILTIN_PARAMETERS(...) \ | 310 #define DEFINE_BUILTIN_PARAMETERS(...) \ |
| 311 enum ParameterIndices { \ | 311 enum ParameterIndices { \ |
| 312 kReceiver, \ | 312 kReceiver, \ |
| 313 kBeforeFirstStackParameter = kReceiver, \ | 313 kBeforeFirstStackParameter = kReceiver, \ |
| 314 __VA_ARGS__, \ | 314 __VA_ARGS__, \ |
| 315 kAfterLastStackParameter, \ | 315 kAfterLastStackParameter, \ |
| 316 kNewTarget = kAfterLastStackParameter, \ | 316 kNewTarget = kAfterLastStackParameter, \ |
| 317 kArgumentsCount, \ | 317 kArgumentsCount, \ |
| 318 kContext, /* implicit parameter */ \ | 318 kContext, /* implicit parameter */ \ |
| 319 kParameterCount = kContext, \ | 319 kParameterCount = kContext, \ |
| 320 kStackParameterCount = \ | 320 kArity = kAfterLastStackParameter - kBeforeFirstStackParameter - 1, \ |
| 321 kAfterLastStackParameter - kBeforeFirstStackParameter - 1, \ | 321 kStackParameterCount = kArity + 1 \ |
| 322 }; | 322 }; |
| 323 | 323 |
| 324 class VoidDescriptor : public CallInterfaceDescriptor { | 324 class VoidDescriptor : public CallInterfaceDescriptor { |
| 325 public: | 325 public: |
| 326 DECLARE_DESCRIPTOR(VoidDescriptor, CallInterfaceDescriptor) | 326 DECLARE_DESCRIPTOR(VoidDescriptor, CallInterfaceDescriptor) |
| 327 }; | 327 }; |
| 328 | 328 |
| 329 class ContextOnlyDescriptor : public CallInterfaceDescriptor { | 329 class ContextOnlyDescriptor : public CallInterfaceDescriptor { |
| 330 public: | 330 public: |
| 331 DECLARE_DESCRIPTOR(ContextOnlyDescriptor, CallInterfaceDescriptor) | 331 DECLARE_DESCRIPTOR(ContextOnlyDescriptor, CallInterfaceDescriptor) |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 public: | 695 public: |
| 696 // TODO(ishell): Where is kFunction?? | 696 // TODO(ishell): Where is kFunction?? |
| 697 DEFINE_PARAMETERS(kNewTarget, kArgumentsCount) | 697 DEFINE_PARAMETERS(kNewTarget, kArgumentsCount) |
| 698 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(BuiltinDescriptor, | 698 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(BuiltinDescriptor, |
| 699 CallInterfaceDescriptor) | 699 CallInterfaceDescriptor) |
| 700 static const Register ArgumentsCountRegister(); | 700 static const Register ArgumentsCountRegister(); |
| 701 static const Register NewTargetRegister(); | 701 static const Register NewTargetRegister(); |
| 702 static const Register TargetRegister(); | 702 static const Register TargetRegister(); |
| 703 }; | 703 }; |
| 704 | 704 |
| 705 class ForEachDescriptor : public BuiltinDescriptor { | 705 class IteratingArrayBuiltinDescriptor : public BuiltinDescriptor { |
| 706 public: | 706 public: |
| 707 DEFINE_BUILTIN_PARAMETERS(kCallback, kThisArg) | 707 DEFINE_BUILTIN_PARAMETERS(kCallback, kThisArg) |
| 708 DECLARE_BUILTIN_DESCRIPTOR(ForEachDescriptor) | 708 DECLARE_BUILTIN_DESCRIPTOR(IteratingArrayBuiltinDescriptor) |
| 709 }; |
| 710 |
| 711 class IteratingArrayBuiltinLoopContinuationDescriptor |
| 712 : public BuiltinDescriptor { |
| 713 public: |
| 714 DEFINE_BUILTIN_PARAMETERS(kCallback, kThisArg, kArray, kObject, kInitialK, |
| 715 kLength) |
| 716 DECLARE_BUILTIN_DESCRIPTOR(IteratingArrayBuiltinLoopContinuationDescriptor) |
| 709 }; | 717 }; |
| 710 | 718 |
| 711 class ArrayConstructorDescriptor : public CallInterfaceDescriptor { | 719 class ArrayConstructorDescriptor : public CallInterfaceDescriptor { |
| 712 public: | 720 public: |
| 713 DEFINE_PARAMETERS(kTarget, kNewTarget, kActualArgumentsCount, kAllocationSite) | 721 DEFINE_PARAMETERS(kTarget, kNewTarget, kActualArgumentsCount, kAllocationSite) |
| 714 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArrayConstructorDescriptor, | 722 DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArrayConstructorDescriptor, |
| 715 CallInterfaceDescriptor) | 723 CallInterfaceDescriptor) |
| 716 }; | 724 }; |
| 717 | 725 |
| 718 class ArrayNoArgumentConstructorDescriptor : public CallInterfaceDescriptor { | 726 class ArrayNoArgumentConstructorDescriptor : public CallInterfaceDescriptor { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 } // namespace v8 | 989 } // namespace v8 |
| 982 | 990 |
| 983 | 991 |
| 984 #if V8_TARGET_ARCH_ARM64 | 992 #if V8_TARGET_ARCH_ARM64 |
| 985 #include "src/arm64/interface-descriptors-arm64.h" | 993 #include "src/arm64/interface-descriptors-arm64.h" |
| 986 #elif V8_TARGET_ARCH_ARM | 994 #elif V8_TARGET_ARCH_ARM |
| 987 #include "src/arm/interface-descriptors-arm.h" | 995 #include "src/arm/interface-descriptors-arm.h" |
| 988 #endif | 996 #endif |
| 989 | 997 |
| 990 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ | 998 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ |
| OLD | NEW |