X87: Implement subclassing Arrays.

port 1604bd46bf (r26972).

original commit message:

   Implement subclassing Arrays.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#27001}
This commit is contained in:
chunyang.dai 2015-03-04 18:58:50 -08:00 committed by Commit bot
parent 5c1ae4ba3a
commit a3773e4d29

View File

@ -4306,7 +4306,7 @@ void ArrayConstructorStub::GenerateDispatchToArrayStub(
void ArrayConstructorStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- eax : argc (only if argument_count() == ANY)
// -- eax : argc (only if argument_count() is ANY or MORE_THAN_ONE)
// -- ebx : AllocationSite or undefined
// -- edi : constructor
// -- edx : Original constructor
@ -4340,9 +4340,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ cmp(ebx, isolate()->factory()->undefined_value());
__ j(equal, &no_info);
__ cmp(edx, edi);
__ j(not_equal, &subclassing);
// Only look at the lower 16 bits of the transition info.
__ mov(edx, FieldOperand(ebx, AllocationSite::kTransitionInfoOffset));
__ SmiUntag(edx);
@ -4353,8 +4350,29 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
// Subclassing.
__ bind(&subclassing);
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
__ pop(ecx); // return address.
__ push(edi);
__ push(edx);
// Adjust argc.
switch (argument_count()) {
case ANY:
case MORE_THAN_ONE:
__ add(eax, Immediate(2));
break;
case NONE:
__ mov(eax, Immediate(2));
break;
case ONE:
__ mov(eax, Immediate(3));
break;
}
__ push(ecx);
__ JumpToExternalReference(
ExternalReference(Runtime::kArrayConstructorWithSubclassing, isolate()));
}