Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Unified Diff: src/code-stubs.h

Issue 1225943002: Reland: Add unoptimized/optimized variants of MathFloor TF code stub (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix nosnap bug Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm64/interface-descriptors-arm64.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index c06c6c1fe498b1a9daf9314017a54d0dcf89f659..a798d5e35010e21646886de17de70556188f235f 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -94,6 +94,7 @@ namespace internal {
/* TurboFanCodeStubs */ \
V(StringLengthTF) \
V(StringAddTF) \
+ /* TurboFanICs */ \
V(MathFloor) \
/* IC Handler stubs */ \
V(ArrayBufferViewLoadField) \
@@ -216,7 +217,9 @@ class CodeStub BASE_EMBEDDED {
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() const = 0;
- virtual int GetStackParameterCount() const { return 0; }
+ virtual int GetStackParameterCount() const {
+ return GetCallInterfaceDescriptor().GetStackParameterCount();
+ }
virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) {}
@@ -360,6 +363,26 @@ struct FakeStubForTesting : public CodeStub {
Handle<Code> GenerateCode() override; \
DEFINE_CODE_STUB(NAME, SUPER)
+#define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \
+ public: \
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \
+ return DESC##Descriptor(isolate()); \
+ }; \
+ DEFINE_CODE_STUB(NAME, SUPER)
+
+#define DEFINE_TURBOFAN_IC(NAME, SUPER, DESC) \
+ public: \
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \
+ if (GetCallMode() == CALL_FROM_OPTIMIZED_CODE) { \
+ return DESC##CallFromOptimizedCodeDescriptor(isolate()); \
+ } else { \
+ return DESC##CallFromUnoptimizedCodeDescriptor(isolate()); \
+ } \
+ }; \
+ \
+ protected: \
+ DEFINE_CODE_STUB(NAME, SUPER)
+
#define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \
public: \
Handle<Code> GenerateCode() override; \
@@ -544,6 +567,33 @@ class TurboFanCodeStub : public CodeStub {
};
+class TurboFanIC : public TurboFanCodeStub {
+ public:
+ enum CallMode { CALL_FROM_UNOPTIMIZED_CODE, CALL_FROM_OPTIMIZED_CODE };
+
+ protected:
+ explicit TurboFanIC(Isolate* isolate, CallMode mode)
+ : TurboFanCodeStub(isolate) {
+ minor_key_ = CallModeBits::encode(mode);
+ }
+
+ CallMode GetCallMode() const { return CallModeBits::decode(minor_key_); }
+
+ void set_sub_minor_key(uint32_t key) {
+ minor_key_ = SubMinorKeyBits::update(minor_key_, key);
+ }
+
+ uint32_t sub_minor_key() const { return SubMinorKeyBits::decode(minor_key_); }
+
+ static const int kSubMinorKeyBits = kStubMinorKeyBits - 1;
+
+ private:
+ class CallModeBits : public BitField<CallMode, 0, 1> {};
+ class SubMinorKeyBits : public BitField<int, 1, kSubMinorKeyBits> {};
+ DEFINE_CODE_STUB_BASE(TurboFanIC, TurboFanCodeStub);
+};
+
+
// Helper interface to prepare to/restore after making runtime calls.
class RuntimeCallHelper {
public:
@@ -610,13 +660,12 @@ class NopRuntimeCallHelper : public RuntimeCallHelper {
};
-class MathFloorStub : public TurboFanCodeStub {
+class MathFloorStub : public TurboFanIC {
public:
- explicit MathFloorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
- int GetStackParameterCount() const override { return 1; }
-
- DEFINE_CALL_INTERFACE_DESCRIPTOR(MathRoundVariant);
- DEFINE_CODE_STUB(MathFloor, TurboFanCodeStub);
+ explicit MathFloorStub(Isolate* isolate, TurboFanIC::CallMode mode)
+ : TurboFanIC(isolate, mode) {}
+ Code::Kind GetCodeKind() const override { return Code::CALL_IC; }
+ DEFINE_TURBOFAN_IC(MathFloor, TurboFanIC, MathRoundVariant);
};
« no previous file with comments | « src/arm64/interface-descriptors-arm64.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698