Add field nested_sites to AllocationSite. This field is used to maintain

allocation site information for nested array and object literals.
It's not used productively in this CL, merely maintained in a minimal
way. (that comes next :)).

BUG=
R=hpayer@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16912 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent cee57730
......@@ -486,6 +486,11 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
HObjectAccess::ForAllocationSiteTransitionInfo(),
initial_elements_kind);
// Unlike literals, constructed arrays don't have nested sites
Add<HStoreNamedField>(object,
HObjectAccess::ForAllocationSiteNestedSite(),
graph()->GetConstant0());
// Store an empty fixed array for the code dependency.
HConstant* empty_fixed_array =
Add<HConstant>(isolate()->factory()->empty_fixed_array());
......
......@@ -1301,6 +1301,8 @@ void V8HeapExplorer::ExtractAllocationSiteReferences(int entry,
AllocationSite* site) {
SetInternalReference(site, entry, "transition_info", site->transition_info(),
AllocationSite::kTransitionInfoOffset);
SetInternalReference(site, entry, "nested_site", site->nested_site(),
AllocationSite::kNestedSiteOffset);
SetInternalReference(site, entry, "dependent_code", site->dependent_code(),
AllocationSite::kDependentCodeOffset);
}
......
......@@ -5637,6 +5637,10 @@ class HObjectAccess V8_FINAL {
return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset);
}
static HObjectAccess ForAllocationSiteNestedSite() {
return HObjectAccess(kInobject, AllocationSite::kNestedSiteOffset);
}
static HObjectAccess ForAllocationSiteDependentCode() {
return HObjectAccess(kInobject, AllocationSite::kDependentCodeOffset);
}
......
......@@ -1324,6 +1324,7 @@ bool JSObject::ShouldTrackAllocationInfo() {
void AllocationSite::Initialize() {
SetElementsKind(GetInitialFastElementsKind());
set_nested_site(Smi::FromInt(0));
set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()),
SKIP_WRITE_BARRIER);
}
......@@ -4442,6 +4443,7 @@ ACCESSORS(SignatureInfo, args, Object, kArgsOffset)
ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset)
ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset)
ACCESSORS(AllocationSite, nested_site, Object, kNestedSiteOffset)
ACCESSORS(AllocationSite, dependent_code, DependentCode,
kDependentCodeOffset)
ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset)
......
......@@ -1102,7 +1102,8 @@ void AllocationSite::AllocationSitePrint(FILE* out) {
weak_next()->ShortPrint(out);
PrintF(out, "\n - dependent code: ");
dependent_code()->ShortPrint(out);
PrintF(out, "\n - nested site: ");
nested_site()->ShortPrint(out);
PrintF(out, "\n - transition_info: ");
if (transition_info()->IsCell()) {
Cell* cell = Cell::cast(transition_info());
......
......@@ -7827,6 +7827,10 @@ class AllocationSite: public Struct {
static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
DECL_ACCESSORS(transition_info, Object)
// nested_site threads a list of sites that represent nested literals
// walked in a particular order. So [[1, 2], 1, 2] will have one
// nested_site, but [[1, 2], 3, [4]] will have a list of two.
DECL_ACCESSORS(nested_site, Object)
DECL_ACCESSORS(dependent_code, DependentCode)
DECL_ACCESSORS(weak_next, Object)
......@@ -7858,7 +7862,8 @@ class AllocationSite: public Struct {
static inline bool CanTrack(InstanceType type);
static const int kTransitionInfoOffset = HeapObject::kHeaderSize;
static const int kDependentCodeOffset = kTransitionInfoOffset + kPointerSize;
static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize;
static const int kDependentCodeOffset = kNestedSiteOffset + kPointerSize;
static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize;
static const int kSize = kWeakNextOffset + kPointerSize;
......
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