Revision: 23474
Author:   [email protected]
Date:     Thu Aug 28 07:02:53 2014 UTC
Log:      Sub-minor-key-ify four HydrogenCodeStubs.

- FastNewContextStub
- FastCloneShallowArrayStub
- ToBooleanStub
- ElementsTransitionAndStoreStub.

[email protected]

Review URL: https://codereview.chromium.org/513653003
https://code.google.com/p/v8/source/detail?r=23474

Modified:
 /branches/bleeding_edge/src/code-stubs-hydrogen.cc
 /branches/bleeding_edge/src/code-stubs.cc
 /branches/bleeding_edge/src/code-stubs.h

=======================================
--- /branches/bleeding_edge/src/code-stubs-hydrogen.cc Tue Aug 26 14:12:47 2014 UTC +++ /branches/bleeding_edge/src/code-stubs-hydrogen.cc Thu Aug 28 07:02:53 2014 UTC
@@ -1063,7 +1063,7 @@
   HValue* true_value = NULL;
   HValue* false_value = NULL;

-  switch (stub->GetMode()) {
+  switch (stub->mode()) {
     case ToBooleanStub::RESULT_AS_SMI:
       true_value = graph()->GetConstant1();
       false_value = graph()->GetConstant0();
@@ -1079,7 +1079,7 @@
   }

   IfBuilder if_true(this);
-  if_true.If<HBranch>(GetParameter(0), stub->GetTypes());
+  if_true.If<HBranch>(GetParameter(0), stub->types());
   if_true.Then();
   if_true.Return(true_value);
   if_true.Else();
=======================================
--- /branches/bleeding_edge/src/code-stubs.cc   Wed Aug 27 10:00:06 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.cc   Thu Aug 28 07:02:53 2014 UTC
@@ -810,15 +810,17 @@


 bool ToBooleanStub::UpdateStatus(Handle<Object> object) {
-  Types old_types(types_);
-  bool to_boolean_value = types_.UpdateStatus(object);
-  TraceTransition(old_types, types_);
+  Types new_types = types();
+  Types old_types = new_types;
+  bool to_boolean_value = new_types.UpdateStatus(object);
+  TraceTransition(old_types, new_types);
+ set_sub_minor_key(TypesBits::update(sub_minor_key(), new_types.ToByte()));
   return to_boolean_value;
 }


 void ToBooleanStub::PrintState(OStream& os) const {  // NOLINT
-  os << types_;
+  os << types();
 }


=======================================
--- /branches/bleeding_edge/src/code-stubs.h    Wed Aug 27 10:27:52 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.h    Thu Aug 28 07:02:53 2014 UTC
@@ -644,9 +644,9 @@
  public:
   static const int kMaximumSlots = 64;

-  FastNewContextStub(Isolate* isolate, int slots)
-      : HydrogenCodeStub(isolate), slots_(slots) {
-    DCHECK(slots_ > 0 && slots_ <= kMaximumSlots);
+ FastNewContextStub(Isolate* isolate, int slots) : HydrogenCodeStub(isolate) {
+    DCHECK(slots > 0 && slots <= kMaximumSlots);
+    set_sub_minor_key(SlotsBits::encode(slots));
   }

   virtual Handle<Code> GenerateCode() V8_OVERRIDE;
@@ -656,16 +656,17 @@

   static void InstallDescriptors(Isolate* isolate);

-  int slots() const { return slots_; }
-
-  virtual Major MajorKey() const V8_OVERRIDE { return FastNewContext; }
-  virtual int NotMissMinorKey() const V8_OVERRIDE { return slots_; }
+  int slots() const { return SlotsBits::decode(sub_minor_key()); }

   // Parameters accessed via CodeStubGraphBuilder::GetParameter()
   static const int kFunction = 0;

  private:
-  int slots_;
+  virtual Major MajorKey() const V8_OVERRIDE { return FastNewContext; }
+
+  class SlotsBits : public BitField<int, 0, 8> {};
+
+  DISALLOW_COPY_AND_ASSIGN(FastNewContextStub);
 };


@@ -673,11 +674,12 @@
  public:
   FastCloneShallowArrayStub(Isolate* isolate,
                             AllocationSiteMode allocation_site_mode)
-      : HydrogenCodeStub(isolate),
-      allocation_site_mode_(allocation_site_mode) {}
+      : HydrogenCodeStub(isolate) {
+ set_sub_minor_key(AllocationSiteModeBits::encode(allocation_site_mode));
+  }

   AllocationSiteMode allocation_site_mode() const {
-    return allocation_site_mode_;
+    return AllocationSiteModeBits::decode(sub_minor_key());
   }

   virtual Handle<Code> GenerateCode();
@@ -688,14 +690,11 @@
   static void InstallDescriptors(Isolate* isolate);

  private:
-  AllocationSiteMode allocation_site_mode_;
+ virtual Major MajorKey() const V8_OVERRIDE { return FastCloneShallowArray; }

class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {};
-  // Ensure data fits within available bits.
- virtual Major MajorKey() const V8_OVERRIDE { return FastCloneShallowArray; }
-  int NotMissMinorKey() const {
-    return AllocationSiteModeBits::encode(allocation_site_mode_);
-  }
+
+  DISALLOW_COPY_AND_ASSIGN(FastCloneShallowArrayStub);
 };


@@ -2498,15 +2497,20 @@
   };

   ToBooleanStub(Isolate* isolate, ResultMode mode, Types types = Types())
-      : HydrogenCodeStub(isolate), types_(types), mode_(mode) {}
+      : HydrogenCodeStub(isolate) {
+    set_sub_minor_key(TypesBits::encode(types.ToByte()) |
+                      ResultModeBits::encode(mode));
+  }
+
   ToBooleanStub(Isolate* isolate, ExtraICState state)
-      : HydrogenCodeStub(isolate),
-        types_(static_cast<byte>(state)),
-        mode_(RESULT_AS_SMI) {}
+      : HydrogenCodeStub(isolate) {
+    set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) |
+                      ResultModeBits::encode(RESULT_AS_SMI));
+  }

   bool UpdateStatus(Handle<Object> object);
-  Types GetTypes() { return types_; }
-  ResultMode GetMode() { return mode_; }
+  Types types() const { return Types(TypesBits::decode(sub_minor_key())); }
+ ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); }

   virtual Handle<Code> GenerateCode() V8_OVERRIDE;
   virtual void InitializeInterfaceDescriptor(
@@ -2527,10 +2531,10 @@
     return ToBooleanStub(isolate, UNINITIALIZED).GetCode();
   }

- virtual ExtraICState GetExtraICState() const { return types_.ToIntegral(); } + virtual ExtraICState GetExtraICState() const { return types().ToIntegral(); }

   virtual InlineCacheState GetICState() const {
-    if (types_.IsEmpty()) {
+    if (types().IsEmpty()) {
       return ::v8::internal::UNINITIALIZED;
     } else {
       return MONOMORPHIC;
@@ -2538,19 +2542,17 @@
   }

  private:
-  class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {};
- class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {};
+  virtual Major MajorKey() const V8_OVERRIDE { return ToBoolean; }

-  virtual Major MajorKey() const V8_OVERRIDE { return ToBoolean; }
-  int NotMissMinorKey() const {
- return TypesBits::encode(types_.ToByte()) | ResultModeBits::encode(mode_);
+  ToBooleanStub(Isolate* isolate, InitializationState init_state)
+      : HydrogenCodeStub(isolate, init_state) {
+    set_sub_minor_key(ResultModeBits::encode(RESULT_AS_SMI));
   }

-  ToBooleanStub(Isolate* isolate, InitializationState init_state)
-      : HydrogenCodeStub(isolate, init_state), mode_(RESULT_AS_SMI) {}
+  class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {};
+ class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {};

-  Types types_;
-  ResultMode mode_;
+  DISALLOW_COPY_AND_ASSIGN(ToBooleanStub);
 };


@@ -2559,21 +2561,21 @@

 class ElementsTransitionAndStoreStub : public HydrogenCodeStub {
  public:
-  ElementsTransitionAndStoreStub(Isolate* isolate,
-                                 ElementsKind from_kind,
-                                 ElementsKind to_kind,
-                                 bool is_jsarray,
+  ElementsTransitionAndStoreStub(Isolate* isolate, ElementsKind from_kind,
+                                 ElementsKind to_kind, bool is_jsarray,
                                  KeyedAccessStoreMode store_mode)
-      : HydrogenCodeStub(isolate),
-        from_kind_(from_kind),
-        to_kind_(to_kind),
-        is_jsarray_(is_jsarray),
-        store_mode_(store_mode) {}
+      : HydrogenCodeStub(isolate) {
+ set_sub_minor_key(FromBits::encode(from_kind) | ToBits::encode(to_kind) |
+                      IsJSArrayBits::encode(is_jsarray) |
+                      StoreModeBits::encode(store_mode));
+  }

-  ElementsKind from_kind() const { return from_kind_; }
-  ElementsKind to_kind() const { return to_kind_; }
-  bool is_jsarray() const { return is_jsarray_; }
-  KeyedAccessStoreMode store_mode() const { return store_mode_; }
+ ElementsKind from_kind() const { return FromBits::decode(sub_minor_key()); }
+  ElementsKind to_kind() const { return ToBits::decode(sub_minor_key()); }
+ bool is_jsarray() const { return IsJSArrayBits::decode(sub_minor_key()); }
+  KeyedAccessStoreMode store_mode() const {
+    return StoreModeBits::decode(sub_minor_key());
+  }

   virtual Handle<Code> GenerateCode() V8_OVERRIDE;

@@ -2601,25 +2603,14 @@
   }

  private:
-  class FromBits:      public BitField<ElementsKind,          0, 8> {};
-  class ToBits:        public BitField<ElementsKind,          8, 8> {};
-  class IsJSArrayBits: public BitField<bool,                 16, 1> {};
-  class StoreModeBits: public BitField<KeyedAccessStoreMode, 17, 4> {};
-
   virtual Major MajorKey() const V8_OVERRIDE {
     return ElementsTransitionAndStore;
   }
-  int NotMissMinorKey() const {
-    return FromBits::encode(from_kind_) |
-        ToBits::encode(to_kind_) |
-        IsJSArrayBits::encode(is_jsarray_) |
-        StoreModeBits::encode(store_mode_);
-  }

-  ElementsKind from_kind_;
-  ElementsKind to_kind_;
-  bool is_jsarray_;
-  KeyedAccessStoreMode store_mode_;
+  class FromBits : public BitField<ElementsKind, 0, 8> {};
+  class ToBits : public BitField<ElementsKind, 8, 8> {};
+  class IsJSArrayBits : public BitField<bool, 16, 1> {};
+  class StoreModeBits : public BitField<KeyedAccessStoreMode, 17, 4> {};

   DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub);
 };

--
--
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