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

Side by Side Diff: src/x64/lithium-x64.cc

Issue 11365084: Some improvements in register usage in lithium compilation of LoadKeyed/StoreKeyed operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Response to comments, thx! Created 8 years, 1 month 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
« no previous file with comments | « src/x64/lithium-x64.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 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 HLoadExternalArrayPointer* instr) { 1837 HLoadExternalArrayPointer* instr) {
1838 LOperand* input = UseRegisterAtStart(instr->value()); 1838 LOperand* input = UseRegisterAtStart(instr->value());
1839 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); 1839 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input));
1840 } 1840 }
1841 1841
1842 1842
1843 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { 1843 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
1844 ASSERT(instr->key()->representation().IsInteger32() || 1844 ASSERT(instr->key()->representation().IsInteger32() ||
1845 instr->key()->representation().IsTagged()); 1845 instr->key()->representation().IsTagged());
1846 ElementsKind elements_kind = instr->elements_kind(); 1846 ElementsKind elements_kind = instr->elements_kind();
1847 bool clobbers_key = instr->key()->representation().IsTagged(); 1847 bool clobbers_key = ArrayOpClobbersKey<HLoadKeyed>(instr);
1848 LOperand* key = clobbers_key 1848 LOperand* key = clobbers_key
1849 ? UseTempRegister(instr->key()) 1849 ? UseTempRegister(instr->key())
1850 : UseRegisterOrConstantAtStart(instr->key()); 1850 : UseRegisterOrConstantAtStart(instr->key());
1851 LLoadKeyed* result = NULL; 1851 LOperand* elements = UseRegisterAtStart(instr->elements());
1852 LLoadKeyed* result = new(zone()) LLoadKeyed(elements, key);
1852 1853
1853 if (!instr->is_external()) { 1854 #ifdef DEBUG
1854 LOperand* obj = UseRegisterAtStart(instr->elements()); 1855 if (instr->is_external()) {
1855 result = new(zone()) LLoadKeyed(obj, key);
1856 } else {
1857 ASSERT( 1856 ASSERT(
1858 (instr->representation().IsInteger32() && 1857 (instr->representation().IsInteger32() &&
1859 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 1858 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1860 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 1859 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1861 (instr->representation().IsDouble() && 1860 (instr->representation().IsDouble() &&
1862 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 1861 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1863 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 1862 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1864 LOperand* external_pointer = UseRegister(instr->elements());
1865 result = new(zone()) LLoadKeyed(external_pointer, key);
1866 } 1863 }
1864 #endif
1867 1865
1868 DefineAsRegister(result); 1866 DefineAsRegister(result);
1869 bool can_deoptimize = instr->RequiresHoleCheck() || 1867 bool can_deoptimize = instr->RequiresHoleCheck() ||
1870 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); 1868 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS);
1871 // An unsigned int array load might overflow and cause a deopt, make sure it 1869 // An unsigned int array load might overflow and cause a deopt, make sure it
1872 // has an environment. 1870 // has an environment.
1873 return can_deoptimize ? AssignEnvironment(result) : result; 1871 return can_deoptimize ? AssignEnvironment(result) : result;
1874 } 1872 }
1875 1873
1876 1874
1877 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 1875 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1878 LOperand* object = UseFixed(instr->object(), rdx); 1876 LOperand* object = UseFixed(instr->object(), rdx);
1879 LOperand* key = UseFixed(instr->key(), rax); 1877 LOperand* key = UseFixed(instr->key(), rax);
1880 1878
1881 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); 1879 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key);
1882 return MarkAsCall(DefineFixed(result, rax), instr); 1880 return MarkAsCall(DefineFixed(result, rax), instr);
1883 } 1881 }
1884 1882
1885 1883
1886 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { 1884 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
1887 ElementsKind elements_kind = instr->elements_kind();
1888 bool needs_write_barrier = instr->NeedsWriteBarrier(); 1885 bool needs_write_barrier = instr->NeedsWriteBarrier();
1889 bool clobbers_key = instr->key()->representation().IsTagged(); 1886 bool clobbers_key = ArrayOpClobbersKey<HStoreKeyed>(instr);
1890 LOperand* key = (clobbers_key || needs_write_barrier) 1887 LOperand* key = (clobbers_key || needs_write_barrier)
1891 ? UseTempRegister(instr->key()) 1888 ? UseTempRegister(instr->key())
1892 : UseRegisterOrConstantAtStart(instr->key()); 1889 : UseRegisterOrConstantAtStart(instr->key());
1893 bool val_is_temp_register = 1890 LOperand* val = needs_write_barrier
1894 elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
1895 elements_kind == EXTERNAL_FLOAT_ELEMENTS;
1896 LOperand* val = (needs_write_barrier || val_is_temp_register)
1897 ? UseTempRegister(instr->value()) 1891 ? UseTempRegister(instr->value())
1898 : UseRegisterAtStart(instr->value()); 1892 : UseRegisterAtStart(instr->value());
1899 LStoreKeyed* result = NULL; 1893 LOperand* elements = UseRegisterAtStart(instr->elements());
1900 1894
1895 #ifdef DEBUG
1901 if (!instr->is_external()) { 1896 if (!instr->is_external()) {
1902 ASSERT(instr->elements()->representation().IsTagged()); 1897 ASSERT(instr->elements()->representation().IsTagged());
1903
1904 LOperand* object = NULL;
1905 if (instr->value()->representation().IsDouble()) {
1906 object = UseRegisterAtStart(instr->elements());
1907 } else {
1908 ASSERT(instr->value()->representation().IsTagged());
1909 object = UseTempRegister(instr->elements());
1910 }
1911
1912 result = new(zone()) LStoreKeyed(object, key, val);
1913 } else { 1898 } else {
1899 ElementsKind elements_kind = instr->elements_kind();
1914 ASSERT( 1900 ASSERT(
1915 (instr->value()->representation().IsInteger32() && 1901 (instr->value()->representation().IsInteger32() &&
1916 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 1902 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1917 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 1903 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1918 (instr->value()->representation().IsDouble() && 1904 (instr->value()->representation().IsDouble() &&
1919 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 1905 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1920 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 1906 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1921 ASSERT(instr->elements()->representation().IsExternal()); 1907 ASSERT(instr->elements()->representation().IsExternal());
1908 }
1909 #endif
1922 1910
1923 LOperand* external_pointer = UseRegister(instr->elements()); 1911 LStoreKeyed* result = new(zone()) LStoreKeyed(elements, key, val);
1924 result = new(zone()) LStoreKeyed(external_pointer, key, val);
1925 }
1926
1927 ASSERT(result != NULL); 1912 ASSERT(result != NULL);
1928 return result; 1913 return result;
1929 } 1914 }
1930 1915
1931 1916
1932 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 1917 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
1933 LOperand* object = UseFixed(instr->object(), rdx); 1918 LOperand* object = UseFixed(instr->object(), rdx);
1934 LOperand* key = UseFixed(instr->key(), rcx); 1919 LOperand* key = UseFixed(instr->key(), rcx);
1935 LOperand* value = UseFixed(instr->value(), rax); 1920 LOperand* value = UseFixed(instr->value(), rax);
1936 1921
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2244 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2260 LOperand* object = UseRegister(instr->object()); 2245 LOperand* object = UseRegister(instr->object());
2261 LOperand* index = UseTempRegister(instr->index()); 2246 LOperand* index = UseTempRegister(instr->index());
2262 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2247 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2263 } 2248 }
2264 2249
2265 2250
2266 } } // namespace v8::internal 2251 } } // namespace v8::internal
2267 2252
2268 #endif // V8_TARGET_ARCH_X64 2253 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698