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

Unified Diff: src/ic.h

Issue 408183003: Express LoadIC extra ic state with LoadIC::State (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/objects.h » ('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 61845d1d69f6fca4024ba186cb0079f1edda6c4f..6ca416ac0a22cdde87acd911dc5089375c1a128a 100644
--- a/src/ic.h
+++ b/src/ic.h
@@ -380,9 +380,6 @@ OStream& operator<<(OStream& os, const CallIC::State& s);
class LoadIC: public IC {
public:
- // ExtraICState bits
- class ContextualModeBits: public BitField<ContextualMode, 0, 1> {};
- STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0);
enum ParameterIndices {
kReceiverIndex,
@@ -397,16 +394,38 @@ class LoadIC: public IC {
static const Register SlotRegister();
static const Register VectorRegister();
- static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) {
- return ContextualModeBits::encode(contextual_mode);
+ class State V8_FINAL BASE_EMBEDDED {
+ public:
+ explicit State(ExtraICState extra_ic_state)
+ : typeof_state_(TypeofStateBits::decode(extra_ic_state)) {}
+
+ State(TypeofState typeof_state) : typeof_state_(typeof_state) {}
+
+ ExtraICState GetExtraICState() const {
+ return TypeofStateBits::encode(typeof_state_);
+ }
+
+ TypeofState typeof_state() const {
+ return typeof_state_;
+ }
+
+ private:
+ class TypeofStateBits: public BitField<TypeofState, 0, 1> {};
+ STATIC_ASSERT(static_cast<int>(INSIDE_TYPEOF) == 0);
+
+ const TypeofState typeof_state_;
+ };
+
+ static ExtraICState ComputeExtraICState(TypeofState typeof_state) {
+ return State(typeof_state).GetExtraICState();
}
- static ContextualMode GetContextualMode(ExtraICState state) {
- return ContextualModeBits::decode(state);
+ static TypeofState GetTypeofState(ExtraICState state) {
+ return State(state).typeof_state();
}
- ContextualMode contextual_mode() const {
- return ContextualModeBits::decode(extra_ic_state());
+ TypeofState typeof_state() const {
+ return GetTypeofState(extra_ic_state());
}
explicit LoadIC(FrameDepth depth, Isolate* isolate)
@@ -414,13 +433,13 @@ class LoadIC: public IC {
ASSERT(IsLoadStub());
}
- // Returns if this IC is for contextual (no explicit receiver)
- // access to properties.
+ // Returns true if the receiver is the global object accessed outside of a
+ // typeof scope.
bool IsUndeclaredGlobal(Handle<Object> receiver) {
if (receiver->IsGlobalObject()) {
- return contextual_mode() == CONTEXTUAL;
+ return typeof_state() == NOT_INSIDE_TYPEOF;
} else {
- ASSERT(contextual_mode() != CONTEXTUAL);
+ ASSERT(typeof_state() == INSIDE_TYPEOF);
return false;
}
}
@@ -445,9 +464,9 @@ class LoadIC: public IC {
virtual Code::Kind kind() const { return Code::LOAD_IC; }
void set_target(Code* code) {
- // The contextual mode must be preserved across IC patching.
- ASSERT(GetContextualMode(code->extra_ic_state()) ==
- GetContextualMode(target()->extra_ic_state()));
+ // The typeof state must be preserved across IC patching.
+ ASSERT(GetTypeofState(code->extra_ic_state()) ==
+ GetTypeofState(target()->extra_ic_state()));
IC::set_target(code);
}
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698