OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 index.translate(holder), Representation::Tagged()); | 1594 index.translate(holder), Representation::Tagged()); |
1595 GenerateJumpFunction(object, r1, &miss); | 1595 GenerateJumpFunction(object, r1, &miss); |
1596 | 1596 |
1597 HandlerFrontendFooter(&miss); | 1597 HandlerFrontendFooter(&miss); |
1598 | 1598 |
1599 // Return the generated code. | 1599 // Return the generated code. |
1600 return GetCode(Code::FAST, name); | 1600 return GetCode(Code::FAST, name); |
1601 } | 1601 } |
1602 | 1602 |
1603 | 1603 |
1604 Handle<Code> CallStubCompiler::CompileArrayPopCall( | |
1605 Handle<Object> object, | |
1606 Handle<JSObject> holder, | |
1607 Handle<Cell> cell, | |
1608 Handle<JSFunction> function, | |
1609 Handle<String> name, | |
1610 Code::StubType type) { | |
1611 // If object is not an array or is observed or sealed, bail out to regular | |
1612 // call. | |
1613 if (!object->IsJSArray() || | |
1614 !cell.is_null() || | |
1615 Handle<JSArray>::cast(object)->map()->is_observed() || | |
1616 !Handle<JSArray>::cast(object)->map()->is_extensible()) { | |
1617 return Handle<Code>::null(); | |
1618 } | |
1619 | |
1620 Label miss, return_undefined, call_builtin; | |
1621 Register receiver = r0; | |
1622 Register scratch = r1; | |
1623 Register elements = r3; | |
1624 | |
1625 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
1626 | |
1627 // Get the elements array of the object. | |
1628 __ ldr(elements, FieldMemOperand(receiver, JSArray::kElementsOffset)); | |
1629 | |
1630 // Check that the elements are in fast mode and writable. | |
1631 __ CheckMap(elements, | |
1632 scratch, | |
1633 Heap::kFixedArrayMapRootIndex, | |
1634 &call_builtin, | |
1635 DONT_DO_SMI_CHECK); | |
1636 | |
1637 // Get the array's length into r4 and calculate new length. | |
1638 __ ldr(r4, FieldMemOperand(receiver, JSArray::kLengthOffset)); | |
1639 __ sub(r4, r4, Operand(Smi::FromInt(1)), SetCC); | |
1640 __ b(lt, &return_undefined); | |
1641 | |
1642 // Get the last element. | |
1643 __ LoadRoot(r6, Heap::kTheHoleValueRootIndex); | |
1644 // We can't address the last element in one operation. Compute the more | |
1645 // expensive shift first, and use an offset later on. | |
1646 __ add(elements, elements, Operand::PointerOffsetFromSmiKey(r4)); | |
1647 __ ldr(scratch, FieldMemOperand(elements, FixedArray::kHeaderSize)); | |
1648 __ cmp(scratch, r6); | |
1649 __ b(eq, &call_builtin); | |
1650 | |
1651 // Set the array's length. | |
1652 __ str(r4, FieldMemOperand(receiver, JSArray::kLengthOffset)); | |
1653 | |
1654 // Fill with the hole. | |
1655 __ str(r6, FieldMemOperand(elements, FixedArray::kHeaderSize)); | |
1656 const int argc = arguments().immediate(); | |
1657 __ Drop(argc + 1); | |
1658 __ mov(r0, scratch); | |
1659 __ Ret(); | |
1660 | |
1661 __ bind(&return_undefined); | |
1662 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | |
1663 __ Drop(argc + 1); | |
1664 __ Ret(); | |
1665 | |
1666 __ bind(&call_builtin); | |
1667 __ TailCallExternalReference( | |
1668 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); | |
1669 | |
1670 HandlerFrontendFooter(&miss); | |
1671 | |
1672 // Return the generated code. | |
1673 return GetCode(type, name); | |
1674 } | |
1675 | |
1676 | |
1677 Handle<Code> CallStubCompiler::CompileFastApiCall( | 1604 Handle<Code> CallStubCompiler::CompileFastApiCall( |
1678 const CallOptimization& optimization, | 1605 const CallOptimization& optimization, |
1679 Handle<Object> object, | 1606 Handle<Object> object, |
1680 Handle<JSObject> holder, | 1607 Handle<JSObject> holder, |
1681 Handle<Cell> cell, | 1608 Handle<Cell> cell, |
1682 Handle<JSFunction> function, | 1609 Handle<JSFunction> function, |
1683 Handle<String> name) { | 1610 Handle<String> name) { |
1684 Counters* counters = isolate()->counters(); | 1611 Counters* counters = isolate()->counters(); |
1685 | 1612 |
1686 ASSERT(optimization.is_simple_api_call()); | 1613 ASSERT(optimization.is_simple_api_call()); |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2274 // ----------------------------------- | 2201 // ----------------------------------- |
2275 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2202 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2276 } | 2203 } |
2277 | 2204 |
2278 | 2205 |
2279 #undef __ | 2206 #undef __ |
2280 | 2207 |
2281 } } // namespace v8::internal | 2208 } } // namespace v8::internal |
2282 | 2209 |
2283 #endif // V8_TARGET_ARCH_ARM | 2210 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |