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

Side by Side Diff: src/ic.h

Issue 25464004: Use PatchCache for call ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | « no previous file | src/ic.cc » ('j') | src/ic.cc » ('J')
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 virtual ~IC() {} 95 virtual ~IC() {}
96 96
97 // Get the call-site target; used for determining the state. 97 // Get the call-site target; used for determining the state.
98 Handle<Code> target() const { return target_; } 98 Handle<Code> target() const { return target_; }
99 Code* raw_target() const { return GetTargetAtAddress(address()); } 99 Code* raw_target() const { return GetTargetAtAddress(address()); }
100 100
101 State state() const { return state_; } 101 State state() const { return state_; }
102 inline Address address() const; 102 inline Address address() const;
103 103
104 // Compute the current IC state based on the target stub, receiver and name. 104 // Compute the current IC state based on the target stub, receiver and name.
105 void UpdateState(Object* receiver, Object* name); 105 void UpdateState(Handle<Object> receiver, Handle<Object> name);
106 void MarkMonomorphicPrototypeFailure() { 106 void MarkMonomorphicPrototypeFailure() {
107 state_ = MONOMORPHIC_PROTOTYPE_FAILURE; 107 state_ = MONOMORPHIC_PROTOTYPE_FAILURE;
108 } 108 }
109 109
110 // Clear the inline cache to initial state. 110 // Clear the inline cache to initial state.
111 static void Clear(Isolate* isolate, Address address); 111 static void Clear(Isolate* isolate, Address address);
112 112
113 // Computes the reloc info for this IC. This is a fairly expensive 113 // Computes the reloc info for this IC. This is a fairly expensive
114 // operation as it has to search through the heap to find the code 114 // operation as it has to search through the heap to find the code
115 // object that contains this IC site. 115 // object that contains this IC site.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // containing break points (calls to DebugBreakXXX builtins). 153 // containing break points (calls to DebugBreakXXX builtins).
154 Address OriginalCodeAddress() const; 154 Address OriginalCodeAddress() const;
155 #endif 155 #endif
156 156
157 // Set the call-site target. 157 // Set the call-site target.
158 void set_target(Code* code) { SetTargetAtAddress(address(), code); } 158 void set_target(Code* code) { SetTargetAtAddress(address(), code); }
159 159
160 #ifdef DEBUG 160 #ifdef DEBUG
161 char TransitionMarkFromState(IC::State state); 161 char TransitionMarkFromState(IC::State state);
162 162
163 void TraceIC(const char* type, 163 void TraceIC(const char* type, Handle<Object> name);
164 Handle<Object> name,
165 Code* new_target);
166 #endif 164 #endif
167 165
168 Failure* TypeError(const char* type, 166 Failure* TypeError(const char* type,
169 Handle<Object> object, 167 Handle<Object> object,
170 Handle<Object> key); 168 Handle<Object> key);
171 Failure* ReferenceError(const char* type, Handle<String> name); 169 Failure* ReferenceError(const char* type, Handle<String> name);
172 170
173 // Access the target code for the given IC address. 171 // Access the target code for the given IC address.
174 static inline Code* GetTargetAtAddress(Address address); 172 static inline Code* GetTargetAtAddress(Address address);
175 static inline void SetTargetAtAddress(Address address, Code* target); 173 static inline void SetTargetAtAddress(Address address, Code* target);
(...skipping 15 matching lines...) Expand all
191 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); 189 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code);
192 virtual Handle<Code> megamorphic_stub() { 190 virtual Handle<Code> megamorphic_stub() {
193 UNREACHABLE(); 191 UNREACHABLE();
194 return Handle<Code>::null(); 192 return Handle<Code>::null();
195 } 193 }
196 virtual Handle<Code> generic_stub() const { 194 virtual Handle<Code> generic_stub() const {
197 UNREACHABLE(); 195 UNREACHABLE();
198 return Handle<Code>::null(); 196 return Handle<Code>::null();
199 } 197 }
200 virtual StrictModeFlag strict_mode() const { return kNonStrictMode; } 198 virtual StrictModeFlag strict_mode() const { return kNonStrictMode; }
201 bool TryRemoveInvalidPrototypeDependentStub(Object* receiver, Object* name); 199 bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver,
200 Handle<String> name);
202 201
203 private: 202 private:
204 // Frame pointer for the frame that uses (calls) the IC. 203 // Frame pointer for the frame that uses (calls) the IC.
205 Address fp_; 204 Address fp_;
206 205
207 // All access to the program counter of an IC structure is indirect 206 // All access to the program counter of an IC structure is indirect
208 // to make the code GC safe. This feature is crucial since 207 // to make the code GC safe. This feature is crucial since
209 // GetProperty and SetProperty are called and they in turn might 208 // GetProperty and SetProperty are called and they in turn might
210 // invoke the garbage collector. 209 // invoke the garbage collector.
211 Address* pc_address_; 210 Address* pc_address_;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 Handle<String> name); 245 Handle<String> name);
247 246
248 protected: 247 protected:
249 CallICBase(Code::Kind kind, Isolate* isolate) 248 CallICBase(Code::Kind kind, Isolate* isolate)
250 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} 249 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {}
251 250
252 virtual Code::ExtraICState extra_ic_state() { return Code::kNoExtraICState; } 251 virtual Code::ExtraICState extra_ic_state() { return Code::kNoExtraICState; }
253 252
254 // Compute a monomorphic stub if possible, otherwise return a null handle. 253 // Compute a monomorphic stub if possible, otherwise return a null handle.
255 Handle<Code> ComputeMonomorphicStub(LookupResult* lookup, 254 Handle<Code> ComputeMonomorphicStub(LookupResult* lookup,
256 Code::ExtraICState extra_state,
257 Handle<Object> object, 255 Handle<Object> object,
258 Handle<String> name); 256 Handle<String> name);
259 257
260 // Update the inline cache and the global stub cache based on the lookup 258 // Update the inline cache and the global stub cache based on the lookup
261 // result. 259 // result.
262 void UpdateCaches(LookupResult* lookup, 260 void UpdateCaches(LookupResult* lookup,
263 Handle<Object> object, 261 Handle<Object> object,
264 Handle<String> name); 262 Handle<String> name);
265 263
266 // Returns a JSFunction if the object can be called as a function, and 264 // Returns a JSFunction if the object can be called as a function, and
(...skipping 12 matching lines...) Expand all
279 IC::UtilityId id, 277 IC::UtilityId id,
280 Code::ExtraICState extra_state); 278 Code::ExtraICState extra_state);
281 279
282 static void GenerateNormal(MacroAssembler* masm, int argc); 280 static void GenerateNormal(MacroAssembler* masm, int argc);
283 281
284 static void GenerateMonomorphicCacheProbe(MacroAssembler* masm, 282 static void GenerateMonomorphicCacheProbe(MacroAssembler* masm,
285 int argc, 283 int argc,
286 Code::Kind kind, 284 Code::Kind kind,
287 Code::ExtraICState extra_state); 285 Code::ExtraICState extra_state);
288 286
287 virtual Handle<Code> megamorphic_stub();
288 virtual Handle<Code> pre_monomorphic_stub();
289
289 Code::Kind kind_; 290 Code::Kind kind_;
290 291
291 friend class IC; 292 friend class IC;
292 }; 293 };
293 294
294 295
295 class CallIC: public CallICBase { 296 class CallIC: public CallICBase {
296 public: 297 public:
297 explicit CallIC(Isolate* isolate) 298 explicit CallIC(Isolate* isolate)
298 : CallICBase(Code::CALL_IC, isolate), 299 : CallICBase(Code::CALL_IC, isolate),
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); 858 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss);
858 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); 859 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure);
859 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 860 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
860 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 861 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
861 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 862 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
862 863
863 864
864 } } // namespace v8::internal 865 } } // namespace v8::internal
865 866
866 #endif // V8_IC_H_ 867 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « no previous file | src/ic.cc » ('j') | src/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698