Revision: 17408
Author:   mvstan...@chromium.org
Date:     Mon Oct 28 09:36:49 2013 UTC
Log:      Generalize AllocationSite field access in HObjectAccess.

There are simply becoming too many individual field accessors, and
more are coming.

R=hpa...@chromium.org

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

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

=======================================
--- /branches/bleeding_edge/src/code-stubs-hydrogen.cc Tue Oct 22 11:29:05 2013 UTC +++ /branches/bleeding_edge/src/code-stubs-hydrogen.cc Mon Oct 28 09:36:49 2013 UTC
@@ -371,7 +371,8 @@
                                                     undefined);
   checker.Then();

-  HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo();
+  HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
+      AllocationSite::kTransitionInfoOffset);
HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access);
   HValue* push_value;
   if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) {
@@ -440,7 +441,8 @@
                                                     undefined);
   checker.And();

-  HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo();
+  HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
+      AllocationSite::kTransitionInfoOffset);
HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access);

int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize;
@@ -500,12 +502,14 @@
   // Store the payload (smi elements kind)
HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind());
   Add<HStoreNamedField>(object,
-                        HObjectAccess::ForAllocationSiteTransitionInfo(),
+                        HObjectAccess::ForAllocationSiteOffset(
+                            AllocationSite::kTransitionInfoOffset),
                         initial_elements_kind);

   // Unlike literals, constructed arrays don't have nested sites
   Add<HStoreNamedField>(object,
-                        HObjectAccess::ForAllocationSiteNestedSite(),
+                        HObjectAccess::ForAllocationSiteOffset(
+                            AllocationSite::kNestedSiteOffset),
                         graph()->GetConstant0());

   // Store an empty fixed array for the code dependency.
@@ -513,7 +517,8 @@
     Add<HConstant>(isolate()->factory()->empty_fixed_array());
   HStoreNamedField* store = Add<HStoreNamedField>(
       object,
-      HObjectAccess::ForAllocationSiteDependentCode(),
+      HObjectAccess::ForAllocationSiteOffset(
+          AllocationSite::kDependentCodeOffset),
       empty_fixed_array);

   // Link the object to the allocation site list
@@ -522,8 +527,8 @@
   HValue* site = Add<HLoadNamedField>(site_list,
HObjectAccess::ForAllocationSiteList());
   store = Add<HStoreNamedField>(object,
-                                HObjectAccess::ForAllocationSiteWeakNext(),
-                                site);
+ HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset),
+      site);
   store->SkipWriteBarrier();
   Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(),
                         object);
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Wed Oct 23 13:03:15 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.h Mon Oct 28 09:36:49 2013 UTC
@@ -5786,20 +5786,9 @@
                 ? Representation::Smi() : Representation::Tagged());
   }

-  static HObjectAccess ForAllocationSiteTransitionInfo() {
-    return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset);
-  }
-
-  static HObjectAccess ForAllocationSiteNestedSite() {
-    return HObjectAccess(kInobject, AllocationSite::kNestedSiteOffset);
-  }
-
-  static HObjectAccess ForAllocationSiteDependentCode() {
-    return HObjectAccess(kInobject, AllocationSite::kDependentCodeOffset);
-  }
-
-  static HObjectAccess ForAllocationSiteWeakNext() {
-    return HObjectAccess(kInobject, AllocationSite::kWeakNextOffset);
+  static HObjectAccess ForAllocationSiteOffset(int offset) {
+ ASSERT(offset >= HeapObject::kHeaderSize && offset < AllocationSite::kSize);
+    return HObjectAccess(kInobject, offset);
   }

   static HObjectAccess ForAllocationSiteList() {

--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to