Commit 2e42f629 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Minor-key-ify CallICStub and CallIC_ArrayStub.

R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/491143003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23403 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 261b142f
......@@ -2978,7 +2978,7 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
// r1 - function
// r3 - slot id
Label miss;
int argc = state_.arg_count();
int argc = arg_count();
ParameterCount actual(argc);
EmitLoadTypeFeedbackVector(masm, r2);
......@@ -3020,7 +3020,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
Label extra_checks_or_miss, slow_start;
Label slow, non_function, wrap, cont;
Label have_js_function;
int argc = state_.arg_count();
int argc = arg_count();
ParameterCount actual(argc);
EmitLoadTypeFeedbackVector(masm, r2);
......@@ -3032,7 +3032,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ b(ne, &extra_checks_or_miss);
__ bind(&have_js_function);
if (state_.CallAsMethod()) {
if (CallAsMethod()) {
EmitContinueIfStrictOrNative(masm, &cont);
// Compute the receiver in sloppy mode.
__ ldr(r3, MemOperand(sp, argc * kPointerSize));
......@@ -3049,7 +3049,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ bind(&slow);
EmitSlowCase(masm, argc, &non_function);
if (state_.CallAsMethod()) {
if (CallAsMethod()) {
__ bind(&wrap);
EmitWrapCase(masm, argc, &cont);
}
......@@ -3093,7 +3093,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) {
// Get the receiver of the function from the stack; 1 ~ return address.
__ ldr(r4, MemOperand(sp, (state_.arg_count() + 1) * kPointerSize));
__ ldr(r4, MemOperand(sp, (arg_count() + 1) * kPointerSize));
{
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
......
......@@ -3282,7 +3282,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
Label extra_checks_or_miss, slow_start;
Label slow, non_function, wrap, cont;
Label have_js_function;
int argc = state_.arg_count();
int argc = arg_count();
ParameterCount actual(argc);
Register function = x1;
......@@ -3301,7 +3301,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ B(ne, &extra_checks_or_miss);
__ bind(&have_js_function);
if (state_.CallAsMethod()) {
if (CallAsMethod()) {
EmitContinueIfStrictOrNative(masm, &cont);
// Compute the receiver in sloppy mode.
......@@ -3321,7 +3321,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ bind(&slow);
EmitSlowCase(masm, argc, function, type, &non_function);
if (state_.CallAsMethod()) {
if (CallAsMethod()) {
__ bind(&wrap);
EmitWrapCase(masm, argc, &cont);
}
......@@ -3364,7 +3364,7 @@ void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) {
ASM_LOCATION("CallICStub[Miss]");
// Get the receiver of the function from the stack; 1 ~ return address.
__ Peek(x4, (state_.arg_count() + 1) * kPointerSize);
__ Peek(x4, (arg_count() + 1) * kPointerSize);
{
FrameScope scope(masm, StackFrame::INTERNAL);
......
......@@ -554,12 +554,12 @@ Type* CompareNilICStub::GetInputType(Zone* zone, Handle<Map> map) {
void CallIC_ArrayStub::PrintState(OStream& os) const { // NOLINT
os << state_ << " (Array)";
os << state() << " (Array)";
}
void CallICStub::PrintState(OStream& os) const { // NOLINT
os << state_;
os << state();
}
......
......@@ -854,39 +854,43 @@ class MathPowStub: public PlatformCodeStub {
class CallICStub: public PlatformCodeStub {
public:
CallICStub(Isolate* isolate, const CallIC::State& state)
: PlatformCodeStub(isolate), state_(state) {}
bool CallAsMethod() const { return state_.CallAsMethod(); }
int arg_count() const { return state_.arg_count(); }
: PlatformCodeStub(isolate) {
minor_key_ = state.GetExtraICState();
}
static int ExtractArgcFromMinorKey(int minor_key) {
CallIC::State state((ExtraICState) minor_key);
CallIC::State state(static_cast<ExtraICState>(minor_key));
return state.arg_count();
}
virtual void Generate(MacroAssembler* masm);
virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
return Code::CALL_IC;
}
virtual Code::Kind GetCodeKind() const V8_OVERRIDE { return Code::CALL_IC; }
virtual InlineCacheState GetICState() const V8_OVERRIDE { return DEFAULT; }
virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE {
return state_.GetExtraICState();
return static_cast<ExtraICState>(minor_key_);
}
protected:
virtual uint32_t MinorKey() const { return GetExtraICState(); }
virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT
bool CallAsMethod() const { return state().call_type() == CallIC::METHOD; }
virtual CodeStub::Major MajorKey() const { return CallIC; }
int arg_count() const { return state().arg_count(); }
CallIC::State state() const {
return CallIC::State(static_cast<ExtraICState>(minor_key_));
}
// Code generation helpers.
void GenerateMiss(MacroAssembler* masm, IC::UtilityId id);
const CallIC::State state_;
private:
virtual CodeStub::Major MajorKey() const { return CallIC; }
virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT
DISALLOW_COPY_AND_ASSIGN(CallICStub);
};
......@@ -901,10 +905,12 @@ class CallIC_ArrayStub: public CallICStub {
return MONOMORPHIC;
}
protected:
private:
virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT
virtual CodeStub::Major MajorKey() const { return CallIC_Array; }
DISALLOW_COPY_AND_ASSIGN(CallIC_ArrayStub);
};
......@@ -1191,7 +1197,9 @@ class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub {
public:
BinaryOpICWithAllocationSiteStub(Isolate* isolate,
const BinaryOpIC::State& state)
: PlatformCodeStub(isolate), state_(state) {}
: PlatformCodeStub(isolate), state_(state) {
minor_key_ = state.GetExtraICState();
}
static void GenerateAheadOfTime(Isolate* isolate);
......
......@@ -2366,7 +2366,7 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
// edi - function
// edx - slot id
Label miss;
int argc = state_.arg_count();
int argc = arg_count();
ParameterCount actual(argc);
EmitLoadTypeFeedbackVector(masm, ebx);
......@@ -2410,7 +2410,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
Label extra_checks_or_miss, slow_start;
Label slow, non_function, wrap, cont;
Label have_js_function;
int argc = state_.arg_count();
int argc = arg_count();
ParameterCount actual(argc);
EmitLoadTypeFeedbackVector(masm, ebx);
......@@ -2421,7 +2421,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ j(not_equal, &extra_checks_or_miss);
__ bind(&have_js_function);
if (state_.CallAsMethod()) {
if (CallAsMethod()) {
EmitContinueIfStrictOrNative(masm, &cont);
// Load the receiver from the stack.
......@@ -2440,7 +2440,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ bind(&slow);
EmitSlowCase(isolate, masm, argc, &non_function);
if (state_.CallAsMethod()) {
if (CallAsMethod()) {
__ bind(&wrap);
EmitWrapCase(masm, argc, &cont);
}
......@@ -2489,7 +2489,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) {
// Get the receiver of the function from the stack; 1 ~ return address.
__ mov(ecx, Operand(esp, (state_.arg_count() + 1) * kPointerSize));
__ mov(ecx, Operand(esp, (arg_count() + 1) * kPointerSize));
{
FrameScope scope(masm, StackFrame::INTERNAL);
......
......@@ -2248,7 +2248,7 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
// rdi - function
// rdx - slot id (as integer)
Label miss;
int argc = state_.arg_count();
int argc = arg_count();
ParameterCount actual(argc);
EmitLoadTypeFeedbackVector(masm, rbx);
......@@ -2293,7 +2293,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
Label extra_checks_or_miss, slow_start;
Label slow, non_function, wrap, cont;
Label have_js_function;
int argc = state_.arg_count();
int argc = arg_count();
StackArgumentsAccessor args(rsp, argc);
ParameterCount actual(argc);
......@@ -2306,7 +2306,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ j(not_equal, &extra_checks_or_miss);
__ bind(&have_js_function);
if (state_.CallAsMethod()) {
if (CallAsMethod()) {
EmitContinueIfStrictOrNative(masm, &cont);
// Load the receiver from the stack.
......@@ -2325,7 +2325,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ bind(&slow);
EmitSlowCase(isolate, masm, &args, argc, &non_function);
if (state_.CallAsMethod()) {
if (CallAsMethod()) {
__ bind(&wrap);
EmitWrapCase(masm, &args, &cont);
}
......@@ -2372,7 +2372,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) {
// Get the receiver of the function from the stack; 1 ~ return address.
__ movp(rcx, Operand(rsp, (state_.arg_count() + 1) * kPointerSize));
__ movp(rcx, Operand(rsp, (arg_count() + 1) * kPointerSize));
{
FrameScope scope(masm, StackFrame::INTERNAL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment