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:
parent
c1e19bfc35
commit
23695eb86e
@ -6973,7 +6973,7 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm) {
|
||||
// Save the resulting elements kind in type info
|
||||
__ SmiTag(r3);
|
||||
__ ldr(r5, FieldMemOperand(r2, Cell::kValueOffset));
|
||||
__ str(r3, FieldMemOperand(r5, AllocationSite::kPayloadOffset));
|
||||
__ str(r3, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset));
|
||||
__ SmiUntag(r3);
|
||||
|
||||
__ bind(&normal_sequence);
|
||||
@ -7081,7 +7081,7 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
__ CompareRoot(r4, Heap::kAllocationSiteMapRootIndex);
|
||||
__ b(ne, &no_info);
|
||||
|
||||
__ ldr(r3, FieldMemOperand(r3, AllocationSite::kPayloadOffset));
|
||||
__ ldr(r3, FieldMemOperand(r3, AllocationSite::kTransitionInfoOffset));
|
||||
__ SmiUntag(r3);
|
||||
__ jmp(&switch_ready);
|
||||
__ bind(&no_info);
|
||||
|
@ -1729,7 +1729,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall(
|
||||
}
|
||||
|
||||
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);
|
||||
__ mov(r0, Operand(argc));
|
||||
__ mov(r2, Operand(site_feedback_cell));
|
||||
|
@ -678,7 +678,7 @@ void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
||||
ASSERT(!value->IsTheHole());
|
||||
if (value->IsAllocationSite()) {
|
||||
AllocationSite* site = AllocationSite::cast(value);
|
||||
elements_kind_ = site->GetElementsKindPayload();
|
||||
elements_kind_ = site->GetElementsKind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ static MaybeObject* ArrayCodeGenericCommon(Arguments* args,
|
||||
AllocationSiteInfo* info = AllocationSiteInfo::FindForJSObject(array);
|
||||
if (info != NULL && info->IsValid()) {
|
||||
AllocationSite* site = info->GetAllocationSite();
|
||||
ElementsKind to_kind = site->GetElementsKindPayload();
|
||||
ElementsKind to_kind = site->GetElementsKind();
|
||||
if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(),
|
||||
to_kind)) {
|
||||
// We have advice that we should change the elements kind
|
||||
|
@ -446,7 +446,7 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
|
||||
HValue* initial_elements_kind = AddInstruction(new(zone) HConstant(
|
||||
GetInitialFastElementsKind()));
|
||||
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
|
||||
// cell is really a Cell, and so no write barrier is needed.
|
||||
|
@ -4549,7 +4549,7 @@ MaybeObject* Heap::AllocateJSObjectWithAllocationSite(JSFunction* constructor,
|
||||
// advice
|
||||
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());
|
||||
AllocationSiteMode mode = TRACK_ALLOCATION_SITE;
|
||||
if (to_kind != initial_map->elements_kind()) {
|
||||
|
@ -5347,8 +5347,8 @@ class HObjectAccess {
|
||||
return HObjectAccess(kArrayLengths, JSArray::kLengthOffset);
|
||||
}
|
||||
|
||||
static HObjectAccess ForAllocationSitePayload() {
|
||||
return HObjectAccess(kInobject, AllocationSite::kPayloadOffset);
|
||||
static HObjectAccess ForAllocationSiteTransitionInfo() {
|
||||
return HObjectAccess(kInobject, AllocationSite::kTransitionInfoOffset);
|
||||
}
|
||||
|
||||
static HObjectAccess ForFixedArrayLength() {
|
||||
|
@ -4650,7 +4650,7 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
|
||||
}
|
||||
|
||||
site = isolate()->factory()->NewAllocationSite();
|
||||
site->set_payload(*raw_boilerplate);
|
||||
site->set_transition_info(*raw_boilerplate);
|
||||
literals->set(expr->literal_index(), *site);
|
||||
|
||||
if (JSObject::cast(*raw_boilerplate)->elements()->map() ==
|
||||
@ -4660,7 +4660,7 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
|
||||
} else {
|
||||
ASSERT(literals_cell->IsAllocationSite());
|
||||
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());
|
||||
|
@ -7522,7 +7522,7 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm) {
|
||||
|
||||
// Save the resulting elements kind in type info
|
||||
__ SmiTag(edx);
|
||||
__ mov(FieldOperand(ecx, AllocationSite::kPayloadOffset), edx);
|
||||
__ mov(FieldOperand(ecx, AllocationSite::kTransitionInfoOffset), edx);
|
||||
__ SmiUntag(edx);
|
||||
|
||||
__ bind(&normal_sequence);
|
||||
@ -7633,7 +7633,7 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
masm->isolate()->heap()->allocation_site_map())));
|
||||
__ j(not_equal, &no_info);
|
||||
|
||||
__ mov(edx, FieldOperand(edx, AllocationSite::kPayloadOffset));
|
||||
__ mov(edx, FieldOperand(edx, AllocationSite::kTransitionInfoOffset));
|
||||
__ SmiUntag(edx);
|
||||
__ jmp(&switch_ready);
|
||||
__ bind(&no_info);
|
||||
|
@ -1725,7 +1725,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall(
|
||||
}
|
||||
|
||||
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);
|
||||
__ mov(eax, Immediate(argc));
|
||||
__ mov(ebx, site_feedback_cell);
|
||||
|
@ -4448,7 +4448,7 @@ ACCESSORS(SignatureInfo, args, Object, kArgsOffset)
|
||||
|
||||
ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset)
|
||||
|
||||
ACCESSORS(AllocationSite, payload, Object, kPayloadOffset)
|
||||
ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset)
|
||||
ACCESSORS(AllocationSiteInfo, allocation_site, Object, kAllocationSiteOffset)
|
||||
|
||||
ACCESSORS(Script, source, Object, kSourceOffset)
|
||||
|
@ -1119,9 +1119,9 @@ void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) {
|
||||
|
||||
void AllocationSite::AllocationSitePrint(FILE* out) {
|
||||
HeapObject::PrintHeader(out, "AllocationSite");
|
||||
PrintF(out, " - payload: ");
|
||||
if (payload()->IsCell()) {
|
||||
Cell* cell = Cell::cast(payload());
|
||||
PrintF(out, " - transition_info: ");
|
||||
if (transition_info()->IsCell()) {
|
||||
Cell* cell = Cell::cast(transition_info());
|
||||
Object* cell_contents = cell->value();
|
||||
if (cell_contents->IsSmi()) {
|
||||
ElementsKind kind = static_cast<ElementsKind>(
|
||||
@ -1131,15 +1131,15 @@ void AllocationSite::AllocationSitePrint(FILE* out) {
|
||||
PrintF(out, "\n");
|
||||
return;
|
||||
}
|
||||
} else if (payload()->IsJSArray()) {
|
||||
} else if (transition_info()->IsJSArray()) {
|
||||
PrintF(out, "Array literal ");
|
||||
payload()->ShortPrint(out);
|
||||
transition_info()->ShortPrint(out);
|
||||
PrintF(out, "\n");
|
||||
return;
|
||||
}
|
||||
|
||||
PrintF(out, "unknown payload ");
|
||||
payload()->ShortPrint(out);
|
||||
PrintF(out, "unknown transition_info");
|
||||
transition_info()->ShortPrint(out);
|
||||
PrintF(out, "\n");
|
||||
}
|
||||
|
||||
|
@ -12316,13 +12316,13 @@ MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) {
|
||||
// Walk through to the Allocation Site
|
||||
AllocationSite* site = info->GetAllocationSite();
|
||||
if (site->IsLiteralSite()) {
|
||||
JSArray* payload = JSArray::cast(site->payload());
|
||||
ElementsKind kind = payload->GetElementsKind();
|
||||
JSArray* transition_info = JSArray::cast(site->transition_info());
|
||||
ElementsKind kind = transition_info->GetElementsKind();
|
||||
if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) {
|
||||
// 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.
|
||||
uint32_t length = 0;
|
||||
CHECK(payload->length()->ToArrayIndex(&length));
|
||||
CHECK(transition_info->length()->ToArrayIndex(&length));
|
||||
if (length <= AllocationSite::kMaximumArrayBytesToPretransition) {
|
||||
if (FLAG_trace_track_allocation_sites) {
|
||||
PrintF(
|
||||
@ -12331,11 +12331,11 @@ MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) {
|
||||
ElementsKindToString(kind),
|
||||
ElementsKindToString(to_kind));
|
||||
}
|
||||
return payload->TransitionElementsKind(to_kind);
|
||||
return transition_info->TransitionElementsKind(to_kind);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ElementsKind kind = site->GetElementsKindPayload();
|
||||
ElementsKind kind = site->GetElementsKind();
|
||||
if (AllocationSite::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) {
|
||||
if (FLAG_trace_track_allocation_sites) {
|
||||
PrintF("AllocationSite: JSArray %p site updated %s->%s\n",
|
||||
@ -12343,7 +12343,7 @@ MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) {
|
||||
ElementsKindToString(kind),
|
||||
ElementsKindToString(to_kind));
|
||||
}
|
||||
site->set_payload(Smi::FromInt(to_kind));
|
||||
site->set_transition_info(Smi::FromInt(to_kind));
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
@ -7465,31 +7465,30 @@ enum AllocationSiteMode {
|
||||
|
||||
class AllocationSite: public Struct {
|
||||
public:
|
||||
static const int kPayloadOffset = HeapObject::kHeaderSize;
|
||||
static const int kSize = kPayloadOffset + kPointerSize;
|
||||
static const int kTransitionInfoOffset = HeapObject::kHeaderSize;
|
||||
static const int kSize = kTransitionInfoOffset + kPointerSize;
|
||||
static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
|
||||
|
||||
// TODO(mvstanton): rename payload to transition_info.
|
||||
DECL_ACCESSORS(payload, Object)
|
||||
DECL_ACCESSORS(transition_info, Object)
|
||||
|
||||
void Initialize() {
|
||||
SetElementsKindPayload(GetInitialFastElementsKind());
|
||||
SetElementsKind(GetInitialFastElementsKind());
|
||||
}
|
||||
|
||||
ElementsKind GetElementsKindPayload() {
|
||||
ElementsKind GetElementsKind() {
|
||||
ASSERT(!IsLiteralSite());
|
||||
return static_cast<ElementsKind>(Smi::cast(payload())->value());
|
||||
return static_cast<ElementsKind>(Smi::cast(transition_info())->value());
|
||||
}
|
||||
|
||||
void SetElementsKindPayload(ElementsKind kind) {
|
||||
set_payload(Smi::FromInt(static_cast<int>(kind)));
|
||||
void SetElementsKind(ElementsKind kind) {
|
||||
set_transition_info(Smi::FromInt(static_cast<int>(kind)));
|
||||
}
|
||||
|
||||
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 an array literal
|
||||
return payload()->IsJSArray();
|
||||
return transition_info()->IsJSArray();
|
||||
}
|
||||
|
||||
DECLARE_PRINTER(AllocationSite)
|
||||
|
@ -515,7 +515,7 @@ static Handle<AllocationSite> GetLiteralAllocationSite(
|
||||
Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements);
|
||||
if (boilerplate.is_null()) return site;
|
||||
site = isolate->factory()->NewAllocationSite();
|
||||
site->set_payload(*boilerplate);
|
||||
site->set_transition_info(*boilerplate);
|
||||
literals->set(literals_index, *site);
|
||||
} else {
|
||||
site = Handle<AllocationSite>::cast(literal_site);
|
||||
@ -536,7 +536,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) {
|
||||
literals_index, elements);
|
||||
RETURN_IF_EMPTY_HANDLE(isolate, site);
|
||||
|
||||
JSObject* boilerplate = JSObject::cast(site->payload());
|
||||
JSObject* boilerplate = JSObject::cast(site->transition_info());
|
||||
return boilerplate->DeepCopy(isolate);
|
||||
}
|
||||
|
||||
@ -552,7 +552,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) {
|
||||
literals_index, elements);
|
||||
RETURN_IF_EMPTY_HANDLE(isolate, site);
|
||||
|
||||
JSObject* boilerplate = JSObject::cast(site->payload());
|
||||
JSObject* boilerplate = JSObject::cast(site->transition_info());
|
||||
if (boilerplate->elements()->map() ==
|
||||
isolate->heap()->fixed_cow_array_map()) {
|
||||
isolate->counters()->cow_arrays_created_runtime()->Increment();
|
||||
@ -5221,7 +5221,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) {
|
||||
JSArray* boilerplate = NULL;
|
||||
if (raw_literal_cell->IsAllocationSite()) {
|
||||
AllocationSite* site = AllocationSite::cast(raw_literal_cell);
|
||||
boilerplate = JSArray::cast(site->payload());
|
||||
boilerplate = JSArray::cast(site->transition_info());
|
||||
} else {
|
||||
boilerplate = JSArray::cast(raw_literal_cell);
|
||||
}
|
||||
@ -13845,11 +13845,11 @@ static MaybeObject* ArrayConstructorCommon(Isolate* isolate,
|
||||
Handle<AllocationSite> site = Handle<AllocationSite>(
|
||||
AllocationSite::cast(cell->value()), isolate);
|
||||
ASSERT(!site->IsLiteralSite());
|
||||
ElementsKind to_kind = site->GetElementsKindPayload();
|
||||
ElementsKind to_kind = site->GetElementsKind();
|
||||
if (holey && !IsFastHoleyElementsKind(to_kind)) {
|
||||
to_kind = GetHoleyElementsKind(to_kind);
|
||||
// Update the allocation site info to reflect the advice alteration.
|
||||
site->SetElementsKindPayload(to_kind);
|
||||
site->SetElementsKind(to_kind);
|
||||
}
|
||||
|
||||
maybe_array = isolate->heap()->AllocateJSObjectWithAllocationSite(
|
||||
|
@ -6566,7 +6566,7 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm) {
|
||||
|
||||
// Save the resulting elements kind in type info
|
||||
__ Integer32ToSmi(rdx, rdx);
|
||||
__ movq(FieldOperand(rcx, AllocationSite::kPayloadOffset), rdx);
|
||||
__ movq(FieldOperand(rcx, AllocationSite::kTransitionInfoOffset), rdx);
|
||||
__ SmiToInteger32(rdx, rdx);
|
||||
|
||||
__ bind(&normal_sequence);
|
||||
@ -6678,7 +6678,7 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
|
||||
Handle<Map>(masm->isolate()->heap()->allocation_site_map()));
|
||||
__ j(not_equal, &no_info);
|
||||
|
||||
__ movq(rdx, FieldOperand(rdx, AllocationSite::kPayloadOffset));
|
||||
__ movq(rdx, FieldOperand(rdx, AllocationSite::kTransitionInfoOffset));
|
||||
__ SmiToInteger32(rdx, rdx);
|
||||
__ jmp(&switch_ready);
|
||||
__ bind(&no_info);
|
||||
|
@ -1642,7 +1642,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall(
|
||||
}
|
||||
|
||||
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);
|
||||
__ movq(rax, Immediate(argc));
|
||||
__ Move(rbx, site_feedback_cell);
|
||||
|
Loading…
Reference in New Issue
Block a user