Revision: 13557
Author: [email protected]
Date: Wed Jan 30 06:25:34 2013
Log: Fix gbemu preformance regression
[email protected]
Review URL: https://codereview.chromium.org/12084063
http://code.google.com/p/v8/source/detail?r=13557
Modified:
/branches/bleeding_edge/src/arm/code-stubs-arm.cc
/branches/bleeding_edge/src/ia32/code-stubs-ia32.cc
/branches/bleeding_edge/src/ic.cc
/branches/bleeding_edge/src/ic.h
/branches/bleeding_edge/src/x64/code-stubs-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Tue Jan 29 01:12:20
2013
+++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Wed Jan 30 06:25:34
2013
@@ -45,7 +45,7 @@
descriptor->register_param_count_ = 2;
descriptor->register_params_ = registers;
descriptor->deoptimization_handler_ =
- FUNCTION_ADDR(KeyedLoadIC_Miss);
+ FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
}
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Tue Jan 29 01:12:20
2013
+++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Wed Jan 30 06:25:34
2013
@@ -48,7 +48,7 @@
descriptor->register_param_count_ = 2;
descriptor->register_params_ = registers;
descriptor->deoptimization_handler_ =
- FUNCTION_ADDR(KeyedLoadIC_Miss);
+ FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
}
=======================================
--- /branches/bleeding_edge/src/ic.cc Tue Jan 29 04:00:56 2013
+++ /branches/bleeding_edge/src/ic.cc Wed Jan 30 06:25:34 2013
@@ -111,16 +111,30 @@
ASSERT((TraceIC(type, name, old_state, new_target), true))
IC::IC(FrameDepth depth, Isolate* isolate) : isolate_(isolate) {
- ASSERT(isolate == Isolate::Current());
+ // To improve the performance of the (much used) IC code, we unfold a few
+ // levels of the stack frame iteration code. This yields a ~35% speedup
when
+ // running DeltaBlue and a ~25% speedup of gbemu with the '--nouse-ic'
flag.
+ const Address entry =
+ Isolate::c_entry_fp(isolate->thread_local_top());
+ Address* pc_address =
+ reinterpret_cast<Address*>(entry +
ExitFrameConstants::kCallerPCOffset);
+ Address fp = Memory::Address_at(entry +
ExitFrameConstants::kCallerFPOffset);
+ // If there's another JavaScript frame on the stack or a
+ // StubFailureTrampoline, we need to look one frame further down the
stack to
+ // find the frame pointer and the return address stack slot.
+ if (depth == EXTRA_CALL_FRAME) {
+ const int kCallerPCOffset = StandardFrameConstants::kCallerPCOffset;
+ pc_address = reinterpret_cast<Address*>(fp + kCallerPCOffset);
+ fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset);
+ }
+#ifdef DEBUG
StackFrameIterator it;
for (int i = 0; i < depth + 1; i++) it.Advance();
- // Skip StubFailureTrampolineFrames
- if (it.frame()->is_stub_failure_trampoline()) {
- it.Advance();
- }
StackFrame* frame = it.frame();
- fp_ = frame->fp();
- pc_address_ = frame->pc_address();
+ ASSERT(fp == frame->fp() && pc_address == frame->pc_address());
+#endif
+ fp_ = fp;
+ pc_address_ = pc_address;
}
@@ -1876,7 +1890,7 @@
RUNTIME_FUNCTION(MaybeObject*, LoadIC_Miss) {
HandleScope scope(isolate);
ASSERT(args.length() == 2);
- LoadIC ic(isolate);
+ LoadIC ic(IC::NO_EXTRA_FRAME, isolate);
IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
return ic.Load(state, args.at<Object>(0), args.at<String>(1));
}
@@ -1886,7 +1900,16 @@
RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss) {
HandleScope scope(isolate);
ASSERT(args.length() == 2);
- KeyedLoadIC ic(isolate);
+ KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate);
+ IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
+ return ic.Load(state, args.at<Object>(0), args.at<Object>(1), MISS);
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 2);
+ KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate);
IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
return ic.Load(state, args.at<Object>(0), args.at<Object>(1), MISS);
}
@@ -1895,7 +1918,7 @@
RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissForceGeneric) {
HandleScope scope(isolate);
ASSERT(args.length() == 2);
- KeyedLoadIC ic(isolate);
+ KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate);
IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
return ic.Load(state,
args.at<Object>(0),
=======================================
--- /branches/bleeding_edge/src/ic.h Mon Jan 28 06:41:55 2013
+++ /branches/bleeding_edge/src/ic.h Wed Jan 30 06:25:34 2013
@@ -342,7 +342,7 @@
class LoadIC: public IC {
public:
- explicit LoadIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) {
+ explicit LoadIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate)
{
ASSERT(target()->is_load_stub() || target()->is_keyed_load_stub());
}
@@ -404,7 +404,8 @@
class KeyedLoadIC: public LoadIC {
public:
- explicit KeyedLoadIC(Isolate* isolate) : LoadIC(isolate) {
+ explicit KeyedLoadIC(FrameDepth depth, Isolate* isolate)
+ : LoadIC(depth, isolate) {
ASSERT(target()->is_keyed_load_stub());
}
@@ -813,6 +814,7 @@
void PatchInlinedSmiCode(Address address, InlinedSmiCheck check);
DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss);
+DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure);
} } // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Tue Jan 29 01:12:20
2013
+++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Wed Jan 30 06:25:34
2013
@@ -45,7 +45,7 @@
descriptor->register_param_count_ = 2;
descriptor->register_params_ = registers;
descriptor->deoptimization_handler_ =
- FUNCTION_ADDR(KeyedLoadIC_Miss);
+ FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
}
--
--
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.