Use a simpler KeyedStoreGeneric stub

R=verwaest@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#24941}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24941 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jkummerow@chromium.org 2014-10-28 13:53:53 +00:00
parent a03a399980
commit d3eb7e8e8c
10 changed files with 88 additions and 136 deletions

View File

@ -1310,22 +1310,22 @@ static void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) {
static void Generate_KeyedStoreIC_Megamorphic(MacroAssembler* masm) {
KeyedStoreIC::GenerateGeneric(masm, SLOPPY, kMissOnMissingHandler);
KeyedStoreIC::GenerateMegamorphic(masm, SLOPPY);
}
static void Generate_KeyedStoreIC_Megamorphic_Strict(MacroAssembler* masm) {
KeyedStoreIC::GenerateGeneric(masm, STRICT, kMissOnMissingHandler);
KeyedStoreIC::GenerateMegamorphic(masm, STRICT);
}
static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) {
KeyedStoreIC::GenerateGeneric(masm, SLOPPY, kCallRuntimeOnMissingHandler);
KeyedStoreIC::GenerateGeneric(masm, SLOPPY);
}
static void Generate_KeyedStoreIC_Generic_Strict(MacroAssembler* masm) {
KeyedStoreIC::GenerateGeneric(masm, STRICT, kCallRuntimeOnMissingHandler);
KeyedStoreIC::GenerateGeneric(masm, STRICT);
}

View File

@ -598,7 +598,7 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
}
static void KeyedStoreGenerateGenericHelper(
static void KeyedStoreGenerateMegamorphicHelper(
MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length,
Register value, Register key, Register receiver, Register receiver_map,
@ -739,9 +739,8 @@ static void KeyedStoreGenerateGenericHelper(
}
void KeyedStoreIC::GenerateGeneric(
MacroAssembler* masm, StrictMode strict_mode,
KeyedStoreStubCacheRequirement handler_requirement) {
void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
StrictMode strict_mode) {
// ---------- S t a t e --------------
// -- r0 : value
// -- r1 : key
@ -808,12 +807,7 @@ void KeyedStoreIC::GenerateGeneric(
masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver,
key, r3, r4, r5, r6);
// Cache miss.
if (handler_requirement == kCallRuntimeOnMissingHandler) {
__ b(&slow);
} else {
DCHECK(handler_requirement == kMissOnMissingHandler);
__ b(&miss);
}
__ b(&miss);
// Extra capacity case: Check if there is extra capacity to
// perform the store and update the length. Used for adding one
@ -848,13 +842,13 @@ void KeyedStoreIC::GenerateGeneric(
__ cmp(key, Operand(ip));
__ b(hs, &extra);
KeyedStoreGenerateGenericHelper(
KeyedStoreGenerateMegamorphicHelper(
masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength,
value, key, receiver, receiver_map, elements_map, elements);
KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
&slow, kDontCheckMap, kIncrementLength, value,
key, receiver, receiver_map, elements_map,
elements);
KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow,
&fast_double_grow, &slow, kDontCheckMap,
kIncrementLength, value, key, receiver,
receiver_map, elements_map, elements);
__ bind(&miss);
GenerateMiss(masm);

View File

@ -640,7 +640,7 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
}
static void KeyedStoreGenerateGenericHelper(
static void KeyedStoreGenerateMegamorphicHelper(
MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length,
Register value, Register key, Register receiver, Register receiver_map,
@ -772,10 +772,9 @@ static void KeyedStoreGenerateGenericHelper(
}
void KeyedStoreIC::GenerateGeneric(
MacroAssembler* masm, StrictMode strict_mode,
KeyedStoreStubCacheRequirement handler_requirement) {
ASM_LOCATION("KeyedStoreIC::GenerateGeneric");
void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
StrictMode strict_mode) {
ASM_LOCATION("KeyedStoreIC::GenerateMegamorphic");
Label slow;
Label array;
Label fast_object;
@ -841,12 +840,7 @@ void KeyedStoreIC::GenerateGeneric(
masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver,
key, x3, x4, x5, x6);
// Cache miss.
if (handler_requirement == kCallRuntimeOnMissingHandler) {
__ B(&slow);
} else {
DCHECK(handler_requirement == kMissOnMissingHandler);
__ B(&miss);
}
__ B(&miss);
__ Bind(&extra);
// Extra capacity case: Check if there is extra capacity to
@ -881,18 +875,16 @@ void KeyedStoreIC::GenerateGeneric(
__ B(eq, &extra); // We can handle the case where we are appending 1 element.
__ B(lo, &slow);
KeyedStoreGenerateGenericHelper(
KeyedStoreGenerateMegamorphicHelper(
masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength,
value, key, receiver, receiver_map, elements_map, elements);
KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
&slow, kDontCheckMap, kIncrementLength, value,
key, receiver, receiver_map, elements_map,
elements);
KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow,
&fast_double_grow, &slow, kDontCheckMap,
kIncrementLength, value, key, receiver,
receiver_map, elements_map, elements);
if (handler_requirement == kMissOnMissingHandler) {
__ bind(&miss);
GenerateMiss(masm);
}
__ bind(&miss);
GenerateMiss(masm);
}

View File

@ -507,7 +507,7 @@ void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) {
}
static void KeyedStoreGenerateGenericHelper(
static void KeyedStoreGenerateMegamorphicHelper(
MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length) {
Label transition_smi_elements;
@ -645,9 +645,8 @@ static void KeyedStoreGenerateGenericHelper(
}
void KeyedStoreIC::GenerateGeneric(
MacroAssembler* masm, StrictMode strict_mode,
KeyedStoreStubCacheRequirement handler_requirement) {
void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
StrictMode strict_mode) {
// Return address is on the stack.
Label slow, fast_object, fast_object_grow;
Label fast_double, fast_double_grow;
@ -696,12 +695,7 @@ void KeyedStoreIC::GenerateGeneric(
masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver,
key, ebx, no_reg);
// Cache miss.
if (handler_requirement == kCallRuntimeOnMissingHandler) {
__ jmp(&slow);
} else {
DCHECK(handler_requirement == kMissOnMissingHandler);
__ jmp(&miss);
}
__ jmp(&miss);
// Extra capacity case: Check if there is extra capacity to
// perform the store and update the length. Used for adding one
@ -740,15 +734,14 @@ void KeyedStoreIC::GenerateGeneric(
__ cmp(key, FieldOperand(receiver, JSArray::kLengthOffset)); // Compare smis.
__ j(above_equal, &extra);
KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, &slow,
kCheckMap, kDontIncrementLength);
KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
&slow, kDontCheckMap, kIncrementLength);
KeyedStoreGenerateMegamorphicHelper(masm, &fast_object, &fast_double, &slow,
kCheckMap, kDontIncrementLength);
KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow,
&fast_double_grow, &slow, kDontCheckMap,
kIncrementLength);
if (handler_requirement == kMissOnMissingHandler) {
__ bind(&miss);
GenerateMiss(masm);
}
__ bind(&miss);
GenerateMiss(masm);
}

View File

@ -1672,11 +1672,10 @@ Handle<Code> KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver,
return generic_stub();
}
// If the maximum number of receiver maps has been exceeded, use the generic
// version of the IC.
// If the maximum number of receiver maps has been exceeded, use the
// megamorphic version of the IC.
if (target_receiver_maps.length() > kMaxKeyedPolymorphism) {
TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "max polymorph exceeded");
return generic_stub();
return megamorphic_stub();
}
// Make sure all polymorphic handlers have the same store mode, otherwise the
@ -1940,6 +1939,13 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
}
// static
void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
StrictMode strict_mode) {
PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
}
// static
void CallIC::OnTypeFeedbackChanged(Isolate* isolate, Code* host,
TypeFeedbackVector* vector, State old_state,

View File

@ -539,12 +539,6 @@ enum KeyedStoreCheckMap { kDontCheckMap, kCheckMap };
enum KeyedStoreIncrementLength { kDontIncrementLength, kIncrementLength };
enum KeyedStoreStubCacheRequirement {
kCallRuntimeOnMissingHandler,
kMissOnMissingHandler
};
class KeyedStoreIC : public StoreIC {
public:
// ExtraICState bits (building on IC)
@ -585,9 +579,8 @@ class KeyedStoreIC : public StoreIC {
}
static void GenerateMiss(MacroAssembler* masm);
static void GenerateSlow(MacroAssembler* masm);
static void GenerateGeneric(
MacroAssembler* masm, StrictMode strict_mode,
KeyedStoreStubCacheRequirement handler_requirement);
static void GenerateMegamorphic(MacroAssembler* masm, StrictMode strict_mode);
static void GenerateGeneric(MacroAssembler* masm, StrictMode strict_mode);
static void GenerateSloppyArguments(MacroAssembler* masm);
protected:

View File

@ -594,7 +594,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
}
static void KeyedStoreGenerateGenericHelper(
static void KeyedStoreGenerateMegamorphicHelper(
MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length,
Register value, Register key, Register receiver, Register receiver_map,
@ -740,9 +740,8 @@ static void KeyedStoreGenerateGenericHelper(
}
void KeyedStoreIC::GenerateGeneric(
MacroAssembler* masm, StrictMode strict_mode,
KeyedStoreStubCacheRequirement handler_requirement) {
void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
StrictMode strict_mode) {
// ---------- S t a t e --------------
// -- a0 : value
// -- a1 : key
@ -805,12 +804,7 @@ void KeyedStoreIC::GenerateGeneric(
masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver,
key, a3, t0, t1, t2);
// Cache miss.
if (handler_requirement == kCallRuntimeOnMissingHandler) {
__ Branch(&slow);
} else {
DCHECK(handler_requirement == kMissOnMissingHandler);
__ Branch(&miss);
}
__ Branch(&miss);
// Extra capacity case: Check if there is extra capacity to
// perform the store and update the length. Used for adding one
@ -843,13 +837,13 @@ void KeyedStoreIC::GenerateGeneric(
__ lw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset));
__ Branch(&extra, hs, key, Operand(t0));
KeyedStoreGenerateGenericHelper(
KeyedStoreGenerateMegamorphicHelper(
masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength,
value, key, receiver, receiver_map, elements_map, elements);
KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
&slow, kDontCheckMap, kIncrementLength, value,
key, receiver, receiver_map, elements_map,
elements);
KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow,
&fast_double_grow, &slow, kDontCheckMap,
kIncrementLength, value, key, receiver,
receiver_map, elements_map, elements);
__ bind(&miss);
GenerateMiss(masm);

View File

@ -599,7 +599,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
}
static void KeyedStoreGenerateGenericHelper(
static void KeyedStoreGenerateMegamorphicHelper(
MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length,
Register value, Register key, Register receiver, Register receiver_map,
@ -749,9 +749,8 @@ static void KeyedStoreGenerateGenericHelper(
}
void KeyedStoreIC::GenerateGeneric(
MacroAssembler* masm, StrictMode strict_mode,
KeyedStoreStubCacheRequirement handler_requirement) {
void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
StrictMode strict_mode) {
// ---------- S t a t e --------------
// -- a0 : value
// -- a1 : key
@ -814,12 +813,7 @@ void KeyedStoreIC::GenerateGeneric(
masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver,
key, a3, a4, a5, a6);
// Cache miss.
if (handler_requirement == kCallRuntimeOnMissingHandler) {
__ Branch(&slow);
} else {
DCHECK(handler_requirement == kMissOnMissingHandler);
__ Branch(&miss);
}
__ Branch(&miss);
// Extra capacity case: Check if there is extra capacity to
// perform the store and update the length. Used for adding one
@ -852,13 +846,13 @@ void KeyedStoreIC::GenerateGeneric(
__ ld(a4, FieldMemOperand(receiver, JSArray::kLengthOffset));
__ Branch(&extra, hs, key, Operand(a4));
KeyedStoreGenerateGenericHelper(
KeyedStoreGenerateMegamorphicHelper(
masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength,
value, key, receiver, receiver_map, elements_map, elements);
KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
&slow, kDontCheckMap, kIncrementLength, value,
key, receiver, receiver_map, elements_map,
elements);
KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow,
&fast_double_grow, &slow, kDontCheckMap,
kIncrementLength, value, key, receiver,
receiver_map, elements_map, elements);
__ bind(&miss);
GenerateMiss(masm);

View File

@ -403,7 +403,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
}
static void KeyedStoreGenerateGenericHelper(
static void KeyedStoreGenerateMegamorphicHelper(
MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length) {
Label transition_smi_elements;
@ -540,9 +540,8 @@ static void KeyedStoreGenerateGenericHelper(
}
void KeyedStoreIC::GenerateGeneric(
MacroAssembler* masm, StrictMode strict_mode,
KeyedStoreStubCacheRequirement handler_requirement) {
void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
StrictMode strict_mode) {
// Return address is on the stack.
Label slow, slow_with_tagged_index, fast_object, fast_object_grow;
Label fast_double, fast_double_grow;
@ -594,12 +593,7 @@ void KeyedStoreIC::GenerateGeneric(
masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver,
key, rbx, no_reg);
// Cache miss.
if (handler_requirement == kCallRuntimeOnMissingHandler) {
__ jmp(&slow_with_tagged_index);
} else {
DCHECK(handler_requirement == kMissOnMissingHandler);
__ jmp(&miss);
}
__ jmp(&miss);
// Extra capacity case: Check if there is extra capacity to
// perform the store and update the length. Used for adding one
@ -635,15 +629,14 @@ void KeyedStoreIC::GenerateGeneric(
__ SmiCompareInteger32(FieldOperand(receiver, JSArray::kLengthOffset), key);
__ j(below_equal, &extra);
KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, &slow,
kCheckMap, kDontIncrementLength);
KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
&slow, kDontCheckMap, kIncrementLength);
KeyedStoreGenerateMegamorphicHelper(masm, &fast_object, &fast_double, &slow,
kCheckMap, kDontIncrementLength);
KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow,
&fast_double_grow, &slow, kDontCheckMap,
kIncrementLength);
if (handler_requirement == kMissOnMissingHandler) {
__ bind(&miss);
GenerateMiss(masm);
}
__ bind(&miss);
GenerateMiss(masm);
}

View File

@ -509,7 +509,7 @@ void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) {
}
static void KeyedStoreGenerateGenericHelper(
static void KeyedStoreGenerateMegamorphicHelper(
MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length) {
Label transition_smi_elements;
@ -647,9 +647,8 @@ static void KeyedStoreGenerateGenericHelper(
}
void KeyedStoreIC::GenerateGeneric(
MacroAssembler* masm, StrictMode strict_mode,
KeyedStoreStubCacheRequirement handler_requirement) {
void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
StrictMode strict_mode) {
// Return address is on the stack.
Label slow, fast_object, fast_object_grow;
Label fast_double, fast_double_grow;
@ -698,12 +697,7 @@ void KeyedStoreIC::GenerateGeneric(
masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver,
key, ebx, no_reg);
// Cache miss.
if (handler_requirement == kCallRuntimeOnMissingHandler) {
__ jmp(&slow);
} else {
DCHECK(handler_requirement == kMissOnMissingHandler);
__ jmp(&miss);
}
__ jmp(&miss);
// Extra capacity case: Check if there is extra capacity to
// perform the store and update the length. Used for adding one
@ -742,15 +736,14 @@ void KeyedStoreIC::GenerateGeneric(
__ cmp(key, FieldOperand(receiver, JSArray::kLengthOffset)); // Compare smis.
__ j(above_equal, &extra);
KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, &slow,
kCheckMap, kDontIncrementLength);
KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
&slow, kDontCheckMap, kIncrementLength);
KeyedStoreGenerateMegamorphicHelper(masm, &fast_object, &fast_double, &slow,
kCheckMap, kDontIncrementLength);
KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow,
&fast_double_grow, &slow, kDontCheckMap,
kIncrementLength);
if (handler_requirement == kMissOnMissingHandler) {
__ bind(&miss);
GenerateMiss(masm);
}
__ bind(&miss);
GenerateMiss(masm);
}