Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 137783023: Add hydrogen support for ArrayPop, and remove the handwritten call stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/hydrogen.cc ('K') | « src/stub-cache.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 1); 1827 1);
1828 } 1828 }
1829 1829
1830 HandlerFrontendFooter(&miss); 1830 HandlerFrontendFooter(&miss);
1831 1831
1832 // Return the generated code. 1832 // Return the generated code.
1833 return GetCode(type, name); 1833 return GetCode(type, name);
1834 } 1834 }
1835 1835
1836 1836
1837 Handle<Code> CallStubCompiler::CompileArrayPopCall(
1838 Handle<Object> object,
1839 Handle<JSObject> holder,
1840 Handle<Cell> cell,
1841 Handle<JSFunction> function,
1842 Handle<String> name,
1843 Code::StubType type) {
1844 // If object is not an array or is observed or sealed, bail out to regular
1845 // call.
1846 if (!object->IsJSArray() ||
1847 !cell.is_null() ||
1848 Handle<JSArray>::cast(object)->map()->is_observed() ||
1849 !Handle<JSArray>::cast(object)->map()->is_extensible()) {
1850 return Handle<Code>::null();
1851 }
1852
1853 Label miss, return_undefined, call_builtin;
1854
1855 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
1856
1857 // Get the elements array of the object.
1858 __ movq(rbx, FieldOperand(rdx, JSArray::kElementsOffset));
1859
1860 // Check that the elements are in fast mode and writable.
1861 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset),
1862 Heap::kFixedArrayMapRootIndex);
1863 __ j(not_equal, &call_builtin);
1864
1865 // Get the array's length into rcx and calculate new length.
1866 __ SmiToInteger32(rcx, FieldOperand(rdx, JSArray::kLengthOffset));
1867 __ subl(rcx, Immediate(1));
1868 __ j(negative, &return_undefined);
1869
1870 // Get the last element.
1871 __ LoadRoot(r9, Heap::kTheHoleValueRootIndex);
1872 __ movq(rax, FieldOperand(rbx,
1873 rcx, times_pointer_size,
1874 FixedArray::kHeaderSize));
1875 // Check if element is already the hole.
1876 __ cmpq(rax, r9);
1877 // If so, call slow-case to also check prototypes for value.
1878 __ j(equal, &call_builtin);
1879
1880 // Set the array's length.
1881 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rcx);
1882
1883 // Fill with the hole and return original value.
1884 __ movq(FieldOperand(rbx,
1885 rcx, times_pointer_size,
1886 FixedArray::kHeaderSize),
1887 r9);
1888 const int argc = arguments().immediate();
1889 __ ret((argc + 1) * kPointerSize);
1890
1891 __ bind(&return_undefined);
1892 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
1893 __ ret((argc + 1) * kPointerSize);
1894
1895 __ bind(&call_builtin);
1896 __ TailCallExternalReference(
1897 ExternalReference(Builtins::c_ArrayPop, isolate()),
1898 argc + 1,
1899 1);
1900
1901 HandlerFrontendFooter(&miss);
1902
1903 // Return the generated code.
1904 return GetCode(type, name);
1905 }
1906
1907
1908 Handle<Code> CallStubCompiler::CompileFastApiCall( 1837 Handle<Code> CallStubCompiler::CompileFastApiCall(
1909 const CallOptimization& optimization, 1838 const CallOptimization& optimization,
1910 Handle<Object> object, 1839 Handle<Object> object,
1911 Handle<JSObject> holder, 1840 Handle<JSObject> holder,
1912 Handle<Cell> cell, 1841 Handle<Cell> cell,
1913 Handle<JSFunction> function, 1842 Handle<JSFunction> function,
1914 Handle<String> name) { 1843 Handle<String> name) {
1915 ASSERT(optimization.is_simple_api_call()); 1844 ASSERT(optimization.is_simple_api_call());
1916 // Bail out if object is a global object as we don't want to 1845 // Bail out if object is a global object as we don't want to
1917 // repatch it to global receiver. 1846 // repatch it to global receiver.
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 // ----------------------------------- 2433 // -----------------------------------
2505 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 2434 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
2506 } 2435 }
2507 2436
2508 2437
2509 #undef __ 2438 #undef __
2510 2439
2511 } } // namespace v8::internal 2440 } } // namespace v8::internal
2512 2441
2513 #endif // V8_TARGET_ARCH_X64 2442 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/hydrogen.cc ('K') | « src/stub-cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698