MIPS: Use type feedback for Array (non-constructor) call sites. (issue 17447004)

1 view
Skip to first unread message

kilv...@homejinni.com

unread,
Jun 19, 2013, 11:59:05 AM6/19/13
to da...@chromium.org, mvst...@chromium.org, pli...@gmail.com, pal...@homejinni.com, ger...@homejinni.com, v8-...@googlegroups.com
Reviewers: danno, mvstanton, Paul Lind, palfia, kisg,

Description:
MIPS: Use type feedback for Array (non-constructor) call sites.

Port r15201 (8c56d50)

BUG=


Please review this at https://codereview.chromium.org/17447004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
M src/mips/stub-cache-mips.cc


Index: src/mips/stub-cache-mips.cc
diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc
index
51df45224abdb33a3d2e1d7cf4d758cf06b6e2d9..220233682a193fadd54f376f6f1931c290cc1fe7
100644
--- a/src/mips/stub-cache-mips.cc
+++ b/src/mips/stub-cache-mips.cc
@@ -1714,12 +1714,61 @@ Handle<Code>
CallStubCompiler::CompileCallField(Handle<JSObject> object,
}


+Handle<Code> CallStubCompiler::CompileArrayCodeCall(
+ Handle<Object> object,
+ Handle<JSObject> holder,
+ Handle<Cell> cell,
+ Handle<JSFunction> function,
+ Handle<String> name,
+ Code::StubType type) {
+ Label miss;
+
+ // Check that function is still array
+ const int argc = arguments().immediate();
+ GenerateNameCheck(name, &miss);
+ Register receiver = a1;
+
+ if (cell.is_null()) {
+ __ lw(receiver, MemOperand(sp, argc * kPointerSize));
+
+ // Check that the receiver isn't a smi.
+ __ JumpIfSmi(receiver, &miss);
+
+ // Check that the maps haven't changed.
+ CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, a3,
a0,
+ t0, name, &miss);
+ } else {
+ ASSERT(cell->value() == *function);
+ GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder,
name,
+ &miss);
+ GenerateLoadFunctionFromCell(cell, function, &miss);
+ }
+
+ Handle<Smi> kind(Smi::FromInt(GetInitialFastElementsKind()), isolate());
+ Handle<Cell> kind_feedback_cell =
+ isolate()->factory()->NewCell(kind);
+ __ li(a0, Operand(argc));
+ __ li(a2, Operand(kind_feedback_cell));
+ __ li(a1, Operand(function));
+
+ ArrayConstructorStub stub(isolate());
+ __ TailCallStub(&stub);
+
+ __ bind(&miss);
+ GenerateMissBranch();
+
+ // Return the generated code.
+ return GetCode(type, name);
+}
+
+
Handle<Code> CallStubCompiler::CompileArrayPushCall(
Handle<Object> object,
Handle<JSObject> holder,
Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- a2 : name
// -- ra : return address
@@ -1964,7 +2013,7 @@ Handle<Code> CallStubCompiler::CompileArrayPushCall(
GenerateMissBranch();

// Return the generated code.
- return GetCode(function);
+ return GetCode(type, name);
}


@@ -1973,7 +2022,8 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall(
Handle<JSObject> holder,
Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- a2 : name
// -- ra : return address
@@ -2046,7 +2096,7 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall(
GenerateMissBranch();

// Return the generated code.
- return GetCode(function);
+ return GetCode(type, name);
}


@@ -2055,7 +2105,8 @@ Handle<Code>
CallStubCompiler::CompileStringCharCodeAtCall(
Handle<JSObject> holder,
Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- a2 : function name
// -- ra : return address
@@ -2128,7 +2179,7 @@ Handle<Code>
CallStubCompiler::CompileStringCharCodeAtCall(
GenerateMissBranch();

// Return the generated code.
- return GetCode(function);
+ return GetCode(type, name);
}


@@ -2137,7 +2188,8 @@ Handle<Code>
CallStubCompiler::CompileStringCharAtCall(
Handle<JSObject> holder,
Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- a2 : function name
// -- ra : return address
@@ -2209,7 +2261,7 @@ Handle<Code>
CallStubCompiler::CompileStringCharAtCall(
GenerateMissBranch();

// Return the generated code.
- return GetCode(function);
+ return GetCode(type, name);
}


@@ -2218,7 +2270,8 @@ Handle<Code>
CallStubCompiler::CompileStringFromCharCodeCall(
Handle<JSObject> holder,
Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- a2 : function name
// -- ra : return address
@@ -2282,7 +2335,7 @@ Handle<Code>
CallStubCompiler::CompileStringFromCharCodeCall(
GenerateMissBranch();

// Return the generated code.
- return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
+ return GetCode(type, name);
}


@@ -2291,7 +2344,8 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall(
Handle<JSObject> holder,
Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- a2 : function name
// -- ra : return address
@@ -2411,7 +2465,7 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall(
GenerateMissBranch();

// Return the generated code.
- return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
+ return GetCode(type, name);
}


@@ -2420,7 +2474,8 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall(
Handle<JSObject> holder,
Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- a2 : function name
// -- ra : return address
@@ -2510,7 +2565,7 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall(
GenerateMissBranch();

// Return the generated code.
- return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
+ return GetCode(type, name);
}


@@ -2692,7 +2747,8 @@ Handle<Code> CallStubCompiler::CompileCallConstant(
if (HasCustomCallGenerator(function)) {
Handle<Code> code = CompileCustomCall(object, holder,
Handle<Cell>::null(),
- function,
Handle<String>::cast(name));
+ function,
Handle<String>::cast(name),
+ Code::CONSTANT_FUNCTION);
// A null handle means bail out to the regular compiler code below.
if (!code.is_null()) return code;
}
@@ -2761,7 +2817,8 @@ Handle<Code> CallStubCompiler::CompileCallGlobal(

if (HasCustomCallGenerator(function)) {
Handle<Code> code = CompileCustomCall(
- object, holder, cell, function, Handle<String>::cast(name));
+ object, holder, cell, function, Handle<String>::cast(name),
+ Code::NORMAL);
// A null handle means bail out to the regular compiler code below.
if (!code.is_null()) return code;
}


pli...@gmail.com

unread,
Jun 19, 2013, 12:33:31 PM6/19/13
to kilv...@homejinni.com, da...@chromium.org, mvst...@chromium.org, pal...@homejinni.com, ger...@homejinni.com, v8-...@googlegroups.com
LGTM, modulo the nit. I will fix that and land it for you.


https://codereview.chromium.org/17447004/diff/1/src/mips/stub-cache-mips.cc
File src/mips/stub-cache-mips.cc (right):

https://codereview.chromium.org/17447004/diff/1/src/mips/stub-cache-mips.cc#newcode1726
src/mips/stub-cache-mips.cc:1726: // Check that function is still array
nit, end with period.

https://codereview.chromium.org/17447004/

pli...@gmail.com

unread,
Jun 19, 2013, 1:11:18 PM6/19/13
to kilv...@homejinni.com, da...@chromium.org, mvst...@chromium.org, pal...@homejinni.com, ger...@homejinni.com, v8-...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages