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

Commit

Permalink
Revert of Disallow subclassing Arrays. (patchset #3 id:40001 of https…
Browse files Browse the repository at this point in the history
…://codereview.chromium.org/962263002/)

Reason for revert:
Fails on nosnap build

Original issue's description:
> Disallow subclassing Arrays.
>
> [email protected],[email protected]
> BUG=v8:3930
> LOG=Y
>
> Committed: https://crrev.com/87f3e08e72510ee5544e82bb7ad39b2b5f001ad3
> Cr-Commit-Position: refs/heads/master@{#26925}

[email protected],[email protected]
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:3930

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

Cr-Commit-Position: refs/heads/master@{#26930}
  • Loading branch information
dslomov authored and Commit bot committed Feb 27, 2015
1 parent 65abdb7 commit 47b6e27
Show file tree
Hide file tree
Showing 15 changed files with 1 addition and 73 deletions.
1 change: 0 additions & 1 deletion src/arm/builtins-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
__ Assert(eq, kUnexpectedInitialMapForArrayFunction);
}

__ mov(r3, r1);
// Run the native code for the Array function called as a normal function.
// tail call a stub
__ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
Expand Down
9 changes: 0 additions & 9 deletions src/arm/code-stubs-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2663,7 +2663,6 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
__ b(ne, &miss);

__ mov(r2, r4);
__ mov(r3, r1);
ArrayConstructorStub stub(masm->isolate(), arg_count());
__ TailCallStub(&stub);

Expand Down Expand Up @@ -4574,7 +4573,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
// -- r0 : argc (only if argument_count() == ANY)
// -- r1 : constructor
// -- r2 : AllocationSite or undefined
// -- r3 : original constructor
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
Expand All @@ -4595,10 +4593,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ AssertUndefinedOrAllocationSite(r2, r4);
}

Label subclassing;
__ cmp(r3, r1);
__ b(ne, &subclassing);

Label no_info;
// Get the elements kind and case on that.
__ CompareRoot(r2, Heap::kUndefinedValueRootIndex);
Expand All @@ -4612,9 +4606,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {

__ bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

__ bind(&subclassing);
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down
1 change: 0 additions & 1 deletion src/arm64/builtins-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {

// Run the native code for the Array function called as a normal function.
__ LoadRoot(x2, Heap::kUndefinedValueRootIndex);
__ Mov(x3, x1);
ArrayConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
}
Expand Down
12 changes: 0 additions & 12 deletions src/arm64/code-stubs-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3071,9 +3071,6 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {

Register allocation_site = feedback_vector;
__ Mov(allocation_site, scratch);

Register original_constructor = x3;
__ Mov(original_constructor, function);
ArrayConstructorStub stub(masm->isolate(), arg_count());
__ TailCallStub(&stub);

Expand Down Expand Up @@ -5009,13 +5006,11 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
// -- x0 : argc (only if argument_count() == ANY)
// -- x1 : constructor
// -- x2 : AllocationSite or undefined
// -- x3 : original constructor
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
Register constructor = x1;
Register allocation_site = x2;
Register original_constructor = x3;

if (FLAG_debug_code) {
// The array construct code is only set for the global and natives
Expand All @@ -5037,10 +5032,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ AssertUndefinedOrAllocationSite(allocation_site, x10);
}

Label subclassing;
__ Cmp(original_constructor, constructor);
__ B(ne, &subclassing);

Register kind = x3;
Label no_info;
// Get the elements kind and case on that.
Expand All @@ -5054,9 +5045,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {

__ Bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

__ Bind(&subclassing);
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down
1 change: 0 additions & 1 deletion src/ia32/builtins-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,6 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {

// Get the Array function.
__ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, edi);
__ mov(edx, edi);

if (FLAG_debug_code) {
// Initial map for the builtin Array function should be a map.
Expand Down
9 changes: 0 additions & 9 deletions src/ia32/code-stubs-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2252,7 +2252,6 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
__ j(not_equal, &miss);

__ mov(ebx, ecx);
__ mov(edx, edi);
ArrayConstructorStub stub(masm->isolate(), arg_count());
__ TailCallStub(&stub);

Expand Down Expand Up @@ -4631,7 +4630,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
// -- eax : argc (only if argument_count() == ANY)
// -- ebx : AllocationSite or undefined
// -- edi : constructor
// -- edx : Original constructor
// -- esp[0] : return address
// -- esp[4] : last argument
// -----------------------------------
Expand All @@ -4652,15 +4650,11 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
}

Label no_info;
Label subclassing;
// If the feedback vector is the undefined value call an array constructor
// that doesn't use AllocationSites.
__ 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 @@ -4670,9 +4664,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {

__ bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

__ bind(&subclassing);
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down
3 changes: 1 addition & 2 deletions src/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ var kMessages = {
super_constructor_call: ["A 'super' constructor call may only appear as the first statement of a function, and its arguments may not access 'this'. Other forms are not yet supported."],
duplicate_proto: ["Duplicate __proto__ fields are not allowed in object literals"],
param_after_rest: ["Rest parameter must be last formal parameter"],
constructor_noncallable: ["Class constructors cannot be invoked without 'new'"],
array_not_subclassable: ["Subclassing Arrays is not currently supported."]
constructor_noncallable: ["Class constructors cannot be invoked without 'new'"]
};


Expand Down
1 change: 0 additions & 1 deletion src/mips/builtins-mips.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {

// Run the native code for the Array function called as a normal function.
// Tail call a stub.
__ mov(a3, a1);
__ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
ArrayConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
Expand Down
8 changes: 0 additions & 8 deletions src/mips/code-stubs-mips.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2808,7 +2808,6 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
__ Branch(&miss, ne, t1, Operand(at));

__ mov(a2, t0);
__ mov(a3, a1);
ArrayConstructorStub stub(masm->isolate(), arg_count());
__ TailCallStub(&stub);

Expand Down Expand Up @@ -4800,7 +4799,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
// -- a0 : argc (only if argument_count() == ANY)
// -- a1 : constructor
// -- a2 : AllocationSite or undefined
// -- a3 : Original constructor
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
Expand All @@ -4823,9 +4821,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ AssertUndefinedOrAllocationSite(a2, t0);
}

Label subclassing;
__ Branch(&subclassing, ne, a1, Operand(a3));

Label no_info;
// Get the elements kind and case on that.
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
Expand All @@ -4839,9 +4834,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {

__ bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

__ bind(&subclassing);
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down
1 change: 0 additions & 1 deletion src/mips64/builtins-mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {

// Run the native code for the Array function called as a normal function.
// Tail call a stub.
__ mov(a3, a1);
__ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
ArrayConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
Expand Down
8 changes: 0 additions & 8 deletions src/mips64/code-stubs-mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2886,7 +2886,6 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
__ Branch(&miss, ne, a5, Operand(at));

__ mov(a2, a4);
__ mov(a3, a1);
ArrayConstructorStub stub(masm->isolate(), arg_count());
__ TailCallStub(&stub);

Expand Down Expand Up @@ -4843,7 +4842,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
// -- a0 : argc (only if argument_count() == ANY)
// -- a1 : constructor
// -- a2 : AllocationSite or undefined
// -- a3 : original constructor
// -- sp[0] : return address
// -- sp[4] : last argument
// -----------------------------------
Expand All @@ -4866,9 +4864,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ AssertUndefinedOrAllocationSite(a2, a4);
}

Label subclassing;
__ Branch(&subclassing, ne, a1, Operand(a3));

Label no_info;
// Get the elements kind and case on that.
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
Expand All @@ -4882,9 +4877,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {

__ bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

__ bind(&subclassing);
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down
9 changes: 0 additions & 9 deletions src/runtime/runtime-classes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ RUNTIME_FUNCTION(Runtime_ThrowConstructorNonCallableError) {
}


RUNTIME_FUNCTION(Runtime_ThrowArrayNotSubclassableError) {
HandleScope scope(isolate);
DCHECK(args.length() == 0);
THROW_NEW_ERROR_RETURN_FAILURE(
isolate,
NewTypeError("array_not_subclassable", HandleVector<Object>(NULL, 0)));
}


RUNTIME_FUNCTION(Runtime_ToMethod) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
Expand Down
1 change: 0 additions & 1 deletion src/runtime/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ namespace internal {
F(LoadFromSuper, 3, 1) \
F(LoadKeyedFromSuper, 3, 1) \
F(ThrowConstructorNonCallableError, 0, 1) \
F(ThrowArrayNotSubclassableError, 0, 1) \
F(ThrowNonMethodError, 0, 1) \
F(ThrowUnsupportedSuperError, 0, 1) \
F(HandleStepInForDerivedConstructors, 1, 1) \
Expand Down
1 change: 0 additions & 1 deletion src/x64/builtins-x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,6 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
__ Check(equal, kUnexpectedInitialMapForArrayFunction);
}

__ movp(rdx, rdi);
// Run the native code for the Array function called as a normal function.
// tail call a stub
__ LoadRoot(rbx, Heap::kUndefinedValueRootIndex);
Expand Down
9 changes: 0 additions & 9 deletions src/x64/code-stubs-x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,6 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
__ j(not_equal, &miss);

__ movp(rbx, rcx);
__ movp(rdx, rdi);
ArrayConstructorStub stub(masm->isolate(), arg_count());
__ TailCallStub(&stub);

Expand Down Expand Up @@ -4573,7 +4572,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
// -- rax : argc
// -- rbx : AllocationSite or undefined
// -- rdi : constructor
// -- rdx : original constructor
// -- rsp[0] : return address
// -- rsp[8] : last argument
// -----------------------------------
Expand All @@ -4594,10 +4592,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ AssertUndefinedOrAllocationSite(rbx);
}

Label subclassing;
__ cmpp(rdi, rdx);
__ j(not_equal, &subclassing);

Label no_info;
// If the feedback vector is the undefined value call an array constructor
// that doesn't use AllocationSites.
Expand All @@ -4613,9 +4607,6 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {

__ bind(&no_info);
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);

__ bind(&subclassing);
__ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1);
}


Expand Down

0 comments on commit 47b6e27

Please sign in to comment.