| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
| 6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
| 10 #include "src/code-stub-assembler.h" | 10 #include "src/code-stub-assembler.h" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 public: \ | 427 public: \ |
| 428 Handle<Code> GenerateCode() override; \ | 428 Handle<Code> GenerateCode() override; \ |
| 429 DEFINE_CODE_STUB(NAME, SUPER) | 429 DEFINE_CODE_STUB(NAME, SUPER) |
| 430 | 430 |
| 431 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ | 431 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ |
| 432 public: \ | 432 public: \ |
| 433 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ | 433 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ |
| 434 return NAME##Descriptor(isolate()); \ | 434 return NAME##Descriptor(isolate()); \ |
| 435 } | 435 } |
| 436 | 436 |
| 437 #define DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(PARAMETER_COUNT) \ |
| 438 public: \ |
| 439 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ |
| 440 return OnStackArgsDescriptorBase::ForArgs(isolate(), PARAMETER_COUNT); \ |
| 441 } |
| 442 |
| 437 // There are some code stubs we just can't describe right now with a | 443 // There are some code stubs we just can't describe right now with a |
| 438 // CallInterfaceDescriptor. Isolate behavior for those cases with this macro. | 444 // CallInterfaceDescriptor. Isolate behavior for those cases with this macro. |
| 439 // An attempt to retrieve a descriptor will fail. | 445 // An attempt to retrieve a descriptor will fail. |
| 440 #define DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR() \ | 446 #define DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR() \ |
| 441 public: \ | 447 public: \ |
| 442 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ | 448 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ |
| 443 UNREACHABLE(); \ | 449 UNREACHABLE(); \ |
| 444 return CallInterfaceDescriptor(); \ | 450 return CallInterfaceDescriptor(); \ |
| 445 } | 451 } |
| 446 | 452 |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 class MathPowStub: public PlatformCodeStub { | 1327 class MathPowStub: public PlatformCodeStub { |
| 1322 public: | 1328 public: |
| 1323 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; | 1329 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; |
| 1324 | 1330 |
| 1325 MathPowStub(Isolate* isolate, ExponentType exponent_type) | 1331 MathPowStub(Isolate* isolate, ExponentType exponent_type) |
| 1326 : PlatformCodeStub(isolate) { | 1332 : PlatformCodeStub(isolate) { |
| 1327 minor_key_ = ExponentTypeBits::encode(exponent_type); | 1333 minor_key_ = ExponentTypeBits::encode(exponent_type); |
| 1328 } | 1334 } |
| 1329 | 1335 |
| 1330 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { | 1336 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { |
| 1331 if (exponent_type() == TAGGED) { | 1337 if (exponent_type() == ON_STACK) { |
| 1338 return OnStackArgsDescriptorBase::ForArgs(isolate(), 2); |
| 1339 } else if (exponent_type() == TAGGED) { |
| 1332 return MathPowTaggedDescriptor(isolate()); | 1340 return MathPowTaggedDescriptor(isolate()); |
| 1333 } else if (exponent_type() == INTEGER) { | 1341 } else if (exponent_type() == INTEGER) { |
| 1334 return MathPowIntegerDescriptor(isolate()); | 1342 return MathPowIntegerDescriptor(isolate()); |
| 1343 } else { |
| 1344 // A CallInterfaceDescriptor doesn't specify double registers (yet). |
| 1345 DCHECK_EQ(DOUBLE, exponent_type()); |
| 1346 return ContextOnlyDescriptor(isolate()); |
| 1335 } | 1347 } |
| 1336 // A CallInterfaceDescriptor doesn't specify double registers (yet). | |
| 1337 return ContextOnlyDescriptor(isolate()); | |
| 1338 } | 1348 } |
| 1339 | 1349 |
| 1340 private: | 1350 private: |
| 1341 ExponentType exponent_type() const { | 1351 ExponentType exponent_type() const { |
| 1342 return ExponentTypeBits::decode(minor_key_); | 1352 return ExponentTypeBits::decode(minor_key_); |
| 1343 } | 1353 } |
| 1344 | 1354 |
| 1345 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; | 1355 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; |
| 1346 | 1356 |
| 1347 DEFINE_PLATFORM_CODE_STUB(MathPow, PlatformCodeStub); | 1357 DEFINE_PLATFORM_CODE_STUB(MathPow, PlatformCodeStub); |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 | 2086 |
| 2077 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 2087 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
| 2078 DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub); | 2088 DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub); |
| 2079 }; | 2089 }; |
| 2080 | 2090 |
| 2081 | 2091 |
| 2082 class RegExpExecStub: public PlatformCodeStub { | 2092 class RegExpExecStub: public PlatformCodeStub { |
| 2083 public: | 2093 public: |
| 2084 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 2094 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
| 2085 | 2095 |
| 2086 DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly); | 2096 DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(4); |
| 2087 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); | 2097 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub); |
| 2088 }; | 2098 }; |
| 2089 | 2099 |
| 2090 | 2100 |
| 2091 class RegExpConstructResultStub final : public HydrogenCodeStub { | 2101 class RegExpConstructResultStub final : public HydrogenCodeStub { |
| 2092 public: | 2102 public: |
| 2093 explicit RegExpConstructResultStub(Isolate* isolate) | 2103 explicit RegExpConstructResultStub(Isolate* isolate) |
| 2094 : HydrogenCodeStub(isolate) { } | 2104 : HydrogenCodeStub(isolate) { } |
| 2095 | 2105 |
| 2096 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 2106 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3061 | 3071 |
| 3062 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 3072 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
| 3063 DEFINE_PLATFORM_CODE_STUB(StoreBufferOverflow, PlatformCodeStub); | 3073 DEFINE_PLATFORM_CODE_STUB(StoreBufferOverflow, PlatformCodeStub); |
| 3064 }; | 3074 }; |
| 3065 | 3075 |
| 3066 | 3076 |
| 3067 class SubStringStub : public PlatformCodeStub { | 3077 class SubStringStub : public PlatformCodeStub { |
| 3068 public: | 3078 public: |
| 3069 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 3079 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
| 3070 | 3080 |
| 3071 DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly); | 3081 DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(3); |
| 3072 DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub); | 3082 DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub); |
| 3073 }; | 3083 }; |
| 3074 | 3084 |
| 3075 class ToStringStub final : public PlatformCodeStub { | 3085 class ToStringStub final : public PlatformCodeStub { |
| 3076 public: | 3086 public: |
| 3077 explicit ToStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 3087 explicit ToStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
| 3078 | 3088 |
| 3079 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); | 3089 DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); |
| 3080 DEFINE_PLATFORM_CODE_STUB(ToString, PlatformCodeStub); | 3090 DEFINE_PLATFORM_CODE_STUB(ToString, PlatformCodeStub); |
| 3081 }; | 3091 }; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3103 #undef DEFINE_HYDROGEN_CODE_STUB | 3113 #undef DEFINE_HYDROGEN_CODE_STUB |
| 3104 #undef DEFINE_CODE_STUB | 3114 #undef DEFINE_CODE_STUB |
| 3105 #undef DEFINE_CODE_STUB_BASE | 3115 #undef DEFINE_CODE_STUB_BASE |
| 3106 | 3116 |
| 3107 extern Representation RepresentationFromType(Type* type); | 3117 extern Representation RepresentationFromType(Type* type); |
| 3108 | 3118 |
| 3109 } // namespace internal | 3119 } // namespace internal |
| 3110 } // namespace v8 | 3120 } // namespace v8 |
| 3111 | 3121 |
| 3112 #endif // V8_CODE_STUBS_H_ | 3122 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |