Index: src/ic.h |
diff --git a/src/ic.h b/src/ic.h |
index 213a48182635badf5c833729e0d8d143e999b6c8..54b90bf3918b1abc66a468ccae2b5e30305d2324 100644 |
--- a/src/ic.h |
+++ b/src/ic.h |
@@ -42,6 +42,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) \ |
@@ -111,6 +112,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. |
@@ -280,6 +285,86 @@ class IC_Utility { |
}; |
+class CallIC: public IC { |
+ public: |
+ class State V8_FINAL BASE_EMBEDDED { |
+ public: |
+ explicit State(ExtraICState extra_ic_state); |
+ |
+ State(int argc, |
+ bool call_as_method, |
+ bool monomorphic = false, |
+ bool args_match = true, |
+ bool strict_native = false) |
+ : argc_(argc), |
+ call_as_method_(call_as_method), |
+ monomorphic_(monomorphic), |
+ args_match_(args_match), |
+ strict_native_(strict_native) { |
+ } |
+ |
+ InlineCacheState GetICState() const { |
+ return monomorphic_ |
+ ? ::v8::internal::MONOMORPHIC |
+ : ::v8::internal::GENERIC; |
+ } |
+ |
+ ExtraICState GetExtraICState() const; |
+ |
+ static int ExtractArgcFromMinorKey(int minor_key) { |
Toon Verwaest
2014/03/10 13:50:44
minor key -> ExtraICState? Only code stubs have ma
|
+ return ArgBits::decode(minor_key); |
+ } |
+ |
+ static void GenerateAheadOfTime( |
+ Isolate*, void (*Generate)(Isolate*, const State&)); |
+ |
+ int arg_count() const { return argc_; } |
+ bool call_as_method() const { return call_as_method_; } |
+ bool monomorphic() const { return monomorphic_; } |
+ bool args_match() const { return args_match_; } |
+ bool strict_native() const { return strict_native_; } |
+ |
+ void Print(StringStream* stream) const; |
+ |
+ private: |
+ STATIC_ASSERT(Code::kArgumentsBits == 16); |
Toon Verwaest
2014/03/10 13:50:44
What about just using kArgumentsBits in the counts
mvstanton
2014/03/20 15:51:53
Done.
|
+ class ArgBits: public BitField<int, 0, 16> {}; |
+ class CallAsMethodBits: public BitField<bool, 16, 1> {}; |
+ class MonomorphicBits: public BitField<bool, 17, 1> {}; |
+ class ArgsMatchBits: public BitField<bool, 18, 1> {}; |
+ class StrictNativeBits: public BitField<bool, 19, 1> {}; |
+ // We have a few extra bits. |
Toon Verwaest
2014/03/10 13:50:44
Not sure how many you have left. Aren't these enco
mvstanton
2014/03/20 15:51:53
Old comment, removed.
|
+ |
+ int argc_; |
+ bool call_as_method_; |
+ bool monomorphic_; |
+ bool args_match_; |
+ bool strict_native_; |
+ }; |
+ |
+ 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 void GenerateNormal(MacroAssembler* masm, int argc, |
+ bool call_as_method); |
+ static Handle<Code> initialize_stub(Isolate* isolate, |
+ int argc, |
+ bool call_as_method); |
+ |
+ static void Clear(Address address, Code* target); |
+ |
+ private: |
+ void PatchMegamorphic(int arg_count, bool call_as_method); |
+}; |
+ |
+ |
class LoadIC: public IC { |
public: |
// ExtraICState bits |