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 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 index.translate(holder), Representation::Tagged()); | 1564 index.translate(holder), Representation::Tagged()); |
1565 GenerateJumpFunction(object, r1, &miss); | 1565 GenerateJumpFunction(object, r1, &miss); |
1566 | 1566 |
1567 HandlerFrontendFooter(&miss); | 1567 HandlerFrontendFooter(&miss); |
1568 | 1568 |
1569 // Return the generated code. | 1569 // Return the generated code. |
1570 return GetCode(Code::FAST, name); | 1570 return GetCode(Code::FAST, name); |
1571 } | 1571 } |
1572 | 1572 |
1573 | 1573 |
1574 Handle<Code> CallStubCompiler::CompileArrayPopCall( | |
1575 Handle<Object> object, | |
1576 Handle<JSObject> holder, | |
1577 Handle<Cell> cell, | |
1578 Handle<JSFunction> function, | |
1579 Handle<String> name, | |
1580 Code::StubType type) { | |
1581 // If object is not an array or is observed or sealed, bail out to regular | |
1582 // call. | |
1583 if (!object->IsJSArray() || | |
1584 !cell.is_null() || | |
1585 Handle<JSArray>::cast(object)->map()->is_observed() || | |
1586 !Handle<JSArray>::cast(object)->map()->is_extensible()) { | |
1587 return Handle<Code>::null(); | |
1588 } | |
1589 | |
1590 Label miss, return_undefined, call_builtin; | |
1591 Register receiver = r0; | |
1592 Register scratch = r1; | |
1593 Register elements = r3; | |
1594 | |
1595 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
1596 | |
1597 // Get the elements array of the object. | |
1598 __ ldr(elements, FieldMemOperand(receiver, JSArray::kElementsOffset)); | |
1599 | |
1600 // Check that the elements are in fast mode and writable. | |
1601 __ CheckMap(elements, | |
1602 scratch, | |
1603 Heap::kFixedArrayMapRootIndex, | |
1604 &call_builtin, | |
1605 DONT_DO_SMI_CHECK); | |
1606 | |
1607 // Get the array's length into r4 and calculate new length. | |
1608 __ ldr(r4, FieldMemOperand(receiver, JSArray::kLengthOffset)); | |
1609 __ sub(r4, r4, Operand(Smi::FromInt(1)), SetCC); | |
1610 __ b(lt, &return_undefined); | |
1611 | |
1612 // Get the last element. | |
1613 __ LoadRoot(r6, Heap::kTheHoleValueRootIndex); | |
1614 // We can't address the last element in one operation. Compute the more | |
1615 // expensive shift first, and use an offset later on. | |
1616 __ add(elements, elements, Operand::PointerOffsetFromSmiKey(r4)); | |
1617 __ ldr(scratch, FieldMemOperand(elements, FixedArray::kHeaderSize)); | |
1618 __ cmp(scratch, r6); | |
1619 __ b(eq, &call_builtin); | |
1620 | |
1621 // Set the array's length. | |
1622 __ str(r4, FieldMemOperand(receiver, JSArray::kLengthOffset)); | |
1623 | |
1624 // Fill with the hole. | |
1625 __ str(r6, FieldMemOperand(elements, FixedArray::kHeaderSize)); | |
1626 const int argc = arguments().immediate(); | |
1627 __ Drop(argc + 1); | |
1628 __ mov(r0, scratch); | |
1629 __ Ret(); | |
1630 | |
1631 __ bind(&return_undefined); | |
1632 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | |
1633 __ Drop(argc + 1); | |
1634 __ Ret(); | |
1635 | |
1636 __ bind(&call_builtin); | |
1637 __ TailCallExternalReference( | |
1638 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); | |
1639 | |
1640 HandlerFrontendFooter(&miss); | |
1641 | |
1642 // Return the generated code. | |
1643 return GetCode(type, name); | |
1644 } | |
1645 | |
1646 | |
1647 Handle<Code> CallStubCompiler::CompileFastApiCall( | 1574 Handle<Code> CallStubCompiler::CompileFastApiCall( |
1648 const CallOptimization& optimization, | 1575 const CallOptimization& optimization, |
1649 Handle<Object> object, | 1576 Handle<Object> object, |
1650 Handle<JSObject> holder, | 1577 Handle<JSObject> holder, |
1651 Handle<Cell> cell, | 1578 Handle<Cell> cell, |
1652 Handle<JSFunction> function, | 1579 Handle<JSFunction> function, |
1653 Handle<String> name) { | 1580 Handle<String> name) { |
1654 Counters* counters = isolate()->counters(); | 1581 Counters* counters = isolate()->counters(); |
1655 | 1582 |
1656 ASSERT(optimization.is_simple_api_call()); | 1583 ASSERT(optimization.is_simple_api_call()); |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2244 // ----------------------------------- | 2171 // ----------------------------------- |
2245 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2172 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2246 } | 2173 } |
2247 | 2174 |
2248 | 2175 |
2249 #undef __ | 2176 #undef __ |
2250 | 2177 |
2251 } } // namespace v8::internal | 2178 } } // namespace v8::internal |
2252 | 2179 |
2253 #endif // V8_TARGET_ARCH_ARM | 2180 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |