Rename AllocationSite::payload to AllocationSite::transition_info

BUG=
R=hpayer@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15556 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mvstanton@chromium.org 2013-07-08 15:00:12 +00:00
parent c1e19bfc35
commit 23695eb86e
17 changed files with 47 additions and 48 deletions

View File

@ -6973,7 +6973,7 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm) {
// Save the resulting elements kind in type info // Save the resulting elements kind in type info
__ SmiTag(r3); __ SmiTag(r3);
__ ldr(r5, FieldMemOperand(r2, Cell::kValueOffset)); __ ldr(r5, FieldMemOperand(r2, Cell::kValueOffset));
__ str(r3, FieldMemOperand(r5, AllocationSite::kPayloadOffset)); __ str(r3, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset));
__ SmiUntag(r3); __ SmiUntag(r3);
__ bind(&normal_sequence); __ bind(&normal_sequence);
@ -7081,7 +7081,7 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ CompareRoot(r4, Heap::kAllocationSiteMapRootIndex); __ CompareRoot(r4, Heap::kAllocationSiteMapRootIndex);
__ b(ne, &no_info); __ b(ne, &no_info);
__ ldr(r3, FieldMemOperand(r3, AllocationSite::kPayloadOffset)); __ ldr(r3, FieldMemOperand(r3, AllocationSite::kTransitionInfoOffset));
__ SmiUntag(r3); __ SmiUntag(r3);
__ jmp(&switch_ready); __ jmp(&switch_ready);
__ bind(&no_info); __ bind(&no_info);

View File

@ -1729,7 +1729,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall(
} }
Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite(); Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite();
site->set_payload(Smi::FromInt(GetInitialFastElementsKind())); site->set_transition_info(Smi::FromInt(GetInitialFastElementsKind()));
Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site); Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site);
__ mov(r0, Operand(argc)); __ mov(r0, Operand(argc));
__ mov(r2, Operand(site_feedback_cell)); __ mov(r2, Operand(site_feedback_cell));

View File

@ -678,7 +678,7 @@ void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
ASSERT(!value->IsTheHole()); ASSERT(!value->IsTheHole());
if (value->IsAllocationSite()) { if (value->IsAllocationSite()) {
AllocationSite* site = AllocationSite::cast(value); AllocationSite* site = AllocationSite::cast(value);
elements_kind_ = site->GetElementsKindPayload(); elements_kind_ = site->GetElementsKind();
} }
} }
} }

View File

@ -214,7 +214,7 @@ static MaybeObject* ArrayCodeGenericCommon(Arguments* args,
AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(array); AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(array);
if (info != NULL && info->IsValid()) { if (info != NULL && info->IsValid()) {
AllocationSite* site = info->GetAllocationSite(); AllocationSite* site = info->GetAllocationSite();
ElementsKind to_kind = site->GetElementsKindPayload(); ElementsKind to_kind = site->GetElementsKind();
if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(), if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(),
to_kind)) { to_kind)) {
// We have advice that we should change the elements kind // We have advice that we should change the elements kind

View File

@ -446,7 +446,7 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
HValue* initial_elements_kind = AddInstruction(new(zone) HConstant( HValue* initial_elements_kind = AddInstruction(new(zone) HConstant(
GetInitialFastElementsKind())); GetInitialFastElementsKind()));
AddInstruction(new(zone) HStoreNamedField(object, AddInstruction(new(zone) HStoreNamedField(object,
HObjectAccess::ForAllocationSitePayload(), initial_elements_kind)); HObjectAccess::ForAllocationSiteTransitionInfo(), initial_elements_kind));
// We use a hammer (SkipWriteBarrier()) to indicate that we know the input // We use a hammer (SkipWriteBarrier()) to indicate that we know the input
// cell is really a Cell, and so no write barrier is needed. // cell is really a Cell, and so no write barrier is needed.

View File

@ -4549,7 +4549,7 @@ MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor,
// advice // advice
Map* initial_map = constructor->initial_map(); Map* initial_map = constructor->initial_map();
Smi* smi = Smi::cast(allocation_site->payload()); Smi* smi = Smi::cast(allocation_site->transition_info());
ElementsKind to_kind = static_cast<ElementsKind>(smi->value()); ElementsKind to_kind = static_cast<ElementsKind>(smi->value());
AllocationSiteMode mode = TRACK_ALLOCATION_SITE; AllocationSiteMode mode = TRACK_ALLOCATION_SITE;
if (to_kind != initial_map->elements_kind()) { if (to_kind != initial_map->elements_kind()) {

View File

@ -5347,8 +5347,8 @@ class HObjectAccess {
return HObjectAccess(kArrayLengths, JSArray::kLengthOffset); return HObjectAccess(kArrayLengths, JSArray::kLengthOffset);
} }
static HObjectAccess ForAllocationSitePayload() { static HObjectAccess ForAllocationSiteTransitionInfo() {
return HObjectAccess(kInobject, AllocationSite::kPayloadOffset); return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset);
} }
static HObjectAccess ForFixedArrayLength() { static HObjectAccess ForFixedArrayLength() {

View File

@ -4650,7 +4650,7 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
} }
site = isolate()->factory()->NewAllocationSite(); site = isolate()->factory()->NewAllocationSite();
site->set_payload(*raw_boilerplate); site->set_transition_info(*raw_boilerplate);
literals->set(expr->literal_index(), *site); literals->set(expr->literal_index(), *site);
if (JSObject::cast(*raw_boilerplate)->elements()->map() == if (JSObject::cast(*raw_boilerplate)->elements()->map() ==
@ -4660,7 +4660,7 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
} else { } else {
ASSERT(literals_cell->IsAllocationSite()); ASSERT(literals_cell->IsAllocationSite());
site = Handle<AllocationSite>::cast(literals_cell); site = Handle<AllocationSite>::cast(literals_cell);
raw_boilerplate = Handle<Object>(site->payload(), isolate()); raw_boilerplate = Handle<Object>(site->transition_info(), isolate());
} }
ASSERT(!raw_boilerplate.is_null()); ASSERT(!raw_boilerplate.is_null());

View File

@ -7522,7 +7522,7 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm) {
// Save the resulting elements kind in type info // Save the resulting elements kind in type info
__ SmiTag(edx); __ SmiTag(edx);
__ mov(FieldOperand(ecx, AllocationSite::kPayloadOffset), edx); __ mov(FieldOperand(ecx, AllocationSite::kTransitionInfoOffset), edx);
__ SmiUntag(edx); __ SmiUntag(edx);
__ bind(&normal_sequence); __ bind(&normal_sequence);
@ -7633,7 +7633,7 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
masm->isolate()->heap()->allocation_site_map()))); masm->isolate()->heap()->allocation_site_map())));
__ j(not_equal, &no_info); __ j(not_equal, &no_info);
__ mov(edx, FieldOperand(edx, AllocationSite::kPayloadOffset)); __ mov(edx, FieldOperand(edx, AllocationSite::kTransitionInfoOffset));
__ SmiUntag(edx); __ SmiUntag(edx);
__ jmp(&switch_ready); __ jmp(&switch_ready);
__ bind(&no_info); __ bind(&no_info);

View File

@ -1725,7 +1725,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall(
} }
Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite(); Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite();
site->set_payload(Smi::FromInt(GetInitialFastElementsKind())); site->set_transition_info(Smi::FromInt(GetInitialFastElementsKind()));
Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site); Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site);
__ mov(eax, Immediate(argc)); __ mov(eax, Immediate(argc));
__ mov(ebx, site_feedback_cell); __ mov(ebx, site_feedback_cell);

View File

@ -4448,7 +4448,7 @@ ACCESSORS(SignatureInfo, args, Object, kArgsOffset)
ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset) ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset)
ACCESSORS(AllocationSite, payload, Object, kPayloadOffset) ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset)
ACCESSORS(AllocationSiteInfo, allocation_site, Object, kAllocationSiteOffset) ACCESSORS(AllocationSiteInfo, allocation_site, Object, kAllocationSiteOffset)
ACCESSORS(Script, source, Object, kSourceOffset) ACCESSORS(Script, source, Object, kSourceOffset)

View File

@ -1119,9 +1119,9 @@ void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) {
void AllocationSite::AllocationSitePrint(FILE* out) { void AllocationSite::AllocationSitePrint(FILE* out) {
HeapObject::PrintHeader(out, "AllocationSite"); HeapObject::PrintHeader(out, "AllocationSite");
PrintF(out, " - payload: "); PrintF(out, " - transition_info: ");
if (payload()->IsCell()) { if (transition_info()->IsCell()) {
Cell* cell = Cell::cast(payload()); Cell* cell = Cell::cast(transition_info());
Object* cell_contents = cell->value(); Object* cell_contents = cell->value();
if (cell_contents->IsSmi()) { if (cell_contents->IsSmi()) {
ElementsKind kind = static_cast<ElementsKind>( ElementsKind kind = static_cast<ElementsKind>(
@ -1131,15 +1131,15 @@ void AllocationSite::AllocationSitePrint(FILE* out) {
PrintF(out, "\n"); PrintF(out, "\n");
return; return;
} }
} else if (payload()->IsJSArray()) { } else if (transition_info()->IsJSArray()) {
PrintF(out, "Array literal "); PrintF(out, "Array literal ");
payload()->ShortPrint(out); transition_info()->ShortPrint(out);
PrintF(out, "\n"); PrintF(out, "\n");
return; return;
} }
PrintF(out, "unknown payload "); PrintF(out, "unknown transition_info");
payload()->ShortPrint(out); transition_info()->ShortPrint(out);
PrintF(out, "\n"); PrintF(out, "\n");
} }

View File

@ -12316,13 +12316,13 @@ MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) {
// Walk through to the Allocation Site // Walk through to the Allocation Site
AllocationSite* site = info->GetAllocationSite(); AllocationSite* site = info->GetAllocationSite();
if (site->IsLiteralSite()) { if (site->IsLiteralSite()) {
JSArray* payload = JSArray::cast(site->payload()); JSArray* transition_info = JSArray::cast(site->transition_info());
ElementsKind kind = payload->GetElementsKind(); ElementsKind kind = transition_info->GetElementsKind();
if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) { if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) {
// If the array is huge, it's not likely to be defined in a local // If the array is huge, it's not likely to be defined in a local
// function, so we shouldn't make new instances of it very often. // function, so we shouldn't make new instances of it very often.
uint32_t length = 0; uint32_t length = 0;
CHECK(payload->length()->ToArrayIndex(&length)); CHECK(transition_info->length()->ToArrayIndex(&length));
if (length <= AllocationSite::kMaximumArrayBytesToPretransition) { if (length <= AllocationSite::kMaximumArrayBytesToPretransition) {
if (FLAG_trace_track_allocation_sites) { if (FLAG_trace_track_allocation_sites) {
PrintF( PrintF(
@ -12331,11 +12331,11 @@ MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) {
ElementsKindToString(kind), ElementsKindToString(kind),
ElementsKindToString(to_kind)); ElementsKindToString(to_kind));
} }
return payload->TransitionElementsKind(to_kind); return transition_info->TransitionElementsKind(to_kind);
} }
} }
} else { } else {
ElementsKind kind = site->GetElementsKindPayload(); ElementsKind kind = site->GetElementsKind();
if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) { if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) {
if (FLAG_trace_track_allocation_sites) { if (FLAG_trace_track_allocation_sites) {
PrintF("AllocationSite: JSArray %p site updated %s->%s\n", PrintF("AllocationSite: JSArray %p site updated %s->%s\n",
@ -12343,7 +12343,7 @@ MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) {
ElementsKindToString(kind), ElementsKindToString(kind),
ElementsKindToString(to_kind)); ElementsKindToString(to_kind));
} }
site->set_payload(Smi::FromInt(to_kind)); site->set_transition_info(Smi::FromInt(to_kind));
} }
} }
return this; return this;

View File

@ -7465,31 +7465,30 @@ enum AllocationSiteMode {
class AllocationSite: public Struct { class AllocationSite: public Struct {
public: public:
static const int kPayloadOffset = HeapObject::kHeaderSize; static const int kTransitionInfoOffset = HeapObject::kHeaderSize;
static const int kSize = kPayloadOffset + kPointerSize; static const int kSize = kTransitionInfoOffset + kPointerSize;
static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
// TODO(mvstanton): rename payload to transition_info. DECL_ACCESSORS(transition_info, Object)
DECL_ACCESSORS(payload, Object)
void Initialize() { void Initialize() {
SetElementsKindPayload(GetInitialFastElementsKind()); SetElementsKind(GetInitialFastElementsKind());
} }
ElementsKind GetElementsKindPayload() { ElementsKind GetElementsKind() {
ASSERT(!IsLiteralSite()); ASSERT(!IsLiteralSite());
return static_cast<ElementsKind>(Smi::cast(payload())->value()); return static_cast<ElementsKind>(Smi::cast(transition_info())->value());
} }
void SetElementsKindPayload(ElementsKind kind) { void SetElementsKind(ElementsKind kind) {
set_payload(Smi::FromInt(static_cast<int>(kind))); set_transition_info(Smi::FromInt(static_cast<int>(kind)));
} }
bool IsLiteralSite() { bool IsLiteralSite() {
// If the payload is a smi, then it represents an ElementsKind // If transition_info is a smi, then it represents an ElementsKind
// for a constructed array. Otherwise, it must be a boilerplate // for a constructed array. Otherwise, it must be a boilerplate
// for an array literal // for an array literal
return payload()->IsJSArray(); return transition_info()->IsJSArray();
} }
DECLARE_PRINTER(AllocationSite) DECLARE_PRINTER(AllocationSite)

View File

@ -515,7 +515,7 @@ static Handle<AllocationSite> GetLiteralAllocationSite(
Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements);
if (boilerplate.is_null()) return site; if (boilerplate.is_null()) return site;
site = isolate->factory()->NewAllocationSite(); site = isolate->factory()->NewAllocationSite();
site->set_payload(*boilerplate); site->set_transition_info(*boilerplate);
literals->set(literals_index, *site); literals->set(literals_index, *site);
} else { } else {
site = Handle<AllocationSite>::cast(literal_site); site = Handle<AllocationSite>::cast(literal_site);
@ -536,7 +536,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) {
literals_index, elements); literals_index, elements);
RETURN_IF_EMPTY_HANDLE(isolate, site); RETURN_IF_EMPTY_HANDLE(isolate, site);
JSObject* boilerplate = JSObject::cast(site->payload()); JSObject* boilerplate = JSObject::cast(site->transition_info());
return boilerplate->DeepCopy(isolate); return boilerplate->DeepCopy(isolate);
} }
@ -552,7 +552,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) {
literals_index, elements); literals_index, elements);
RETURN_IF_EMPTY_HANDLE(isolate, site); RETURN_IF_EMPTY_HANDLE(isolate, site);
JSObject* boilerplate = JSObject::cast(site->payload()); JSObject* boilerplate = JSObject::cast(site->transition_info());
if (boilerplate->elements()->map() == if (boilerplate->elements()->map() ==
isolate->heap()->fixed_cow_array_map()) { isolate->heap()->fixed_cow_array_map()) {
isolate->counters()->cow_arrays_created_runtime()->Increment(); isolate->counters()->cow_arrays_created_runtime()->Increment();
@ -5221,7 +5221,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) {
JSArray* boilerplate = NULL; JSArray* boilerplate = NULL;
if (raw_literal_cell->IsAllocationSite()) { if (raw_literal_cell->IsAllocationSite()) {
AllocationSite* site = AllocationSite::cast(raw_literal_cell); AllocationSite* site = AllocationSite::cast(raw_literal_cell);
boilerplate = JSArray::cast(site->payload()); boilerplate = JSArray::cast(site->transition_info());
} else { } else {
boilerplate = JSArray::cast(raw_literal_cell); boilerplate = JSArray::cast(raw_literal_cell);
} }
@ -13845,11 +13845,11 @@ static MaybeObject* ArrayConstructorCommon(Isolate* isolate,
Handle<AllocationSite> site = Handle<AllocationSite>( Handle<AllocationSite> site = Handle<AllocationSite>(
AllocationSite::cast(cell->value()), isolate); AllocationSite::cast(cell->value()), isolate);
ASSERT(!site->IsLiteralSite()); ASSERT(!site->IsLiteralSite());
ElementsKind to_kind = site->GetElementsKindPayload(); ElementsKind to_kind = site->GetElementsKind();
if (holey && !IsFastHoleyElementsKind(to_kind)) { if (holey && !IsFastHoleyElementsKind(to_kind)) {
to_kind = GetHoleyElementsKind(to_kind); to_kind = GetHoleyElementsKind(to_kind);
// Update the allocation site info to reflect the advice alteration. // Update the allocation site info to reflect the advice alteration.
site->SetElementsKindPayload(to_kind); site->SetElementsKind(to_kind);
} }
maybe_array = isolate->heap()->AllocateJSObjectWithAllocationSite( maybe_array = isolate->heap()->AllocateJSObjectWithAllocationSite(

View File

@ -6566,7 +6566,7 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm) {
// Save the resulting elements kind in type info // Save the resulting elements kind in type info
__ Integer32ToSmi(rdx, rdx); __ Integer32ToSmi(rdx, rdx);
__ movq(FieldOperand(rcx, AllocationSite::kPayloadOffset), rdx); __ movq(FieldOperand(rcx, AllocationSite::kTransitionInfoOffset), rdx);
__ SmiToInteger32(rdx, rdx); __ SmiToInteger32(rdx, rdx);
__ bind(&normal_sequence); __ bind(&normal_sequence);
@ -6678,7 +6678,7 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
Handle<Map>(masm->isolate()->heap()->allocation_site_map())); Handle<Map>(masm->isolate()->heap()->allocation_site_map()));
__ j(not_equal, &no_info); __ j(not_equal, &no_info);
__ movq(rdx, FieldOperand(rdx, AllocationSite::kPayloadOffset)); __ movq(rdx, FieldOperand(rdx, AllocationSite::kTransitionInfoOffset));
__ SmiToInteger32(rdx, rdx); __ SmiToInteger32(rdx, rdx);
__ jmp(&switch_ready); __ jmp(&switch_ready);
__ bind(&no_info); __ bind(&no_info);

View File

@ -1642,7 +1642,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall(
} }
Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite(); Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite();
site->set_payload(Smi::FromInt(GetInitialFastElementsKind())); site->set_transition_info(Smi::FromInt(GetInitialFastElementsKind()));
Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site); Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site);
__ movq(rax, Immediate(argc)); __ movq(rax, Immediate(argc));
__ Move(rbx, site_feedback_cell); __ Move(rbx, site_feedback_cell);