Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Revert of Implement subclassing Arrays. (patchset #6 id:90001 of http…
Browse files Browse the repository at this point in the history
…s://codereview.chromium.org/975463002/)

Reason for revert:
ARM build failure...

Original issue's description:
> Implement subclassing Arrays.
>
> R=mvstanton@chromium.org,arv@chromium.org,rossberg@chromium.org
> BUG=v8:3930
> LOG=Y
>
> Committed: https://crrev.com/6898da1a28d64d1fb2962804ba566f6d618ffc70
> Cr-Commit-Position: refs/heads/master@{#26960}

TBR=arv@chromium.org,rossberg@chromium.org,dslomov@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:3930

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

Cr-Commit-Position: refs/heads/master@{#26961}
  • Loading branch information
ripsawridge authored and Commit bot committed Mar 3, 2015
1 parent 6898da1 commit 01e2ba6
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 308 deletions.
20 changes: 1 addition & 19 deletions src/arm/code-stubs-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4639,25 +4639,7 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

__ bind(&subclassing);
__ push(r1);
__ push(r3);

// Adjust argc.
switch (argument_count()) {
case ANY:
case MORE_THAN_ONE:
__ add(r0, r0, Operand(2));
break;
case NONE:
__ mov(r0, Operand(2));
break;
case ONE:
__ mov(r0, Operand(3));
break;
}

__ JumpToExternalReference(
ExternalReference(Runtime::kArrayConstructorWithSubclassing, isolate()));
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down
23 changes: 4 additions & 19 deletions src/arm64/code-stubs-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5016,11 +5016,12 @@ void ArrayConstructorStub::GenerateDispatchToArrayStub(
void ArrayConstructorStub::Generate(MacroAssembler* masm) {
ASM_LOCATION("ArrayConstructorStub::Generate");
// ----------- S t a t e -------------
// -- x0 : argc (only if argument_count() is ANY or MORE_THAN_ONE)
// -- x0 : argc (only if argument_count() == ANY)
// -- x1 : constructor
// -- x2 : AllocationSite or undefined
// -- x3 : original constructor
// -- sp[0] : last argument
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
Register constructor = x1;
Register allocation_site = x2;
Expand Down Expand Up @@ -5064,24 +5065,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ Bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

// Subclassing support.
__ Bind(&subclassing);
__ Push(constructor, original_constructor);
// Adjust argc.
switch (argument_count()) {
case ANY:
case MORE_THAN_ONE:
__ add(x0, x0, Operand(2));
break;
case NONE:
__ Mov(x0, Operand(2));
break;
case ONE:
__ Mov(x0, Operand(3));
break;
}
__ JumpToExternalReference(
ExternalReference(Runtime::kArrayConstructorWithSubclassing, isolate()));
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down
28 changes: 5 additions & 23 deletions src/ia32/code-stubs-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4646,7 +4646,7 @@ void ArrayConstructorStub::GenerateDispatchToArrayStub(

void ArrayConstructorStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- eax : argc (only if argument_count() is ANY or MORE_THAN_ONE)
// -- eax : argc (only if argument_count() == ANY)
// -- ebx : AllocationSite or undefined
// -- edi : constructor
// -- edx : Original constructor
Expand Down Expand Up @@ -4680,6 +4680,9 @@ 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);
Expand All @@ -4690,29 +4693,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

// Subclassing.
__ bind(&subclassing);
__ 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()));
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down
27 changes: 4 additions & 23 deletions src/mips/code-stubs-mips.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4797,11 +4797,12 @@ void ArrayConstructorStub::GenerateDispatchToArrayStub(

void ArrayConstructorStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- a0 : argc (only if argument_count() is ANY or MORE_THAN_ONE)
// -- a0 : argc (only if argument_count() == ANY)
// -- a1 : constructor
// -- a2 : AllocationSite or undefined
// -- a3 : Original constructor
// -- sp[0] : last argument
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------

if (FLAG_debug_code) {
Expand Down Expand Up @@ -4839,28 +4840,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

// Subclassing.
__ bind(&subclassing);
__ Push(a1);
__ Push(a3);

// Adjust argc.
switch (argument_count()) {
case ANY:
case MORE_THAN_ONE:
__ li(at, Operand(2));
__ addu(a0, a0, at);
break;
case NONE:
__ li(a0, Operand(2));
break;
case ONE:
__ li(a0, Operand(3));
break;
}

__ JumpToExternalReference(
ExternalReference(Runtime::kArrayConstructorWithSubclassing, isolate()));
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down
25 changes: 3 additions & 22 deletions src/mips64/code-stubs-mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4844,7 +4844,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
// -- a1 : constructor
// -- a2 : AllocationSite or undefined
// -- a3 : original constructor
// -- sp[0] : last argument
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------

if (FLAG_debug_code) {
Expand Down Expand Up @@ -4882,28 +4883,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

// Subclassing.
__ bind(&subclassing);
__ Push(a1);
__ Push(a3);

// Adjust argc.
switch (argument_count()) {
case ANY:
case MORE_THAN_ONE:
__ li(at, Operand(2));
__ addu(a0, a0, at);
break;
case NONE:
__ li(a0, Operand(2));
break;
case ONE:
__ li(a0, Operand(3));
break;
}

__ JumpToExternalReference(
ExternalReference(Runtime::kArrayConstructorWithSubclassing, isolate()));
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down
30 changes: 2 additions & 28 deletions src/runtime/runtime-array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,6 @@ RUNTIME_FUNCTION(Runtime_GetArrayKeys) {

static Object* ArrayConstructorCommon(Isolate* isolate,
Handle<JSFunction> constructor,
Handle<JSFunction> original_constructor,
Handle<AllocationSite> site,
Arguments* caller_args) {
Factory* factory = isolate->factory();
Expand Down Expand Up @@ -1110,19 +1109,6 @@ static Object* ArrayConstructorCommon(Isolate* isolate,
// We must mark the allocationsite as un-inlinable.
site->SetDoNotInlineCall();
}

// Set up the prototoype using original function.
// TODO(dslomov): instead of setting the __proto__,
// use and cache the correct map.
if (*original_constructor != *constructor) {
if (original_constructor->has_instance_prototype()) {
Handle<Object> prototype =
handle(original_constructor->instance_prototype(), isolate);
RETURN_FAILURE_ON_EXCEPTION(
isolate, JSObject::SetPrototype(array, prototype, false));
}
}

return *array;
}

Expand Down Expand Up @@ -1156,19 +1142,7 @@ RUNTIME_FUNCTION(Runtime_ArrayConstructor) {
DCHECK(!site->SitePointsToLiteral());
}

return ArrayConstructorCommon(isolate, constructor, constructor, site,
caller_args);
}


RUNTIME_FUNCTION(Runtime_ArrayConstructorWithSubclassing) {
HandleScope scope(isolate);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, args.length() - 2);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, original_constructor,
args.length() - 1);
Arguments caller_args(args.length() - 2, args.arguments());
return ArrayConstructorCommon(isolate, constructor, original_constructor,
Handle<AllocationSite>::null(), &caller_args);
return ArrayConstructorCommon(isolate, constructor, site, caller_args);
}


Expand All @@ -1187,7 +1161,7 @@ RUNTIME_FUNCTION(Runtime_InternalArrayConstructor) {
DCHECK(arg_count == caller_args->length());
}
#endif
return ArrayConstructorCommon(isolate, constructor, constructor,
return ArrayConstructorCommon(isolate, constructor,
Handle<AllocationSite>::null(), caller_args);
}

Expand Down
1 change: 0 additions & 1 deletion src/runtime/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ namespace internal {
\
/* Arrays */ \
F(ArrayConstructor, -1, 1) \
F(ArrayConstructorWithSubclassing, -1, 1) \
F(InternalArrayConstructor, -1, 1) \
\
/* Literals */ \
Expand Down
24 changes: 1 addition & 23 deletions src/x64/code-stubs-x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4636,30 +4636,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

// Subclassing
__ bind(&subclassing);
__ Pop(rcx); // return address.
__ Push(rdi);
__ Push(rdx);

// Adjust argc.
switch (argument_count()) {
case ANY:
case MORE_THAN_ONE:
__ addp(rax, Immediate(2));
break;
case NONE:
__ movp(rax, Immediate(2));
break;
case ONE:
__ movp(rax, Immediate(3));
break;
}

__ Push(rcx);
__ JumpToExternalReference(
ExternalReference(Runtime::kArrayConstructorWithSubclassing, isolate()),
1);
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down
Loading

0 comments on commit 01e2ba6

Please sign in to comment.