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

Port r15201 (8c56d50)

BUG=
R=plind44@gmail.com

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

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15211 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
plind44@gmail.com 2013-06-19 17:08:46 +00:00
parent ade5b02606
commit f76e55fb38

View File

@ -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;
}