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

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

Issue 6902112: Avoid using a register for constant external array indices. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: add arch-independent ExternalArrayTypeToShiftSize() function Created 9 years, 7 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
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/lithium.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 HLoadKeyedSpecializedArrayElement* instr) { 1888 HLoadKeyedSpecializedArrayElement* instr) {
1889 ExternalArrayType array_type = instr->array_type(); 1889 ExternalArrayType array_type = instr->array_type();
1890 Representation representation(instr->representation()); 1890 Representation representation(instr->representation());
1891 ASSERT( 1891 ASSERT(
1892 (representation.IsInteger32() && (array_type != kExternalFloatArray && 1892 (representation.IsInteger32() && (array_type != kExternalFloatArray &&
1893 array_type != kExternalDoubleArray)) || 1893 array_type != kExternalDoubleArray)) ||
1894 (representation.IsDouble() && (array_type == kExternalFloatArray || 1894 (representation.IsDouble() && (array_type == kExternalFloatArray ||
1895 array_type == kExternalDoubleArray))); 1895 array_type == kExternalDoubleArray)));
1896 ASSERT(instr->key()->representation().IsInteger32()); 1896 ASSERT(instr->key()->representation().IsInteger32());
1897 LOperand* external_pointer = UseRegister(instr->external_pointer()); 1897 LOperand* external_pointer = UseRegister(instr->external_pointer());
1898 LOperand* key = UseRegister(instr->key()); 1898 LOperand* key = UseRegisterOrConstant(instr->key());
1899 LLoadKeyedSpecializedArrayElement* result = 1899 LLoadKeyedSpecializedArrayElement* result =
1900 new LLoadKeyedSpecializedArrayElement(external_pointer, 1900 new LLoadKeyedSpecializedArrayElement(external_pointer,
1901 key); 1901 key);
1902 LInstruction* load_instr = DefineAsRegister(result); 1902 LInstruction* load_instr = DefineAsRegister(result);
1903 // An unsigned int array load might overflow and cause a deopt, make sure it 1903 // An unsigned int array load might overflow and cause a deopt, make sure it
1904 // has an environment. 1904 // has an environment.
1905 return (array_type == kExternalUnsignedIntArray) 1905 return (array_type == kExternalUnsignedIntArray)
1906 ? AssignEnvironment(load_instr) 1906 ? AssignEnvironment(load_instr)
1907 : load_instr; 1907 : load_instr;
1908 } 1908 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 ExternalArrayType array_type = instr->array_type(); 1943 ExternalArrayType array_type = instr->array_type();
1944 ASSERT( 1944 ASSERT(
1945 (representation.IsInteger32() && (array_type != kExternalFloatArray && 1945 (representation.IsInteger32() && (array_type != kExternalFloatArray &&
1946 array_type != kExternalDoubleArray)) || 1946 array_type != kExternalDoubleArray)) ||
1947 (representation.IsDouble() && (array_type == kExternalFloatArray || 1947 (representation.IsDouble() && (array_type == kExternalFloatArray ||
1948 array_type == kExternalDoubleArray))); 1948 array_type == kExternalDoubleArray)));
1949 ASSERT(instr->external_pointer()->representation().IsExternal()); 1949 ASSERT(instr->external_pointer()->representation().IsExternal());
1950 ASSERT(instr->key()->representation().IsInteger32()); 1950 ASSERT(instr->key()->representation().IsInteger32());
1951 1951
1952 LOperand* external_pointer = UseRegister(instr->external_pointer()); 1952 LOperand* external_pointer = UseRegister(instr->external_pointer());
1953 LOperand* key = UseRegister(instr->key()); 1953 LOperand* key = UseRegisterOrConstant(instr->key());
1954 LOperand* temp = NULL; 1954 LOperand* temp = NULL;
1955 1955
1956 if (array_type == kExternalPixelArray) { 1956 if (array_type == kExternalPixelArray) {
1957 // The generated code for pixel array stores requires that the clamped value 1957 // The generated code for pixel array stores requires that the clamped value
1958 // is in a byte register. eax is an arbitrary choice to satisfy this 1958 // is in a byte register. eax is an arbitrary choice to satisfy this
1959 // requirement. 1959 // requirement.
1960 temp = FixedTemp(eax); 1960 temp = FixedTemp(eax);
1961 } 1961 }
1962 1962
1963 LOperand* val = NULL; 1963 LOperand* val = NULL;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 LOperand* key = UseOrConstantAtStart(instr->key()); 2209 LOperand* key = UseOrConstantAtStart(instr->key());
2210 LOperand* object = UseOrConstantAtStart(instr->object()); 2210 LOperand* object = UseOrConstantAtStart(instr->object());
2211 LIn* result = new LIn(key, object); 2211 LIn* result = new LIn(key, object);
2212 return MarkAsCall(DefineFixed(result, eax), instr); 2212 return MarkAsCall(DefineFixed(result, eax), instr);
2213 } 2213 }
2214 2214
2215 2215
2216 } } // namespace v8::internal 2216 } } // namespace v8::internal
2217 2217
2218 #endif // V8_TARGET_ARCH_IA32 2218 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/lithium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698