Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index 040bf10f774597fed42d95832a349d03631a1899..2c5fd6820f38cfde6e57bcafa8a5e2a0eb09376b 100644 |
--- a/src/code-stubs.h |
+++ b/src/code-stubs.h |
@@ -89,6 +89,9 @@ namespace internal { |
V(TransitionElementsKind) \ |
V(VectorRawKeyedLoad) \ |
V(VectorRawLoad) \ |
+ /* TurboFanCodeStubs */ \ |
+ V(StringLengthTF) \ |
+ V(MathFloor) \ |
/* IC Handler stubs */ \ |
V(ArrayBufferViewLoadField) \ |
V(LoadConstant) \ |
@@ -152,6 +155,8 @@ namespace internal { |
CODE_STUB_LIST_PPC(V) \ |
CODE_STUB_LIST_MIPS(V) |
+static const int kHasReturnedMinusZeroSentinel = 1; |
+ |
// Stub is base classes of all stubs. |
class CodeStub BASE_EMBEDDED { |
public: |
@@ -206,6 +211,8 @@ class CodeStub BASE_EMBEDDED { |
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() = 0; |
+ virtual int GetStackParameterCount() const { return 0; } |
+ |
virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) {} |
static void InitializeDescriptor(Isolate* isolate, uint32_t key, |
@@ -348,6 +355,19 @@ struct FakeStubForTesting : public CodeStub { |
Handle<Code> GenerateCode() override; \ |
DEFINE_CODE_STUB(NAME, SUPER) |
+#define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER, DESC, STACK_PARAMS) \ |
+ public: \ |
+ NAME##Stub(Isolate* isolate) : SUPER(isolate) {} \ |
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() override { \ |
+ return DESC(isolate()); \ |
+ }; \ |
+ virtual const char* GetFunctionName() const override { \ |
+ return #NAME "_STUB"; \ |
+ } \ |
+ int GetStackParameterCount() const override { return STACK_PARAMS; } \ |
+ Code::StubType GetStubType() const override { return Code::FAST; } \ |
+ DEFINE_CODE_STUB(NAME, SUPER) |
+ |
#define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ |
public: \ |
Handle<Code> GenerateCode() override; \ |
@@ -518,6 +538,23 @@ class HydrogenCodeStub : public CodeStub { |
}; |
+class TurboFanCodeStub : public CodeStub { |
+ public: |
+ Code::Kind GetCodeKind() const override { return Code::STUB; } |
+ |
+ // Retrieve the code for the stub. Generate the code if needed. |
+ Handle<Code> GenerateCode() override; |
+ |
+ virtual const char* GetFunctionName() const = 0; |
+ |
+ protected: |
+ explicit TurboFanCodeStub(Isolate* isolate) : CodeStub(isolate) {} |
+ |
+ private: |
+ DEFINE_CODE_STUB_BASE(TurboFanCodeStub, CodeStub); |
+}; |
+ |
+ |
// Helper interface to prepare to/restore after making runtime calls. |
class RuntimeCallHelper { |
public: |
@@ -584,6 +621,23 @@ class NopRuntimeCallHelper : public RuntimeCallHelper { |
}; |
+class MathFloorStub : public TurboFanCodeStub { |
+ DEFINE_TURBOFAN_CODE_STUB(MathFloor, TurboFanCodeStub, |
+ MathRoundVariantDescriptor, 1); |
+}; |
+ |
+ |
+class StringLengthTFStub : public TurboFanCodeStub { |
+ DEFINE_TURBOFAN_CODE_STUB(StringLengthTF, TurboFanCodeStub, LoadDescriptor, |
+ 0); |
+ |
+ public: |
+ Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
+ InlineCacheState GetICState() const override { return MONOMORPHIC; } |
+ ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } |
+}; |
+ |
+ |
class NumberToStringStub final : public HydrogenCodeStub { |
public: |
explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |