OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 StubRuntimeCallHelper call_helper; | 1481 StubRuntimeCallHelper call_helper; |
1482 char_at_generator.GenerateSlow(masm, call_helper); | 1482 char_at_generator.GenerateSlow(masm, call_helper); |
1483 | 1483 |
1484 __ bind(&miss); | 1484 __ bind(&miss); |
1485 PropertyAccessCompiler::TailCallBuiltin( | 1485 PropertyAccessCompiler::TailCallBuiltin( |
1486 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 1486 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
1487 } | 1487 } |
1488 | 1488 |
1489 | 1489 |
1490 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 1490 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
| 1491 CHECK(!has_new_target()); |
1491 // The displacement is the offset of the last parameter (if any) | 1492 // The displacement is the offset of the last parameter (if any) |
1492 // relative to the frame pointer. | 1493 // relative to the frame pointer. |
1493 const int kDisplacement = | 1494 const int kDisplacement = |
1494 StandardFrameConstants::kCallerSPOffset - kPointerSize; | 1495 StandardFrameConstants::kCallerSPOffset - kPointerSize; |
1495 DCHECK(r1.is(ArgumentsAccessReadDescriptor::index())); | 1496 DCHECK(r1.is(ArgumentsAccessReadDescriptor::index())); |
1496 DCHECK(r0.is(ArgumentsAccessReadDescriptor::parameter_count())); | 1497 DCHECK(r0.is(ArgumentsAccessReadDescriptor::parameter_count())); |
1497 | 1498 |
1498 // Check that the key is a smi. | 1499 // Check that the key is a smi. |
1499 Label slow; | 1500 Label slow; |
1500 __ JumpIfNotSmi(r1, &slow); | 1501 __ JumpIfNotSmi(r1, &slow); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 __ push(r1); | 1539 __ push(r1); |
1539 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); | 1540 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); |
1540 } | 1541 } |
1541 | 1542 |
1542 | 1543 |
1543 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { | 1544 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
1544 // sp[0] : number of parameters | 1545 // sp[0] : number of parameters |
1545 // sp[4] : receiver displacement | 1546 // sp[4] : receiver displacement |
1546 // sp[8] : function | 1547 // sp[8] : function |
1547 | 1548 |
| 1549 CHECK(!has_new_target()); |
| 1550 |
1548 // Check if the calling frame is an arguments adaptor frame. | 1551 // Check if the calling frame is an arguments adaptor frame. |
1549 Label runtime; | 1552 Label runtime; |
1550 __ ldr(r3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1553 __ ldr(r3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1551 __ ldr(r2, MemOperand(r3, StandardFrameConstants::kContextOffset)); | 1554 __ ldr(r2, MemOperand(r3, StandardFrameConstants::kContextOffset)); |
1552 __ cmp(r2, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 1555 __ cmp(r2, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
1553 __ b(ne, &runtime); | 1556 __ b(ne, &runtime); |
1554 | 1557 |
1555 // Patch the arguments.length and the parameters pointer in the current frame. | 1558 // Patch the arguments.length and the parameters pointer in the current frame. |
1556 __ ldr(r2, MemOperand(r3, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1559 __ ldr(r2, MemOperand(r3, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
1557 __ str(r2, MemOperand(sp, 0 * kPointerSize)); | 1560 __ str(r2, MemOperand(sp, 0 * kPointerSize)); |
1558 __ add(r3, r3, Operand(r2, LSL, 1)); | 1561 __ add(r3, r3, Operand(r2, LSL, 1)); |
1559 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); | 1562 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); |
1560 __ str(r3, MemOperand(sp, 1 * kPointerSize)); | 1563 __ str(r3, MemOperand(sp, 1 * kPointerSize)); |
1561 | 1564 |
1562 __ bind(&runtime); | 1565 __ bind(&runtime); |
1563 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1); | 1566 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1); |
1564 } | 1567 } |
1565 | 1568 |
1566 | 1569 |
1567 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { | 1570 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
1568 // Stack layout: | 1571 // Stack layout: |
1569 // sp[0] : number of parameters (tagged) | 1572 // sp[0] : number of parameters (tagged) |
1570 // sp[4] : address of receiver argument | 1573 // sp[4] : address of receiver argument |
1571 // sp[8] : function | 1574 // sp[8] : function |
1572 // Registers used over whole function: | 1575 // Registers used over whole function: |
1573 // r6 : allocated object (tagged) | 1576 // r6 : allocated object (tagged) |
1574 // r9 : mapped parameter count (tagged) | 1577 // r9 : mapped parameter count (tagged) |
1575 | 1578 |
| 1579 CHECK(!has_new_target()); |
| 1580 |
1576 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | 1581 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
1577 // r1 = parameter count (tagged) | 1582 // r1 = parameter count (tagged) |
1578 | 1583 |
1579 // Check if the calling frame is an arguments adaptor frame. | 1584 // Check if the calling frame is an arguments adaptor frame. |
1580 Label runtime; | 1585 Label runtime; |
1581 Label adaptor_frame, try_allocate; | 1586 Label adaptor_frame, try_allocate; |
1582 __ ldr(r3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1587 __ ldr(r3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1583 __ ldr(r2, MemOperand(r3, StandardFrameConstants::kContextOffset)); | 1588 __ ldr(r2, MemOperand(r3, StandardFrameConstants::kContextOffset)); |
1584 __ cmp(r2, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 1589 __ cmp(r2, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
1585 __ b(eq, &adaptor_frame); | 1590 __ b(eq, &adaptor_frame); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1806 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 1811 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
1807 __ b(eq, &adaptor_frame); | 1812 __ b(eq, &adaptor_frame); |
1808 | 1813 |
1809 // Get the length from the frame. | 1814 // Get the length from the frame. |
1810 __ ldr(r1, MemOperand(sp, 0)); | 1815 __ ldr(r1, MemOperand(sp, 0)); |
1811 __ b(&try_allocate); | 1816 __ b(&try_allocate); |
1812 | 1817 |
1813 // Patch the arguments.length and the parameters pointer. | 1818 // Patch the arguments.length and the parameters pointer. |
1814 __ bind(&adaptor_frame); | 1819 __ bind(&adaptor_frame); |
1815 __ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1820 __ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 1821 if (has_new_target()) { |
| 1822 // Subtract 1 from smi-tagged arguments count. |
| 1823 __ sub(r1, r1, Operand(2)); |
| 1824 } |
1816 __ str(r1, MemOperand(sp, 0)); | 1825 __ str(r1, MemOperand(sp, 0)); |
1817 __ add(r3, r2, Operand::PointerOffsetFromSmiKey(r1)); | 1826 __ add(r3, r2, Operand::PointerOffsetFromSmiKey(r1)); |
1818 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); | 1827 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); |
1819 __ str(r3, MemOperand(sp, 1 * kPointerSize)); | 1828 __ str(r3, MemOperand(sp, 1 * kPointerSize)); |
1820 | 1829 |
1821 // Try the new space allocation. Start out with computing the size | 1830 // Try the new space allocation. Start out with computing the size |
1822 // of the arguments object and the elements array in words. | 1831 // of the arguments object and the elements array in words. |
1823 Label add_arguments_object; | 1832 Label add_arguments_object; |
1824 __ bind(&try_allocate); | 1833 __ bind(&try_allocate); |
1825 __ SmiUntag(r1, SetCC); | 1834 __ SmiUntag(r1, SetCC); |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); | 2566 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
2558 __ b(eq, &feedback_register_initialized); | 2567 __ b(eq, &feedback_register_initialized); |
2559 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 2568 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
2560 __ bind(&feedback_register_initialized); | 2569 __ bind(&feedback_register_initialized); |
2561 } | 2570 } |
2562 | 2571 |
2563 __ AssertUndefinedOrAllocationSite(r2, r5); | 2572 __ AssertUndefinedOrAllocationSite(r2, r5); |
2564 } | 2573 } |
2565 | 2574 |
2566 // Pass function as original constructor. | 2575 // Pass function as original constructor. |
2567 __ mov(r3, r1); | 2576 if (IsSuperConstructorCall()) { |
| 2577 __ mov(r4, Operand(1 * kPointerSize)); |
| 2578 __ add(r4, r4, Operand(r0, LSL, kPointerSizeLog2)); |
| 2579 __ ldr(r3, MemOperand(sp, r4)); |
| 2580 } else { |
| 2581 __ mov(r3, r1); |
| 2582 } |
2568 | 2583 |
2569 // Jump to the function-specific construct stub. | 2584 // Jump to the function-specific construct stub. |
2570 Register jmp_reg = r4; | 2585 Register jmp_reg = r4; |
2571 __ ldr(jmp_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 2586 __ ldr(jmp_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
2572 __ ldr(jmp_reg, FieldMemOperand(jmp_reg, | 2587 __ ldr(jmp_reg, FieldMemOperand(jmp_reg, |
2573 SharedFunctionInfo::kConstructStubOffset)); | 2588 SharedFunctionInfo::kConstructStubOffset)); |
2574 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); | 2589 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); |
2575 | 2590 |
2576 // r0: number of arguments | 2591 // r0: number of arguments |
2577 // r1: called object | 2592 // r1: called object |
(...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4963 kStackUnwindSpace, NULL, | 4978 kStackUnwindSpace, NULL, |
4964 MemOperand(fp, 6 * kPointerSize), NULL); | 4979 MemOperand(fp, 6 * kPointerSize), NULL); |
4965 } | 4980 } |
4966 | 4981 |
4967 | 4982 |
4968 #undef __ | 4983 #undef __ |
4969 | 4984 |
4970 } } // namespace v8::internal | 4985 } } // namespace v8::internal |
4971 | 4986 |
4972 #endif // V8_TARGET_ARCH_ARM | 4987 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |