Added a DependentCode field to AllocationSite. It's not currently used,

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
parent 53194b44
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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)
......
......@@ -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();
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment