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