MIPS: Add MEGAMORPHIC state support for KeyedStoreIC.

Port r24500 (e10f342)

BUG=
R=paul.lind@imgtec.com

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24503 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d6013e94
......@@ -766,8 +766,9 @@ static void KeyedStoreGenerateGenericHelper(
}
void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
StrictMode strict_mode) {
void KeyedStoreIC::GenerateGeneric(
MacroAssembler* masm, StrictMode strict_mode,
KeyedStoreStubCacheRequirement handler_requirement) {
// ---------- S t a t e --------------
// -- a0 : value
// -- a1 : key
......@@ -776,7 +777,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
// -----------------------------------
Label slow, fast_object, fast_object_grow;
Label fast_double, fast_double_grow;
Label array, extra, check_if_double_array;
Label array, extra, check_if_double_array, maybe_name_key, miss;
// Register usage.
Register value = StoreDescriptor::ValueRegister();
......@@ -789,7 +790,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
// t0 and t1 are used as general scratch registers.
// Check that the key is a smi.
__ JumpIfNotSmi(key, &slow);
__ JumpIfNotSmi(key, &maybe_name_key);
// Check that the object isn't a smi.
__ JumpIfSmi(receiver, &slow);
// Get the map of the object.
......@@ -819,6 +820,23 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
// a1: key.
// a2: receiver.
PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
// Never returns to here.
__ bind(&maybe_name_key);
__ lw(t0, FieldMemOperand(key, HeapObject::kMapOffset));
__ lb(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset));
__ JumpIfNotUniqueNameInstanceType(t0, &slow);
Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
Code::ComputeHandlerFlags(Code::STORE_IC));
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);
}
// Extra capacity case: Check if there is extra capacity to
// perform the store and update the length. Used for adding one
......@@ -858,6 +876,9 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
&slow, kDontCheckMap, kIncrementLength, value,
key, receiver, receiver_map, elements_map,
elements);
__ bind(&miss);
GenerateMiss(masm);
}
......
......@@ -775,8 +775,9 @@ static void KeyedStoreGenerateGenericHelper(
}
void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
StrictMode strict_mode) {
void KeyedStoreIC::GenerateGeneric(
MacroAssembler* masm, StrictMode strict_mode,
KeyedStoreStubCacheRequirement handler_requirement) {
// ---------- S t a t e --------------
// -- a0 : value
// -- a1 : key
......@@ -785,7 +786,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
// -----------------------------------
Label slow, fast_object, fast_object_grow;
Label fast_double, fast_double_grow;
Label array, extra, check_if_double_array;
Label array, extra, check_if_double_array, maybe_name_key, miss;
// Register usage.
Register value = StoreDescriptor::ValueRegister();
......@@ -798,7 +799,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
// a4 and a5 are used as general scratch registers.
// Check that the key is a smi.
__ JumpIfNotSmi(key, &slow);
__ JumpIfNotSmi(key, &maybe_name_key);
// Check that the object isn't a smi.
__ JumpIfSmi(receiver, &slow);
// Get the map of the object.
......@@ -828,6 +829,23 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
// a1: key.
// a2: receiver.
PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
// Never returns to here.
__ bind(&maybe_name_key);
__ ld(a4, FieldMemOperand(key, HeapObject::kMapOffset));
__ lb(a4, FieldMemOperand(a4, Map::kInstanceTypeOffset));
__ JumpIfNotUniqueNameInstanceType(a4, &slow);
Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
Code::ComputeHandlerFlags(Code::STORE_IC));
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);
}
// Extra capacity case: Check if there is extra capacity to
// perform the store and update the length. Used for adding one
......@@ -867,6 +885,9 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
&slow, kDontCheckMap, kIncrementLength, value,
key, receiver, receiver_map, elements_map,
elements);
__ bind(&miss);
GenerateMiss(masm);
}
......
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