Reviewers: mvstanton,
Description:
Minor-key-ify CallICStub and CallIC_ArrayStub.
[email protected]
Please review this at https://codereview.chromium.org/491143003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+45, -37 lines):
M src/arm/code-stubs-arm.cc
M src/arm64/code-stubs-arm64.cc
M src/code-stubs.h
M src/code-stubs.cc
M src/ia32/code-stubs-ia32.cc
M src/x64/code-stubs-x64.cc
Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index
ab7c8dfd2e1df392fdecd4999837dcf5ba9fedd6..4128a1c64f212a02203fec467584e47700300c71
100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -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);
Index: src/arm64/code-stubs-arm64.cc
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc
index
508296ff97ee4e32a12f54fa3225074363811a03..76b2d16e2c7b585a6955b16d45aa25044e46ec82
100644
--- a/src/arm64/code-stubs-arm64.cc
+++ b/src/arm64/code-stubs-arm64.cc
@@ -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);
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index
1c5c7a23e985fe5e26b77143eca21e454a14f61d..ccf44e0c8811a962360491a3533f3181fac2ff45
100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -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();
}
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index
c99302a44052997e1027eaedac0d48e483c037d5..7fefdc73e07e45ad0914e1297ae198bce3c8a314
100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -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);
Index: src/ia32/code-stubs-ia32.cc
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
index
ec0ea57e68a56571fa493c0f0282c3cc0d9ac110..71f991403ed250a533bf43bb4e03c96477ab24eb
100644
--- a/src/ia32/code-stubs-ia32.cc
+++ b/src/ia32/code-stubs-ia32.cc
@@ -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);
Index: src/x64/code-stubs-x64.cc
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
index
edf2eb45ed66d969ba5c27208e75a266822c50bc..e8632a0519d0fe10477f532a5bc7e3623d826f22
100644
--- a/src/x64/code-stubs-x64.cc
+++ b/src/x64/code-stubs-x64.cc
@@ -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);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.