Added a DependentCode field to AllocationSite. It's not currently used,
authormvstanton@chromium.org <mvstanton@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 19 Sep 2013 14:13:34 +0000 (14:13 +0000)
committermvstanton@chromium.org <mvstanton@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 19 Sep 2013 14:13:34 +0000 (14:13 +0000)
this initial CL is just to get the object layout correct.

BUG=
R=hpayer@chromium.org, mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/23567003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16833 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/code-stubs-hydrogen.cc
src/heap-snapshot-generator.cc
src/hydrogen-instructions.h
src/objects-inl.h
src/objects-printer.cc
src/objects.h

index 1a6ae00..0e1c941 100644 (file)
@@ -474,14 +474,22 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
                         HObjectAccess::ForAllocationSiteTransitionInfo(),
                         initial_elements_kind);
 
+  // Store an empty fixed array for the code dependency.
+  HConstant* empty_fixed_array =
+    Add<HConstant>(isolate()->factory()->empty_fixed_array());
+  HStoreNamedField* store = Add<HStoreNamedField>(
+      object,
+      HObjectAccess::ForAllocationSiteDependentCode(),
+      empty_fixed_array);
+
   // Link the object to the allocation site list
   HValue* site_list = Add<HConstant>(
       ExternalReference::allocation_sites_list_address(isolate()));
   HValue* site = Add<HLoadNamedField>(site_list,
                                       HObjectAccess::ForAllocationSiteList());
-  HStoreNamedField* store =
-      Add<HStoreNamedField>(object, HObjectAccess::ForAllocationSiteWeakNext(),
-                            site);
+  store = Add<HStoreNamedField>(object,
+                                HObjectAccess::ForAllocationSiteWeakNext(),
+                                site);
   store->SkipWriteBarrier();
   Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(),
                         object);
index 2d31ca4..5799132 100644 (file)
@@ -1301,6 +1301,8 @@ void V8HeapExplorer::ExtractAllocationSiteReferences(int entry,
                                                      AllocationSite* site) {
   SetInternalReference(site, entry, "transition_info", site->transition_info(),
                        AllocationSite::kTransitionInfoOffset);
+  SetInternalReference(site, entry, "dependent_code", site->dependent_code(),
+                       AllocationSite::kDependentCodeOffset);
 }
 
 
index 5bb7f48..75b18f4 100644 (file)
@@ -351,6 +351,7 @@ class UniqueValueId V8_FINAL {
   IMMOVABLE_UNIQUE_VALUE_ID(false_value)
   IMMOVABLE_UNIQUE_VALUE_ID(the_hole_value)
   IMMOVABLE_UNIQUE_VALUE_ID(empty_string)
+  IMMOVABLE_UNIQUE_VALUE_ID(empty_fixed_array)
 
 #undef IMMOVABLE_UNIQUE_VALUE_ID
 
@@ -3366,7 +3367,8 @@ class HConstant V8_FINAL : public HTemplateInstruction<0> {
            unique_id_ == UniqueValueId::true_value(heap) ||
            unique_id_ == UniqueValueId::false_value(heap) ||
            unique_id_ == UniqueValueId::the_hole_value(heap) ||
-           unique_id_ == UniqueValueId::empty_string(heap);
+           unique_id_ == UniqueValueId::empty_string(heap) ||
+           unique_id_ == UniqueValueId::empty_fixed_array(heap);
   }
 
   bool IsCell() const {
@@ -5671,6 +5673,10 @@ class HObjectAccess V8_FINAL {
     return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset);
   }
 
+  static HObjectAccess ForAllocationSiteDependentCode() {
+    return HObjectAccess(kInobject, AllocationSite::kDependentCodeOffset);
+  }
+
   static HObjectAccess ForAllocationSiteWeakNext() {
     return HObjectAccess(kInobject, AllocationSite::kWeakNextOffset);
   }
index 56fde30..4ee4372 100644 (file)
@@ -1323,6 +1323,13 @@ bool JSObject::ShouldTrackAllocationInfo() {
 }
 
 
+void AllocationSite::Initialize() {
+  SetElementsKind(GetInitialFastElementsKind());
+  set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()),
+                     SKIP_WRITE_BARRIER);
+}
+
+
 // Heuristic: We only need to create allocation site info if the boilerplate
 // elements kind is the initial elements kind.
 AllocationSiteMode AllocationSite::GetMode(
@@ -4480,6 +4487,8 @@ ACCESSORS(SignatureInfo, args, Object, kArgsOffset)
 ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset)
 
 ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset)
+ACCESSORS(AllocationSite, dependent_code, DependentCode,
+          kDependentCodeOffset)
 ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset)
 ACCESSORS(AllocationMemento, allocation_site, Object, kAllocationSiteOffset)
 
index 0b8fdfd..26a7098 100644 (file)
@@ -1100,9 +1100,10 @@ void AllocationSite::AllocationSitePrint(FILE* out) {
   HeapObject::PrintHeader(out, "AllocationSite");
   PrintF(out, " - weak_next: ");
   weak_next()->ShortPrint(out);
-  PrintF(out, "\n");
+  PrintF(out, "\n - dependent code: ");
+  dependent_code()->ShortPrint(out);
 
-  PrintF(out, " - transition_info: ");
+  PrintF(out, "\n - transition_info: ");
   if (transition_info()->IsCell()) {
     Cell* cell = Cell::cast(transition_info());
     Object* cell_contents = cell->value();
index 41a513c..25a6f76 100644 (file)
@@ -7837,11 +7837,10 @@ class AllocationSite: public Struct {
   static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
 
   DECL_ACCESSORS(transition_info, Object)
+  DECL_ACCESSORS(dependent_code, DependentCode)
   DECL_ACCESSORS(weak_next, Object)
 
-  void Initialize() {
-    SetElementsKind(GetInitialFastElementsKind());
-  }
+  inline void Initialize();
 
   ElementsKind GetElementsKind() {
     ASSERT(!IsLiteralSite());
@@ -7869,11 +7868,12 @@ class AllocationSite: public Struct {
   static inline bool CanTrack(InstanceType type);
 
   static const int kTransitionInfoOffset = HeapObject::kHeaderSize;
-  static const int kWeakNextOffset = kTransitionInfoOffset + kPointerSize;
+  static const int kDependentCodeOffset = kTransitionInfoOffset + kPointerSize;
+  static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize;
   static const int kSize = kWeakNextOffset + kPointerSize;
 
   typedef FixedBodyDescriptor<HeapObject::kHeaderSize,
-                              kTransitionInfoOffset + kPointerSize,
+                              kDependentCodeOffset + kPointerSize,
                               kSize> BodyDescriptor;
 
  private: