MIPS: Cache IC handlers on the prototype's map if possible.

Port r22483 (6dd09cb)

Original commit message:
Instead of on the receiver's map. Lazily overwrite cached handler if it is
identical to the handler that just missed.

BUG=
R=akos.palfi@imgtec.com

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22484 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
balazs.kilvady@imgtec.com 2014-07-18 17:11:52 +00:00
parent 1211f606ae
commit 6e824b6003
4 changed files with 22 additions and 12 deletions

View File

@ -283,7 +283,8 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
ASSERT(name.is(a2));
// Probe the stub cache.
Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
Code::ComputeHandlerFlags(Code::LOAD_IC));
masm->isolate()->stub_cache()->GenerateProbe(
masm, flags, receiver, name, a3, t0, t1, t2);
@ -1105,7 +1106,8 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
ASSERT(ValueRegister().is(a0));
// Get the receiver from the stack and probe the stub cache.
Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC);
Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
Code::ComputeHandlerFlags(Code::STORE_IC));
masm->isolate()->stub_cache()->GenerateProbe(
masm, flags, receiver, name, a3, t0, t1, t2);

View File

@ -885,12 +885,15 @@ Register StubCompiler::CheckPrototypes(Handle<HeapType> type,
reg = holder_reg; // From now on the object will be in holder_reg.
if (heap()->InNewSpace(*prototype)) {
// The prototype is in new space; we cannot store a reference to it
// in the code. Load it from the map.
// Two possible reasons for loading the prototype from the map:
// (1) Can't store references to new space in code.
// (2) Handler is shared for all receivers with the same prototype
// map (but not necessarily the same prototype instance).
bool load_prototype_from_map =
heap()->InNewSpace(*prototype) || depth == 1;
if (load_prototype_from_map) {
__ lw(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset));
} else {
// The prototype is in old space; load it directly.
__ li(reg, Operand(prototype));
}
}

View File

@ -283,7 +283,8 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
ASSERT(name.is(a2));
// Probe the stub cache.
Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
Code::ComputeHandlerFlags(Code::LOAD_IC));
masm->isolate()->stub_cache()->GenerateProbe(
masm, flags, receiver, name, a3, a4, a5, a6);
@ -1114,7 +1115,8 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
ASSERT(ValueRegister().is(a0));
// Get the receiver from the stack and probe the stub cache.
Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC);
Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
Code::ComputeHandlerFlags(Code::STORE_IC));
masm->isolate()->stub_cache()->GenerateProbe(
masm, flags, receiver, name, a3, a4, a5, a6);

View File

@ -865,6 +865,12 @@ Register StubCompiler::CheckPrototypes(Handle<HeapType> type,
reg = holder_reg; // From now on the object will be in holder_reg.
__ ld(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
} else {
// Two possible reasons for loading the prototype from the map:
// (1) Can't store references to new space in code.
// (2) Handler is shared for all receivers with the same prototype
// map (but not necessarily the same prototype instance).
bool load_prototype_from_map =
heap()->InNewSpace(*prototype) || depth == 1;
Register map_reg = scratch1;
if (depth != 1 || check == CHECK_ALL_MAPS) {
// CheckMap implicitly loads the map of |reg| into |map_reg|.
@ -886,12 +892,9 @@ Register StubCompiler::CheckPrototypes(Handle<HeapType> type,
reg = holder_reg; // From now on the object will be in holder_reg.
if (heap()->InNewSpace(*prototype)) {
// The prototype is in new space; we cannot store a reference to it
// in the code. Load it from the map.
if (load_prototype_from_map) {
__ ld(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset));
} else {
// The prototype is in old space; load it directly.
__ li(reg, Operand(prototype));
}
}