Reviewers: danno, Jakob, paul.l..., dusmil.imgtec, akos.palfi.imgtec,
gergely.kis.imgtec,
Description:
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=
Please review this at https://codereview.chromium.org/404813002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+22, -12 lines):
M src/mips/ic-mips.cc
M src/mips/stub-cache-mips.cc
M src/mips64/ic-mips64.cc
M src/mips64/stub-cache-mips64.cc
Index: src/mips/ic-mips.cc
diff --git a/src/mips/ic-mips.cc b/src/mips/ic-mips.cc
index
23ad6de0639ec56cac29463f479500593258e3d0..4ae0be2e603f133b3e3fd559830b32c5976496a3
100644
--- a/src/mips/ic-mips.cc
+++ b/src/mips/ic-mips.cc
@@ -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);
Index: src/mips/stub-cache-mips.cc
diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc
index
7fada5424b559f2fab6b72552e27fdf5dcfc6e41..5b66a7e9ac7823ad8395929256f7f0d8bb896ea3
100644
--- a/src/mips/stub-cache-mips.cc
+++ b/src/mips/stub-cache-mips.cc
@@ -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));
}
}
Index: src/mips64/ic-mips64.cc
diff --git a/src/mips64/ic-mips64.cc b/src/mips64/ic-mips64.cc
index
17241d66f76718c340dd5895aeb9a20afe7719aa..49d9c4a598d8c4c2105f6ec2e1ccee31b08686c7
100644
--- a/src/mips64/ic-mips64.cc
+++ b/src/mips64/ic-mips64.cc
@@ -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);
Index: src/mips64/stub-cache-mips64.cc
diff --git a/src/mips64/stub-cache-mips64.cc
b/src/mips64/stub-cache-mips64.cc
index
39ae974c2bf5e93cb3a4904c012de9b48ec972bb..82f4696e2ce620e43491a313002b46a245c3b9df
100644
--- a/src/mips64/stub-cache-mips64.cc
+++ b/src/mips64/stub-cache-mips64.cc
@@ -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));
}
}
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.