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

Side by Side Diff: src/ic.h

Issue 25238002: Always cache the original target in a handle on the IC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Return updated target 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') | 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 NO_EXTRA_FRAME = 0, 88 NO_EXTRA_FRAME = 0,
89 EXTRA_CALL_FRAME = 1 89 EXTRA_CALL_FRAME = 1
90 }; 90 };
91 91
92 // Construct the IC structure with the given number of extra 92 // Construct the IC structure with the given number of extra
93 // JavaScript frames on the stack. 93 // JavaScript frames on the stack.
94 IC(FrameDepth depth, Isolate* isolate); 94 IC(FrameDepth depth, Isolate* isolate);
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 Code* target() const { return GetTargetAtAddress(address()); } 98 Handle<Code> target() const { return target_; }
99 Code* raw_target() const { return GetTargetAtAddress(address()); }
100
99 inline Address address() const; 101 inline Address address() const;
100 102
101 // Compute the current IC state based on the target stub, receiver and name. 103 // Compute the current IC state based on the target stub, receiver and name.
102 static State StateFrom(Code* target, Object* receiver, Object* name); 104 static State StateFrom(Code* target, Object* receiver, Object* name);
103 105
104 // Clear the inline cache to initial state. 106 // Clear the inline cache to initial state.
105 static void Clear(Isolate* isolate, Address address); 107 static void Clear(Isolate* isolate, Address address);
106 108
107 // Computes the reloc info for this IC. This is a fairly expensive 109 // Computes the reloc info for this IC. This is a fairly expensive
108 // operation as it has to search through the heap to find the code 110 // operation as it has to search through the heap to find the code
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 Address fp_; 205 Address fp_;
204 206
205 // All access to the program counter of an IC structure is indirect 207 // All access to the program counter of an IC structure is indirect
206 // to make the code GC safe. This feature is crucial since 208 // to make the code GC safe. This feature is crucial since
207 // GetProperty and SetProperty are called and they in turn might 209 // GetProperty and SetProperty are called and they in turn might
208 // invoke the garbage collector. 210 // invoke the garbage collector.
209 Address* pc_address_; 211 Address* pc_address_;
210 212
211 Isolate* isolate_; 213 Isolate* isolate_;
212 214
215 // The original code target that missed.
216 Handle<Code> target_;
217
213 DISALLOW_IMPLICIT_CONSTRUCTORS(IC); 218 DISALLOW_IMPLICIT_CONSTRUCTORS(IC);
214 }; 219 };
215 220
216 221
217 // An IC_Utility encapsulates IC::UtilityId. It exists mainly because you 222 // An IC_Utility encapsulates IC::UtilityId. It exists mainly because you
218 // cannot make forward declarations to an enum. 223 // cannot make forward declarations to an enum.
219 class IC_Utility { 224 class IC_Utility {
220 public: 225 public:
221 explicit IC_Utility(IC::UtilityId id) 226 explicit IC_Utility(IC::UtilityId id)
222 : address_(IC::AddressFromUtilityId(id)), id_(id) {} 227 : address_(IC::AddressFromUtilityId(id)), id_(id) {}
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); 861 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss);
857 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); 862 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure);
858 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); 863 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss);
859 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 864 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
860 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 865 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
861 866
862 867
863 } } // namespace v8::internal 868 } } // namespace v8::internal
864 869
865 #endif // V8_IC_H_ 870 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « no previous file | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698