Revision: 22559
Author:   [email protected]
Date:     Wed Jul 23 12:24:11 2014 UTC
Log:      Express LoadIC extra ic state with LoadIC::State

Soon we will create code stubs that need to match LoadIC state. It's easier to express if the state is encapsulated in a single class rather than multiple bit
fields.

[email protected]

Review URL: https://codereview.chromium.org/415543002
http://code.google.com/p/v8/source/detail?r=22559

Modified:
 /branches/bleeding_edge/src/ic.h

=======================================
--- /branches/bleeding_edge/src/ic.h    Wed Jul 23 11:16:29 2014 UTC
+++ /branches/bleeding_edge/src/ic.h    Wed Jul 23 12:24:11 2014 UTC
@@ -374,10 +374,6 @@

 class LoadIC: public IC {
  public:
-  // ExtraICState bits
-  class ContextualModeBits: public BitField<ContextualMode, 0, 1> {};
-  STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0);
-
   enum ParameterIndices {
     kReceiverIndex,
     kNameIndex,
@@ -391,16 +387,37 @@
   static const Register SlotRegister();
   static const Register VectorRegister();

+  class State V8_FINAL BASE_EMBEDDED {
+   public:
+    explicit State(ExtraICState extra_ic_state)
+        : state_(extra_ic_state) {}
+
+    explicit State(ContextualMode mode)
+        : state_(ContextualModeBits::encode(mode)) {}
+
+    ExtraICState GetExtraICState() const { return state_; }
+
+    ContextualMode contextual_mode() const {
+      return ContextualModeBits::decode(state_);
+    }
+
+   private:
+    class ContextualModeBits: public BitField<ContextualMode, 0, 1> {};
+    STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0);
+
+    const ExtraICState state_;
+  };
+
   static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) {
-    return ContextualModeBits::encode(contextual_mode);
+    return State(contextual_mode).GetExtraICState();
   }

   static ContextualMode GetContextualMode(ExtraICState state) {
-    return ContextualModeBits::decode(state);
+    return State(state).contextual_mode();
   }

   ContextualMode contextual_mode() const {
-    return ContextualModeBits::decode(extra_ic_state());
+    return GetContextualMode(extra_ic_state());
   }

   explicit LoadIC(FrameDepth depth, Isolate* isolate)

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to