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 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 index.translate(holder), Representation::Tagged()); | 1659 index.translate(holder), Representation::Tagged()); |
1660 GenerateJumpFunction(object, edi, &miss); | 1660 GenerateJumpFunction(object, edi, &miss); |
1661 | 1661 |
1662 HandlerFrontendFooter(&miss); | 1662 HandlerFrontendFooter(&miss); |
1663 | 1663 |
1664 // Return the generated code. | 1664 // Return the generated code. |
1665 return GetCode(Code::FAST, name); | 1665 return GetCode(Code::FAST, name); |
1666 } | 1666 } |
1667 | 1667 |
1668 | 1668 |
1669 Handle<Code> CallStubCompiler::CompileArrayPopCall( | |
1670 Handle<Object> object, | |
1671 Handle<JSObject> holder, | |
1672 Handle<Cell> cell, | |
1673 Handle<JSFunction> function, | |
1674 Handle<String> name, | |
1675 Code::StubType type) { | |
1676 // If object is not an array or is observed or sealed, bail out to regular | |
1677 // call. | |
1678 if (!object->IsJSArray() || | |
1679 !cell.is_null() || | |
1680 Handle<JSArray>::cast(object)->map()->is_observed() || | |
1681 !Handle<JSArray>::cast(object)->map()->is_extensible()) { | |
1682 return Handle<Code>::null(); | |
1683 } | |
1684 | |
1685 Label miss, return_undefined, call_builtin; | |
1686 | |
1687 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
1688 | |
1689 // Get the elements array of the object. | |
1690 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); | |
1691 | |
1692 // Check that the elements are in fast mode and writable. | |
1693 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), | |
1694 Immediate(factory()->fixed_array_map())); | |
1695 __ j(not_equal, &call_builtin); | |
1696 | |
1697 // Get the array's length into ecx and calculate new length. | |
1698 __ mov(ecx, FieldOperand(edx, JSArray::kLengthOffset)); | |
1699 __ sub(ecx, Immediate(Smi::FromInt(1))); | |
1700 __ j(negative, &return_undefined); | |
1701 | |
1702 // Get the last element. | |
1703 STATIC_ASSERT(kSmiTagSize == 1); | |
1704 STATIC_ASSERT(kSmiTag == 0); | |
1705 __ mov(eax, FieldOperand(ebx, | |
1706 ecx, times_half_pointer_size, | |
1707 FixedArray::kHeaderSize)); | |
1708 __ cmp(eax, Immediate(factory()->the_hole_value())); | |
1709 __ j(equal, &call_builtin); | |
1710 | |
1711 // Set the array's length. | |
1712 __ mov(FieldOperand(edx, JSArray::kLengthOffset), ecx); | |
1713 | |
1714 // Fill with the hole. | |
1715 __ mov(FieldOperand(ebx, | |
1716 ecx, times_half_pointer_size, | |
1717 FixedArray::kHeaderSize), | |
1718 Immediate(factory()->the_hole_value())); | |
1719 const int argc = arguments().immediate(); | |
1720 __ ret((argc + 1) * kPointerSize); | |
1721 | |
1722 __ bind(&return_undefined); | |
1723 __ mov(eax, Immediate(factory()->undefined_value())); | |
1724 __ ret((argc + 1) * kPointerSize); | |
1725 | |
1726 __ bind(&call_builtin); | |
1727 __ TailCallExternalReference( | |
1728 ExternalReference(Builtins::c_ArrayPop, isolate()), | |
1729 argc + 1, | |
1730 1); | |
1731 | |
1732 HandlerFrontendFooter(&miss); | |
1733 | |
1734 // Return the generated code. | |
1735 return GetCode(type, name); | |
1736 } | |
1737 | |
1738 | |
1739 Handle<Code> CallStubCompiler::CompileFastApiCall( | 1669 Handle<Code> CallStubCompiler::CompileFastApiCall( |
1740 const CallOptimization& optimization, | 1670 const CallOptimization& optimization, |
1741 Handle<Object> object, | 1671 Handle<Object> object, |
1742 Handle<JSObject> holder, | 1672 Handle<JSObject> holder, |
1743 Handle<Cell> cell, | 1673 Handle<Cell> cell, |
1744 Handle<JSFunction> function, | 1674 Handle<JSFunction> function, |
1745 Handle<String> name) { | 1675 Handle<String> name) { |
1746 ASSERT(optimization.is_simple_api_call()); | 1676 ASSERT(optimization.is_simple_api_call()); |
1747 // Bail out if object is a global object as we don't want to | 1677 // Bail out if object is a global object as we don't want to |
1748 // repatch it to global receiver. | 1678 // repatch it to global receiver. |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2316 // ----------------------------------- | 2246 // ----------------------------------- |
2317 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2247 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2318 } | 2248 } |
2319 | 2249 |
2320 | 2250 |
2321 #undef __ | 2251 #undef __ |
2322 | 2252 |
2323 } } // namespace v8::internal | 2253 } } // namespace v8::internal |
2324 | 2254 |
2325 #endif // V8_TARGET_ARCH_IA32 | 2255 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |