Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index 5a88942330e7d8cabbc446ee4d8d96ac87159b72..41431d16691338a1dd99b0e8818f04fb0d21ff1e 100644 |
--- a/src/code-stubs.h |
+++ b/src/code-stubs.h |
@@ -51,6 +51,7 @@ namespace internal { |
V(CompareIC) \ |
V(CompareNilIC) \ |
V(MathPow) \ |
+ V(CallIC) \ |
V(FunctionPrototype) \ |
V(RecordWrite) \ |
V(StoreBufferOverflow) \ |
@@ -839,6 +840,59 @@ class ICStub: public PlatformCodeStub { |
}; |
+class CallICStub: public PlatformCodeStub { |
+ public: |
+ explicit CallICStub(const CallIC::State& state) |
+ : state_(state) {} |
+ |
+ bool CallAsMethod() const { return state_.CallAsMethod(); } |
+ bool IsGeneric() const { |
+ return state_.IsGeneric(); |
+ } |
+ bool ArgumentsMustMatch() const { |
+ return state_.ArgumentsMustMatch(); |
+ } |
+ bool IsSloppy() const { |
+ return state_.IsSloppy(); |
+ } |
+ |
+ int arg_count() const { return state_.arg_count(); } |
+ |
+ static int ExtractArgcFromMinorKey(int minor_key) { |
+ CallIC::State state((ExtraICState) minor_key); |
+ return state.arg_count(); |
+ } |
+ |
+ virtual void Generate(MacroAssembler* masm); |
+ |
+ virtual Code::Kind GetCodeKind() const V8_OVERRIDE { |
+ return Code::CALL_IC; |
+ } |
+ |
+ virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { |
+ return state_.GetICState(); |
+ } |
+ |
+ virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE { |
+ return state_.GetExtraICState(); |
+ } |
+ |
+ protected: |
+ virtual int MinorKey() { return GetExtraICState(); } |
+ virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE; |
+ |
+ private: |
+ virtual CodeStub::Major MajorKey() { return CallIC; } |
+ |
+ // Code generation helpers. |
+ void GenerateMonomorphicCall(MacroAssembler* masm); |
+ void GenerateSlowCall(MacroAssembler* masm); |
+ void GenerateMiss(MacroAssembler* masm); |
+ |
+ CallIC::State state_; |
+}; |
+ |
+ |
class FunctionPrototypeStub: public ICStub { |
public: |
explicit FunctionPrototypeStub(Code::Kind kind) : ICStub(kind) { } |
@@ -1630,10 +1684,6 @@ class CallFunctionStub: public PlatformCodeStub { |
void Generate(MacroAssembler* masm); |
- virtual void FinishCode(Handle<Code> code) { |
- code->set_has_function_cache(RecordCallTarget()); |
- } |
- |
static int ExtractArgcFromMinorKey(int minor_key) { |
return ArgcBits::decode(minor_key); |
} |
@@ -1654,10 +1704,6 @@ class CallFunctionStub: public PlatformCodeStub { |
return FlagBits::encode(flags_) | ArgcBits::encode(argc_); |
} |
- bool RecordCallTarget() { |
- return flags_ == RECORD_CALL_TARGET; |
- } |
- |
bool CallAsMethod() { |
return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL; |
} |
@@ -1670,7 +1716,7 @@ class CallFunctionStub: public PlatformCodeStub { |
class CallConstructStub: public PlatformCodeStub { |
public: |
- explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {} |
+ explicit CallConstructStub(CallConstructorFlags flags) : flags_(flags) {} |
void Generate(MacroAssembler* masm); |
@@ -1679,7 +1725,7 @@ class CallConstructStub: public PlatformCodeStub { |
} |
private: |
- CallFunctionFlags flags_; |
+ CallConstructorFlags flags_; |
virtual void PrintName(StringStream* stream); |
@@ -1687,11 +1733,7 @@ class CallConstructStub: public PlatformCodeStub { |
int MinorKey() { return flags_; } |
bool RecordCallTarget() { |
- return (flags_ & RECORD_CALL_TARGET) != 0; |
- } |
- |
- bool CallAsMethod() { |
- return (flags_ & CALL_AS_METHOD) != 0; |
+ return (flags_ & RECORD_CONSTRUCTOR_TARGET) != 0; |
} |
}; |