Index: src/ia32/stub-cache-ia32.cc |
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc |
index c0ee28ad490c0972769f0cabc2c0a2615658594a..1a51016b831a3d1fa612f64b40f25cd76d6fd7b5 100644 |
--- a/src/ia32/stub-cache-ia32.cc |
+++ b/src/ia32/stub-cache-ia32.cc |
@@ -1696,12 +1696,59 @@ 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); |
+ |
+ if (cell.is_null()) { |
+ // Get the receiver from the stack. |
+ __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
+ |
+ // Check that the receiver isn't a smi. |
+ __ JumpIfSmi(edx, &miss); |
+ CheckPrototypes(Handle<JSObject>::cast(object), edx, holder, ebx, eax, edi, |
+ 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); |
+ __ mov(eax, Immediate(argc)); |
+ __ mov(ebx, kind_feedback_cell); |
+ __ mov(edi, 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 ------------- |
// -- ecx : name |
// -- esp[0] : return address |
@@ -1950,7 +1997,7 @@ Handle<Code> CallStubCompiler::CompileArrayPushCall( |
GenerateMissBranch(); |
// Return the generated code. |
- return GetCode(function); |
+ return GetCode(type, name); |
} |
@@ -1959,7 +2006,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 ------------- |
// -- ecx : name |
// -- esp[0] : return address |
@@ -2032,7 +2080,7 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall( |
GenerateMissBranch(); |
// Return the generated code. |
- return GetCode(function); |
+ return GetCode(type, name); |
} |
@@ -2041,7 +2089,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 ------------- |
// -- ecx : function name |
// -- esp[0] : return address |
@@ -2116,7 +2165,7 @@ Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall( |
GenerateMissBranch(); |
// Return the generated code. |
- return GetCode(function); |
+ return GetCode(type, name); |
} |
@@ -2125,7 +2174,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 ------------- |
// -- ecx : function name |
// -- esp[0] : return address |
@@ -2202,7 +2252,7 @@ Handle<Code> CallStubCompiler::CompileStringCharAtCall( |
GenerateMissBranch(); |
// Return the generated code. |
- return GetCode(function); |
+ return GetCode(type, name); |
} |
@@ -2211,7 +2261,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 ------------- |
// -- ecx : function name |
// -- esp[0] : return address |
@@ -2278,7 +2329,7 @@ Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall( |
GenerateMissBranch(); |
// Return the generated code. |
- return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
+ return GetCode(type, name); |
} |
@@ -2287,7 +2338,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 ------------- |
// -- ecx : name |
// -- esp[0] : return address |
@@ -2409,7 +2461,7 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall( |
GenerateMissBranch(); |
// Return the generated code. |
- return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
+ return GetCode(type, name); |
} |
@@ -2418,7 +2470,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 ------------- |
// -- ecx : name |
// -- esp[0] : return address |
@@ -2515,7 +2568,7 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall( |
GenerateMissBranch(); |
// Return the generated code. |
- return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
+ return GetCode(type, name); |
} |
@@ -2706,7 +2759,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; |
} |
@@ -2797,7 +2851,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; |
} |