Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/ic.cc

Issue 12084063: Fix gbemu preformance regression (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ic.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } while (false) 104 } while (false)
105 105
106 #else 106 #else
107 #define TRACE_GENERIC_IC(type, reason) 107 #define TRACE_GENERIC_IC(type, reason)
108 #endif // DEBUG 108 #endif // DEBUG
109 109
110 #define TRACE_IC(type, name, old_state, new_target) \ 110 #define TRACE_IC(type, name, old_state, new_target) \
111 ASSERT((TraceIC(type, name, old_state, new_target), true)) 111 ASSERT((TraceIC(type, name, old_state, new_target), true))
112 112
113 IC::IC(FrameDepth depth, Isolate* isolate) : isolate_(isolate) { 113 IC::IC(FrameDepth depth, Isolate* isolate) : isolate_(isolate) {
114 ASSERT(isolate == Isolate::Current()); 114 // To improve the performance of the (much used) IC code, we unfold a few
115 // levels of the stack frame iteration code. This yields a ~35% speedup when
116 // running DeltaBlue and a ~25% speedup of gbemu with the '--nouse-ic' flag.
117 const Address entry =
118 Isolate::c_entry_fp(isolate->thread_local_top());
119 Address* pc_address =
120 reinterpret_cast<Address*>(entry + ExitFrameConstants::kCallerPCOffset);
121 Address fp = Memory::Address_at(entry + ExitFrameConstants::kCallerFPOffset);
122 // If there's another JavaScript frame on the stack or a
123 // StubFailureTrampoline, we need to look one frame further down the stack to
124 // find the frame pointer and the return address stack slot.
125 if (depth == EXTRA_CALL_FRAME) {
126 const int kCallerPCOffset = StandardFrameConstants::kCallerPCOffset;
127 pc_address = reinterpret_cast<Address*>(fp + kCallerPCOffset);
128 fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset);
129 }
130 #ifdef DEBUG
115 StackFrameIterator it; 131 StackFrameIterator it;
116 for (int i = 0; i < depth + 1; i++) it.Advance(); 132 for (int i = 0; i < depth + 1; i++) it.Advance();
117 // Skip StubFailureTrampolineFrames
118 if (it.frame()->is_stub_failure_trampoline()) {
119 it.Advance();
120 }
121 StackFrame* frame = it.frame(); 133 StackFrame* frame = it.frame();
122 fp_ = frame->fp(); 134 ASSERT(fp == frame->fp() && pc_address == frame->pc_address());
123 pc_address_ = frame->pc_address(); 135 #endif
136 fp_ = fp;
137 pc_address_ = pc_address;
124 } 138 }
125 139
126 140
127 #ifdef ENABLE_DEBUGGER_SUPPORT 141 #ifdef ENABLE_DEBUGGER_SUPPORT
128 Address IC::OriginalCodeAddress() const { 142 Address IC::OriginalCodeAddress() const {
129 HandleScope scope; 143 HandleScope scope;
130 // Compute the JavaScript frame for the frame pointer of this IC 144 // Compute the JavaScript frame for the frame pointer of this IC
131 // structure. We need this to be able to find the function 145 // structure. We need this to be able to find the function
132 // corresponding to the frame. 146 // corresponding to the frame.
133 StackFrameIterator it; 147 StackFrameIterator it;
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 Handle<JSFunction> function(raw_function); 1883 Handle<JSFunction> function(raw_function);
1870 JSFunction::CompileLazy(function, CLEAR_EXCEPTION); 1884 JSFunction::CompileLazy(function, CLEAR_EXCEPTION);
1871 return *function; 1885 return *function;
1872 } 1886 }
1873 1887
1874 1888
1875 // Used from ic-<arch>.cc. 1889 // Used from ic-<arch>.cc.
1876 RUNTIME_FUNCTION(MaybeObject*, LoadIC_Miss) { 1890 RUNTIME_FUNCTION(MaybeObject*, LoadIC_Miss) {
1877 HandleScope scope(isolate); 1891 HandleScope scope(isolate);
1878 ASSERT(args.length() == 2); 1892 ASSERT(args.length() == 2);
1879 LoadIC ic(isolate); 1893 LoadIC ic(IC::NO_EXTRA_FRAME, isolate);
1880 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]); 1894 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1881 return ic.Load(state, args.at<Object>(0), args.at<String>(1)); 1895 return ic.Load(state, args.at<Object>(0), args.at<String>(1));
1882 } 1896 }
1883 1897
1884 1898
1885 // Used from ic-<arch>.cc 1899 // Used from ic-<arch>.cc
1886 RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss) { 1900 RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss) {
1887 HandleScope scope(isolate); 1901 HandleScope scope(isolate);
1888 ASSERT(args.length() == 2); 1902 ASSERT(args.length() == 2);
1889 KeyedLoadIC ic(isolate); 1903 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate);
1890 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]); 1904 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1891 return ic.Load(state, args.at<Object>(0), args.at<Object>(1), MISS); 1905 return ic.Load(state, args.at<Object>(0), args.at<Object>(1), MISS);
1892 } 1906 }
1907
1908
1909 RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure) {
1910 HandleScope scope(isolate);
1911 ASSERT(args.length() == 2);
1912 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate);
1913 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1914 return ic.Load(state, args.at<Object>(0), args.at<Object>(1), MISS);
1915 }
1893 1916
1894 1917
1895 RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissForceGeneric) { 1918 RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissForceGeneric) {
1896 HandleScope scope(isolate); 1919 HandleScope scope(isolate);
1897 ASSERT(args.length() == 2); 1920 ASSERT(args.length() == 2);
1898 KeyedLoadIC ic(isolate); 1921 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate);
1899 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]); 1922 IC::State state = IC::StateFrom(ic.target(), args[0], args[1]);
1900 return ic.Load(state, 1923 return ic.Load(state,
1901 args.at<Object>(0), 1924 args.at<Object>(0),
1902 args.at<Object>(1), 1925 args.at<Object>(1),
1903 MISS_FORCE_GENERIC); 1926 MISS_FORCE_GENERIC);
1904 } 1927 }
1905 1928
1906 1929
1907 // Used from ic-<arch>.cc. 1930 // Used from ic-<arch>.cc.
1908 RUNTIME_FUNCTION(MaybeObject*, StoreIC_Miss) { 1931 RUNTIME_FUNCTION(MaybeObject*, StoreIC_Miss) {
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 #undef ADDR 2582 #undef ADDR
2560 }; 2583 };
2561 2584
2562 2585
2563 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2586 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2564 return IC_utilities[id]; 2587 return IC_utilities[id];
2565 } 2588 }
2566 2589
2567 2590
2568 } } // namespace v8::internal 2591 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698