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 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 index.translate(holder), Representation::Tagged()); | 1609 index.translate(holder), Representation::Tagged()); |
1610 GenerateJumpFunction(object, edi, &miss); | 1610 GenerateJumpFunction(object, edi, &miss); |
1611 | 1611 |
1612 HandlerFrontendFooter(&miss); | 1612 HandlerFrontendFooter(&miss); |
1613 | 1613 |
1614 // Return the generated code. | 1614 // Return the generated code. |
1615 return GetCode(Code::FAST, name); | 1615 return GetCode(Code::FAST, name); |
1616 } | 1616 } |
1617 | 1617 |
1618 | 1618 |
1619 Handle<Code> CallStubCompiler::CompileArrayPopCall( | |
1620 Handle<Object> object, | |
1621 Handle<JSObject> holder, | |
1622 Handle<Cell> cell, | |
1623 Handle<JSFunction> function, | |
1624 Handle<String> name, | |
1625 Code::StubType type) { | |
1626 // If object is not an array or is observed or sealed, bail out to regular | |
1627 // call. | |
1628 if (!object->IsJSArray() || | |
1629 !cell.is_null() || | |
1630 Handle<JSArray>::cast(object)->map()->is_observed() || | |
1631 !Handle<JSArray>::cast(object)->map()->is_extensible()) { | |
1632 return Handle<Code>::null(); | |
1633 } | |
1634 | |
1635 Label miss, return_undefined, call_builtin; | |
1636 | |
1637 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
1638 | |
1639 // Get the elements array of the object. | |
1640 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); | |
1641 | |
1642 // Check that the elements are in fast mode and writable. | |
1643 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), | |
1644 Immediate(factory()->fixed_array_map())); | |
1645 __ j(not_equal, &call_builtin); | |
1646 | |
1647 // Get the array's length into ecx and calculate new length. | |
1648 __ mov(ecx, FieldOperand(edx, JSArray::kLengthOffset)); | |
1649 __ sub(ecx, Immediate(Smi::FromInt(1))); | |
1650 __ j(negative, &return_undefined); | |
1651 | |
1652 // Get the last element. | |
1653 STATIC_ASSERT(kSmiTagSize == 1); | |
1654 STATIC_ASSERT(kSmiTag == 0); | |
1655 __ mov(eax, FieldOperand(ebx, | |
1656 ecx, times_half_pointer_size, | |
1657 FixedArray::kHeaderSize)); | |
1658 __ cmp(eax, Immediate(factory()->the_hole_value())); | |
1659 __ j(equal, &call_builtin); | |
1660 | |
1661 // Set the array's length. | |
1662 __ mov(FieldOperand(edx, JSArray::kLengthOffset), ecx); | |
1663 | |
1664 // Fill with the hole. | |
1665 __ mov(FieldOperand(ebx, | |
1666 ecx, times_half_pointer_size, | |
1667 FixedArray::kHeaderSize), | |
1668 Immediate(factory()->the_hole_value())); | |
1669 const int argc = arguments().immediate(); | |
1670 __ ret((argc + 1) * kPointerSize); | |
1671 | |
1672 __ bind(&return_undefined); | |
1673 __ mov(eax, Immediate(factory()->undefined_value())); | |
1674 __ ret((argc + 1) * kPointerSize); | |
1675 | |
1676 __ bind(&call_builtin); | |
1677 __ TailCallExternalReference( | |
1678 ExternalReference(Builtins::c_ArrayPop, isolate()), | |
1679 argc + 1, | |
1680 1); | |
1681 | |
1682 HandlerFrontendFooter(&miss); | |
1683 | |
1684 // Return the generated code. | |
1685 return GetCode(type, name); | |
1686 } | |
1687 | |
1688 | |
1689 Handle<Code> CallStubCompiler::CompileFastApiCall( | 1619 Handle<Code> CallStubCompiler::CompileFastApiCall( |
1690 const CallOptimization& optimization, | 1620 const CallOptimization& optimization, |
1691 Handle<Object> object, | 1621 Handle<Object> object, |
1692 Handle<JSObject> holder, | 1622 Handle<JSObject> holder, |
1693 Handle<Cell> cell, | 1623 Handle<Cell> cell, |
1694 Handle<JSFunction> function, | 1624 Handle<JSFunction> function, |
1695 Handle<String> name) { | 1625 Handle<String> name) { |
1696 ASSERT(optimization.is_simple_api_call()); | 1626 ASSERT(optimization.is_simple_api_call()); |
1697 // Bail out if object is a global object as we don't want to | 1627 // Bail out if object is a global object as we don't want to |
1698 // repatch it to global receiver. | 1628 // repatch it to global receiver. |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 // ----------------------------------- | 2186 // ----------------------------------- |
2257 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2187 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2258 } | 2188 } |
2259 | 2189 |
2260 | 2190 |
2261 #undef __ | 2191 #undef __ |
2262 | 2192 |
2263 } } // namespace v8::internal | 2193 } } // namespace v8::internal |
2264 | 2194 |
2265 #endif // V8_TARGET_ARCH_IA32 | 2195 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |