Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index b5cf5cec5c1ac71ca6f14e4fed3f68e0d57fbd9b..fff1e2fda32749257fcff41646e4812c6920a74b 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -2252,6 +2252,7 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) { |
__ j(not_equal, &miss); |
__ mov(ebx, ecx); |
+ __ mov(edx, edi); |
ArrayConstructorStub stub(masm->isolate(), arg_count()); |
__ TailCallStub(&stub); |
@@ -4630,6 +4631,7 @@ 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 |
// ----------------------------------- |
@@ -4649,12 +4651,20 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
__ AssertUndefinedOrAllocationSite(ebx); |
} |
+ Label subclassing; |
+ |
+ __ cmp(edx, edi); |
+ __ j(not_equal, &subclassing); |
+ |
Label no_info; |
// 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); |
@@ -4664,6 +4674,9 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
__ bind(&no_info); |
GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
+ |
+ __ bind(&subclassing); |
+ __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1); |
} |