| 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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 index.translate(holder), Representation::Tagged()); | 1578 index.translate(holder), Representation::Tagged()); |
| 1579 GenerateJumpFunction(object, a1, &miss); | 1579 GenerateJumpFunction(object, a1, &miss); |
| 1580 | 1580 |
| 1581 HandlerFrontendFooter(&miss); | 1581 HandlerFrontendFooter(&miss); |
| 1582 | 1582 |
| 1583 // Return the generated code. | 1583 // Return the generated code. |
| 1584 return GetCode(Code::FAST, name); | 1584 return GetCode(Code::FAST, name); |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 | 1587 |
| 1588 Handle<Code> CallStubCompiler::CompileArrayPopCall( | |
| 1589 Handle<Object> object, | |
| 1590 Handle<JSObject> holder, | |
| 1591 Handle<Cell> cell, | |
| 1592 Handle<JSFunction> function, | |
| 1593 Handle<String> name, | |
| 1594 Code::StubType type) { | |
| 1595 // If object is not an array or is observed or sealed, bail out to regular | |
| 1596 // call. | |
| 1597 if (!object->IsJSArray() || | |
| 1598 !cell.is_null() || | |
| 1599 Handle<JSArray>::cast(object)->map()->is_observed() || | |
| 1600 !Handle<JSArray>::cast(object)->map()->is_extensible()) { | |
| 1601 return Handle<Code>::null(); | |
| 1602 } | |
| 1603 | |
| 1604 Label miss, return_undefined, call_builtin; | |
| 1605 Register receiver = a0; | |
| 1606 Register scratch = a1; | |
| 1607 Register elements = a3; | |
| 1608 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
| 1609 | |
| 1610 // Get the elements array of the object. | |
| 1611 __ lw(elements, FieldMemOperand(receiver, JSArray::kElementsOffset)); | |
| 1612 | |
| 1613 // Check that the elements are in fast mode and writable. | |
| 1614 __ CheckMap(elements, | |
| 1615 scratch, | |
| 1616 Heap::kFixedArrayMapRootIndex, | |
| 1617 &call_builtin, | |
| 1618 DONT_DO_SMI_CHECK); | |
| 1619 | |
| 1620 // Get the array's length into t0 and calculate new length. | |
| 1621 __ lw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | |
| 1622 __ Subu(t0, t0, Operand(Smi::FromInt(1))); | |
| 1623 __ Branch(&return_undefined, lt, t0, Operand(zero_reg)); | |
| 1624 | |
| 1625 // Get the last element. | |
| 1626 __ LoadRoot(t2, Heap::kTheHoleValueRootIndex); | |
| 1627 STATIC_ASSERT(kSmiTagSize == 1); | |
| 1628 STATIC_ASSERT(kSmiTag == 0); | |
| 1629 // We can't address the last element in one operation. Compute the more | |
| 1630 // expensive shift first, and use an offset later on. | |
| 1631 __ sll(t1, t0, kPointerSizeLog2 - kSmiTagSize); | |
| 1632 __ Addu(elements, elements, t1); | |
| 1633 __ lw(scratch, FieldMemOperand(elements, FixedArray::kHeaderSize)); | |
| 1634 __ Branch(&call_builtin, eq, scratch, Operand(t2)); | |
| 1635 | |
| 1636 // Set the array's length. | |
| 1637 __ sw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | |
| 1638 | |
| 1639 // Fill with the hole. | |
| 1640 __ sw(t2, FieldMemOperand(elements, FixedArray::kHeaderSize)); | |
| 1641 const int argc = arguments().immediate(); | |
| 1642 __ mov(v0, scratch); | |
| 1643 __ DropAndRet(argc + 1); | |
| 1644 | |
| 1645 __ bind(&return_undefined); | |
| 1646 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | |
| 1647 __ DropAndRet(argc + 1); | |
| 1648 | |
| 1649 __ bind(&call_builtin); | |
| 1650 __ TailCallExternalReference( | |
| 1651 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); | |
| 1652 | |
| 1653 HandlerFrontendFooter(&miss); | |
| 1654 | |
| 1655 // Return the generated code. | |
| 1656 return GetCode(type, name); | |
| 1657 } | |
| 1658 | |
| 1659 | |
| 1660 Handle<Code> CallStubCompiler::CompileFastApiCall( | 1588 Handle<Code> CallStubCompiler::CompileFastApiCall( |
| 1661 const CallOptimization& optimization, | 1589 const CallOptimization& optimization, |
| 1662 Handle<Object> object, | 1590 Handle<Object> object, |
| 1663 Handle<JSObject> holder, | 1591 Handle<JSObject> holder, |
| 1664 Handle<Cell> cell, | 1592 Handle<Cell> cell, |
| 1665 Handle<JSFunction> function, | 1593 Handle<JSFunction> function, |
| 1666 Handle<String> name) { | 1594 Handle<String> name) { |
| 1667 | 1595 |
| 1668 Counters* counters = isolate()->counters(); | 1596 Counters* counters = isolate()->counters(); |
| 1669 | 1597 |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2255 // ----------------------------------- | 2183 // ----------------------------------- |
| 2256 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2184 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 2257 } | 2185 } |
| 2258 | 2186 |
| 2259 | 2187 |
| 2260 #undef __ | 2188 #undef __ |
| 2261 | 2189 |
| 2262 } } // namespace v8::internal | 2190 } } // namespace v8::internal |
| 2263 | 2191 |
| 2264 #endif // V8_TARGET_ARCH_MIPS | 2192 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |