Revision: 23566
Author:   [email protected]
Date:     Mon Sep  1 13:55:39 2014 UTC
Log:      Sub-minor-key-ify HandlerStubs.

[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/code-stubs-hydrogen.cc Thu Aug 28 07:02:53 2014 UTC +++ /branches/bleeding_edge/src/code-stubs-hydrogen.cc Mon Sep 1 13:55:39 2014 UTC
@@ -595,7 +595,7 @@
   HValue* descriptors =
Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), descriptors_access);
   HObjectAccess value_access = HObjectAccess::ForObservableJSObjectOffset(
-      DescriptorArray::GetValueOffset(casted_stub()->descriptor()));
+      DescriptorArray::GetValueOffset(casted_stub()->constant_index()));
   return Add<HLoadNamedField>(descriptors, static_cast<HValue*>(NULL),
                               value_access);
 }
=======================================
--- /branches/bleeding_edge/src/code-stubs.h    Mon Sep  1 09:18:39 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.h    Mon Sep  1 13:55:39 2014 UTC
@@ -438,8 +438,9 @@

   static const int kSubMinorKeyBits = kStubMinorKeyBits - 1;

+  class SubMinorKeyBits : public BitField<int, 0, kSubMinorKeyBits> {};
+
  private:
-  class SubMinorKeyBits : public BitField<int, 0, kSubMinorKeyBits> {};
   class IsMissBits : public BitField<bool, kSubMinorKeyBits, 1> {};

   void GenerateLightweightMiss(MacroAssembler* masm);
@@ -897,25 +898,27 @@
       CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;

  protected:
-  explicit HandlerStub(Isolate* isolate)
-      : HydrogenCodeStub(isolate), bit_field_(0) {}
-  virtual int NotMissMinorKey() const { return bit_field_; }
+  explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
   virtual Code::Kind kind() const = 0;
-  int bit_field_;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(HandlerStub);
 };


 class LoadFieldStub: public HandlerStub {
  public:
-  LoadFieldStub(Isolate* isolate, FieldIndex index)
-    : HandlerStub(isolate), index_(index) {
-    int property_index_key = index_.GetFieldAccessStubKey();
-    bit_field_ = EncodedLoadFieldByIndexBits::encode(property_index_key);
+ LoadFieldStub(Isolate* isolate, FieldIndex index) : HandlerStub(isolate) {
+    int property_index_key = index.GetFieldAccessStubKey();
+    set_sub_minor_key(LoadFieldByIndexBits::encode(property_index_key));
   }

   virtual Handle<Code> GenerateCode() V8_OVERRIDE;

-  FieldIndex index() const { return index_; }
+  FieldIndex index() const {
+    int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key());
+    return FieldIndex::FromFieldAccessStubKey(property_index_key);
+  }

  protected:
   explicit LoadFieldStub(Isolate* isolate);
@@ -923,21 +926,26 @@
   virtual Code::StubType GetStubType() { return Code::FAST; }

  private:
-  class EncodedLoadFieldByIndexBits : public BitField<int, 0, 13> {};
   virtual Major MajorKey() const V8_OVERRIDE { return LoadField; }
-  FieldIndex index_;
+
+  class LoadFieldByIndexBits : public BitField<int, 0, 13> {};
+
+  DISALLOW_COPY_AND_ASSIGN(LoadFieldStub);
 };


 class LoadConstantStub : public HandlerStub {
  public:
- LoadConstantStub(Isolate* isolate, int descriptor) : HandlerStub(isolate) {
-    bit_field_ = descriptor;
+  LoadConstantStub(Isolate* isolate, int constant_index)
+      : HandlerStub(isolate) {
+    set_sub_minor_key(ConstantIndexBits::encode(constant_index));
   }

   virtual Handle<Code> GenerateCode() V8_OVERRIDE;

-  int descriptor() const { return bit_field_; }
+  int constant_index() const {
+    return ConstantIndexBits::decode(sub_minor_key());
+  }

  protected:
   explicit LoadConstantStub(Isolate* isolate);
@@ -946,6 +954,10 @@

  private:
   virtual Major MajorKey() const V8_OVERRIDE { return LoadConstant; }
+
+  class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {};
+
+  DISALLOW_COPY_AND_ASSIGN(LoadConstantStub);
 };


@@ -960,6 +972,8 @@

  private:
   virtual Major MajorKey() const V8_OVERRIDE { return StringLength; }
+
+  DISALLOW_COPY_AND_ASSIGN(StringLengthStub);
 };


@@ -967,17 +981,25 @@
  public:
   StoreFieldStub(Isolate* isolate, FieldIndex index,
                  Representation representation)
- : HandlerStub(isolate), index_(index), representation_(representation) {
-    int property_index_key = index_.GetFieldAccessStubKey();
-    bit_field_ = EncodedStoreFieldByIndexBits::encode(property_index_key) |
-                 RepresentationBits::encode(
- PropertyDetails::EncodeRepresentation(representation));
+      : HandlerStub(isolate) {
+    int property_index_key = index.GetFieldAccessStubKey();
+    uint8_t repr = PropertyDetails::EncodeRepresentation(representation);
+    set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) |
+                      RepresentationBits::encode(repr));
   }

   virtual Handle<Code> GenerateCode() V8_OVERRIDE;

-  FieldIndex index() const { return index_; }
-  Representation representation() { return representation_; }
+  FieldIndex index() const {
+ int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key());
+    return FieldIndex::FromFieldAccessStubKey(property_index_key);
+  }
+
+  Representation representation() {
+    uint8_t repr = RepresentationBits::decode(sub_minor_key());
+    return PropertyDetails::DecodeRepresentation(repr);
+  }
+
   static void InstallDescriptors(Isolate* isolate);

  protected:
@@ -986,11 +1008,12 @@
   virtual Code::StubType GetStubType() { return Code::FAST; }

  private:
-  class EncodedStoreFieldByIndexBits : public BitField<int, 0, 13> {};
-  class RepresentationBits : public BitField<int, 13, 4> {};
   virtual Major MajorKey() const V8_OVERRIDE { return StoreField; }
-  FieldIndex index_;
-  Representation representation_;
+
+  class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
+  class RepresentationBits : public BitField<uint8_t, 13, 4> {};
+
+  DISALLOW_COPY_AND_ASSIGN(StoreFieldStub);
 };


@@ -998,8 +1021,8 @@
  public:
   StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global)
       : HandlerStub(isolate) {
-    bit_field_ = IsConstantBits::encode(is_constant) |
-        CheckGlobalBits::encode(check_global);
+    set_sub_minor_key(IsConstantBits::encode(is_constant) |
+                      CheckGlobalBits::encode(check_global));
   }

   static Handle<HeapObject> global_placeholder(Isolate* isolate) {
@@ -1025,21 +1048,21 @@

   virtual Handle<Code> GenerateCode() V8_OVERRIDE;

-  bool is_constant() const {
-    return IsConstantBits::decode(bit_field_);
-  }
-  bool check_global() const {
-    return CheckGlobalBits::decode(bit_field_);
-  }
+ bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); }
+
+ bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); }
+
   void set_is_constant(bool value) {
-    bit_field_ = IsConstantBits::update(bit_field_, value);
+    set_sub_minor_key(IsConstantBits::update(sub_minor_key(), value));
   }

   Representation representation() {
- return Representation::FromKind(RepresentationBits::decode(bit_field_));
+    return Representation::FromKind(
+        RepresentationBits::decode(sub_minor_key()));
   }
+
   void set_representation(Representation r) {
-    bit_field_ = RepresentationBits::update(bit_field_, r.kind());
+ set_sub_minor_key(RepresentationBits::update(sub_minor_key(), r.kind()));
   }

  private:
=======================================
--- /branches/bleeding_edge/src/field-index-inl.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/field-index-inl.h Mon Sep 1 13:55:39 2014 UTC
@@ -108,6 +108,11 @@
     return ForPropertyIndex(map, index);
   }
 }
+
+
+inline FieldIndex FieldIndex::FromFieldAccessStubKey(int key) {
+  return FieldIndex(key);
+}


 inline int FieldIndex::GetKeyedLookupCacheIndex() const {
=======================================
--- /branches/bleeding_edge/src/field-index.h   Tue Aug 26 16:32:51 2014 UTC
+++ /branches/bleeding_edge/src/field-index.h   Mon Sep  1 13:55:39 2014 UTC
@@ -26,6 +26,7 @@
   static FieldIndex ForDescriptor(Map* map, int descriptor_index);
   static FieldIndex ForLoadByFieldIndex(Map* map, int index);
   static FieldIndex ForKeyedLookupCacheIndex(Map* map, int index);
+  static FieldIndex FromFieldAccessStubKey(int key);

   int GetLoadByFieldIndex() const;

@@ -81,6 +82,8 @@
       IndexBits::encode(local_index) |
       InObjectPropertyBits::encode(inobject_properties);
   }
+
+  explicit FieldIndex(int bit_field) : bit_field_(bit_field) {}

   int first_inobject_property_offset() const {
     DCHECK(!IsHiddenField::decode(bit_field_));

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