Index: src/ic.h |
diff --git a/src/ic.h b/src/ic.h |
index eefd6532da429d21f100d83f9c23ba522039b1fb..b42b5fa556c3be5e79766bb2b76bd71a169ffea4 100644 |
--- a/src/ic.h |
+++ b/src/ic.h |
@@ -19,6 +19,7 @@ const int kMaxKeyedPolymorphism = 4; |
#define IC_UTIL_LIST(ICU) \ |
ICU(LoadIC_Miss) \ |
ICU(KeyedLoadIC_Miss) \ |
+ ICU(CallIC_Miss) \ |
ICU(StoreIC_Miss) \ |
ICU(StoreIC_ArrayLength) \ |
ICU(StoreIC_Slow) \ |
@@ -104,6 +105,10 @@ class IC { |
bool IsStoreStub() const { |
return target()->is_store_stub() || target()->is_keyed_store_stub(); |
} |
+ |
+ bool IsCallStub() const { |
+ return target()->is_call_stub(); |
+ } |
#endif |
// Determines which map must be used for keeping the code stub. |
@@ -325,6 +330,78 @@ class IC_Utility { |
}; |
+class CallIC: public IC { |
+ public: |
+ enum CallType { METHOD, FUNCTION }; |
+ |
+ class State V8_FINAL BASE_EMBEDDED { |
+ public: |
+ explicit State(ExtraICState extra_ic_state); |
+ |
+ static State DefaultCallState(int argc, CallType call_type) { |
+ return State(argc, call_type); |
+ } |
+ |
+ static State MegamorphicCallState(int argc, CallType call_type) { |
+ return State(argc, call_type); |
+ } |
+ |
+ InlineCacheState GetICState() const { return ::v8::internal::GENERIC; } |
+ |
+ ExtraICState GetExtraICState() const; |
+ |
+ static void GenerateAheadOfTime( |
+ Isolate*, void (*Generate)(Isolate*, const State&)); |
+ |
+ int arg_count() const { return argc_; } |
+ CallType call_type() const { return call_type_; } |
+ |
+ bool CallAsMethod() const { return call_type_ == METHOD; } |
+ |
+ void Print(StringStream* stream) const; |
+ |
+ bool operator==(const State& other_state) const { |
+ return (argc_ == other_state.argc_ && |
+ call_type_ == other_state.call_type_); |
+ } |
+ |
+ bool operator!=(const State& other_state) const { |
+ return !(*this == other_state); |
+ } |
+ |
+ private: |
+ State(int argc, |
+ CallType call_type) |
+ : argc_(argc), |
+ call_type_(call_type) { |
+ } |
+ |
+ class ArgcBits: public BitField<int, 0, Code::kArgumentsBits> {}; |
+ class CallTypeBits: public BitField<CallType, Code::kArgumentsBits, 1> {}; |
+ |
+ const int argc_; |
+ const CallType call_type_; |
+ }; |
+ |
+ explicit CallIC(Isolate* isolate) |
+ : IC(EXTRA_CALL_FRAME, isolate) { |
+ } |
+ |
+ void HandleMiss(Handle<Object> receiver, |
+ Handle<Object> function, |
+ Handle<FixedArray> vector, |
+ Handle<Smi> slot); |
+ |
+ // Code generator routines. |
+ static Handle<Code> initialize_stub(Isolate* isolate, |
+ int argc, |
+ CallType call_type); |
+ |
+ static void Clear(Isolate* isolate, Address address, Code* target, |
+ ConstantPoolArray* constant_pool); |
+}; |
+ |
+ |
class LoadIC: public IC { |
public: |
// ExtraICState bits |