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

Unified Diff: src/ic.h

Issue 71973003: Limit target() / raw_target() visibility to ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ic.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.h
diff --git a/src/ic.h b/src/ic.h
index fde4bc77a58f915c7d2772e75218c15c373eec85..8cc6c9380937d28253974c6a37fe73d2259235df 100644
--- a/src/ic.h
+++ b/src/ic.h
@@ -94,10 +94,6 @@ class IC {
IC(FrameDepth depth, Isolate* isolate);
virtual ~IC() {}
- // Get the call-site target; used for determining the state.
- Handle<Code> target() const { return target_; }
- Code* raw_target() const { return GetTargetAtAddress(address()); }
-
State state() const { return state_; }
inline Address address() const;
@@ -130,6 +126,20 @@ class IC {
return ComputeMode() == RelocInfo::CODE_TARGET_CONTEXT;
}
+#ifdef DEBUG
+ bool IsLoadStub() {
+ return target()->is_load_stub() || target()->is_keyed_load_stub();
+ }
+
+ bool IsStoreStub() {
+ return target()->is_store_stub() || target()->is_keyed_store_stub();
+ }
+
+ bool IsCallStub() {
+ return target()->is_call_stub() || target()->is_keyed_call_stub();
+ }
+#endif
+
// Determines which map must be used for keeping the code stub.
// These methods should not be called with undefined or null.
static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object,
@@ -144,6 +154,9 @@ class IC {
}
protected:
+ // Get the call-site target; used for determining the state.
+ Handle<Code> target() const { return target_; }
+
Address fp() const { return fp_; }
Address pc() const { return *pc_address_; }
Isolate* isolate() const { return isolate_; }
@@ -226,6 +239,8 @@ class IC {
void TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name);
private:
+ Code* raw_target() const { return GetTargetAtAddress(address()); }
+
// Frame pointer for the frame that uses (calls) the IC.
Address fp_;
@@ -388,7 +403,7 @@ class KeyedCallIC: public CallICBase {
class LoadIC: public IC {
public:
explicit LoadIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) {
- ASSERT(target()->is_load_stub() || target()->is_keyed_load_stub());
+ ASSERT(IsLoadStub());
}
// Code generator routines.
@@ -538,7 +553,7 @@ class StoreIC: public IC {
StoreIC(FrameDepth depth, Isolate* isolate)
: IC(depth, isolate),
strict_mode_(Code::GetStrictMode(target()->extra_ic_state())) {
- ASSERT(target()->is_store_stub() || target()->is_keyed_store_stub());
+ ASSERT(IsStoreStub());
}
virtual StrictModeFlag strict_mode() const { return strict_mode_; }
@@ -821,7 +836,7 @@ class CompareIC: public IC {
: IC(EXTRA_CALL_FRAME, isolate), op_(op) { }
// Update the inline cache for the given operands.
- void UpdateCaches(Handle<Object> x, Handle<Object> y);
+ Code* UpdateCaches(Handle<Object> x, Handle<Object> y);
// Factory method for getting an uninitialized compare stub.
@@ -874,7 +889,7 @@ class ToBooleanIC: public IC {
public:
explicit ToBooleanIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { }
- MaybeObject* ToBoolean(Handle<Object> object, Code::ExtraICState state);
+ MaybeObject* ToBoolean(Handle<Object> object);
};
« 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