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

Unified Diff: src/code-stubs.h

Issue 172523002: Create a function call IC (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments. Created 6 years, 9 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/builtins.cc ('k') | src/code-stubs.cc » ('j') | src/ia32/debug-ia32.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index 6337dd120deb738b60b4e4644d90e2761c02bf67..991086ac71f987c7393abe4ced6613ac4078b58e 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) \
@@ -825,6 +826,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 IsSloppyOrNonNative() const {
+ return state_.IsSloppyOrNonNative();
Toon Verwaest 2014/03/27 16:02:25 IsSloppyNonNative() It's and, not or. That, or IsS
mvstanton 2014/04/01 13:01:49 Done.
+ }
+
+ 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();
+ }
+
+ static void GenerateAheadOfTime(Isolate* isolate);
+
+ 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) { }
@@ -1613,14 +1667,11 @@ class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub {
class CallFunctionStub: public PlatformCodeStub {
public:
CallFunctionStub(int argc, CallFunctionFlags flags)
- : argc_(argc), flags_(flags) { }
+ : argc_(argc), flags_(flags) {
+ }
Toon Verwaest 2014/03/27 16:02:25 Spurious change
mvstanton 2014/04/01 13:01:49 Done.
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);
}
@@ -1641,10 +1692,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;
}
@@ -1657,7 +1704,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);
@@ -1666,7 +1713,7 @@ class CallConstructStub: public PlatformCodeStub {
}
private:
- CallFunctionFlags flags_;
+ CallConstructorFlags flags_;
virtual void PrintName(StringStream* stream);
@@ -1674,11 +1721,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;
}
};
« no previous file with comments | « src/builtins.cc ('k') | src/code-stubs.cc » ('j') | src/ia32/debug-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698