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

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

Issue 21014003: Optionally use 31-bits SMI value for 64-bit system (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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
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 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 if (to.IsTagged()) { 1877 if (to.IsTagged()) {
1878 HValue* val = instr->value(); 1878 HValue* val = instr->value();
1879 LOperand* value = UseRegister(val); 1879 LOperand* value = UseRegister(val);
1880 if (val->CheckFlag(HInstruction::kUint32)) { 1880 if (val->CheckFlag(HInstruction::kUint32)) {
1881 LOperand* temp = FixedTemp(xmm1); 1881 LOperand* temp = FixedTemp(xmm1);
1882 LNumberTagU* result = new(zone()) LNumberTagU(value, temp); 1882 LNumberTagU* result = new(zone()) LNumberTagU(value, temp);
1883 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1883 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1884 } else if (val->HasRange() && val->range()->IsInSmiRange()) { 1884 } else if (val->HasRange() && val->range()->IsInSmiRange()) {
1885 return DefineSameAsFirst(new(zone()) LSmiTag(value)); 1885 return DefineSameAsFirst(new(zone()) LSmiTag(value));
1886 } else { 1886 } else {
1887 #if !V8_USE_31_BITS_SMI_VALUE
1887 LNumberTagI* result = new(zone()) LNumberTagI(value); 1888 LNumberTagI* result = new(zone()) LNumberTagI(value);
1889 #else
1890 LOperand* temp = FixedTemp(xmm1);
1891 LNumberTagI* result = new(zone()) LNumberTagI(value, temp);
1892 #endif
1888 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1893 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1889 } 1894 }
1890 } else if (to.IsSmi()) { 1895 } else if (to.IsSmi()) {
1891 HValue* val = instr->value(); 1896 HValue* val = instr->value();
1892 LOperand* value = UseRegister(val); 1897 LOperand* value = UseRegister(val);
1893 LInstruction* result = 1898 LInstruction* result =
1894 DefineAsRegister(new(zone()) LInteger32ToSmi(value)); 1899 DefineAsRegister(new(zone()) LInteger32ToSmi(value));
1895 if (val->HasRange() && val->range()->IsInSmiRange()) { 1900 if (val->HasRange() && val->range()->IsInSmiRange()) {
1896 return result; 1901 return result;
1897 } 1902 }
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 2116
2112 2117
2113 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( 2118 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer(
2114 HLoadExternalArrayPointer* instr) { 2119 HLoadExternalArrayPointer* instr) {
2115 LOperand* input = UseRegisterAtStart(instr->value()); 2120 LOperand* input = UseRegisterAtStart(instr->value());
2116 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); 2121 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input));
2117 } 2122 }
2118 2123
2119 2124
2120 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { 2125 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2126 #if !V8_USE_31_BITS_SMI_VALUE
2121 ASSERT(instr->key()->representation().IsInteger32()); 2127 ASSERT(instr->key()->representation().IsInteger32());
2128 #else
2129 ASSERT(instr->key()->representation().IsSmiOrInteger32());
2130 #endif
2122 ElementsKind elements_kind = instr->elements_kind(); 2131 ElementsKind elements_kind = instr->elements_kind();
2132 #if !V8_USE_31_BITS_SMI_VALUE
2123 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 2133 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2134 #else
2135 bool clobbers_key = instr->key()->representation().IsSmi();
2136 LOperand* key = clobbers_key
2137 ? UseTempRegister(instr->key())
2138 : UseRegisterOrConstantAtStart(instr->key());
2139 #endif
2124 LLoadKeyed* result = NULL; 2140 LLoadKeyed* result = NULL;
2125 2141
2126 if (!instr->is_external()) { 2142 if (!instr->is_external()) {
2127 LOperand* obj = UseRegisterAtStart(instr->elements()); 2143 LOperand* obj = UseRegisterAtStart(instr->elements());
2128 result = new(zone()) LLoadKeyed(obj, key); 2144 result = new(zone()) LLoadKeyed(obj, key);
2129 } else { 2145 } else {
2130 ASSERT( 2146 ASSERT(
2131 (instr->representation().IsInteger32() && 2147 (instr->representation().IsInteger32() &&
2132 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 2148 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
2133 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 2149 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
(...skipping 17 matching lines...) Expand all
2151 LOperand* object = UseFixed(instr->object(), rdx); 2167 LOperand* object = UseFixed(instr->object(), rdx);
2152 LOperand* key = UseFixed(instr->key(), rax); 2168 LOperand* key = UseFixed(instr->key(), rax);
2153 2169
2154 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); 2170 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key);
2155 return MarkAsCall(DefineFixed(result, rax), instr); 2171 return MarkAsCall(DefineFixed(result, rax), instr);
2156 } 2172 }
2157 2173
2158 2174
2159 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { 2175 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2160 ElementsKind elements_kind = instr->elements_kind(); 2176 ElementsKind elements_kind = instr->elements_kind();
2177 #if V8_USE_31_BITS_SMI_VALUE
2178 bool clobbers_key = instr->key()->representation().IsSmi();
2179 #endif
2161 2180
2162 if (!instr->is_external()) { 2181 if (!instr->is_external()) {
2163 ASSERT(instr->elements()->representation().IsTagged()); 2182 ASSERT(instr->elements()->representation().IsTagged());
2164 bool needs_write_barrier = instr->NeedsWriteBarrier(); 2183 bool needs_write_barrier = instr->NeedsWriteBarrier();
2165 LOperand* object = NULL; 2184 LOperand* object = NULL;
2166 LOperand* key = NULL; 2185 LOperand* key = NULL;
2167 LOperand* val = NULL; 2186 LOperand* val = NULL;
2168 2187
2169 if (instr->value()->representation().IsDouble()) { 2188 if (instr->value()->representation().IsDouble()) {
2170 object = UseRegisterAtStart(instr->elements()); 2189 object = UseRegisterAtStart(instr->elements());
2171 val = UseTempRegister(instr->value()); 2190 val = UseTempRegister(instr->value());
2191 #if !V8_USE_31_BITS_SMI_VALUE
2172 key = UseRegisterOrConstantAtStart(instr->key()); 2192 key = UseRegisterOrConstantAtStart(instr->key());
2193 #else
2194 key = clobbers_key ? UseTempRegister(instr->key())
2195 : UseRegisterOrConstantAtStart(instr->key());
2196 #endif
2173 } else { 2197 } else {
2174 ASSERT(instr->value()->representation().IsSmiOrTagged()); 2198 ASSERT(instr->value()->representation().IsSmiOrTagged());
2175 object = UseTempRegister(instr->elements()); 2199 object = UseTempRegister(instr->elements());
2176 if (needs_write_barrier) { 2200 if (needs_write_barrier) {
2177 val = UseTempRegister(instr->value()); 2201 val = UseTempRegister(instr->value());
2178 key = UseTempRegister(instr->key()); 2202 key = UseTempRegister(instr->key());
2179 } else { 2203 } else {
2180 val = UseRegisterOrConstantAtStart(instr->value()); 2204 val = UseRegisterOrConstantAtStart(instr->value());
2205 #if !V8_USE_31_BITS_SMI_VALUE
2181 key = UseRegisterOrConstantAtStart(instr->key()); 2206 key = UseRegisterOrConstantAtStart(instr->key());
2207 #else
2208 key = clobbers_key ? UseTempRegister(instr->key())
2209 : UseRegisterOrConstantAtStart(instr->key());
2210 #endif
2182 } 2211 }
2183 } 2212 }
2184 2213
2185 return new(zone()) LStoreKeyed(object, key, val); 2214 return new(zone()) LStoreKeyed(object, key, val);
2186 } 2215 }
2187 2216
2188 ASSERT( 2217 ASSERT(
2189 (instr->value()->representation().IsInteger32() && 2218 (instr->value()->representation().IsInteger32() &&
2190 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 2219 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
2191 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 2220 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
2192 (instr->value()->representation().IsDouble() && 2221 (instr->value()->representation().IsDouble() &&
2193 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 2222 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
2194 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 2223 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
2195 ASSERT(instr->elements()->representation().IsExternal()); 2224 ASSERT(instr->elements()->representation().IsExternal());
2196 bool val_is_temp_register = 2225 bool val_is_temp_register =
2197 elements_kind == EXTERNAL_PIXEL_ELEMENTS || 2226 elements_kind == EXTERNAL_PIXEL_ELEMENTS ||
2198 elements_kind == EXTERNAL_FLOAT_ELEMENTS; 2227 elements_kind == EXTERNAL_FLOAT_ELEMENTS;
2199 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) 2228 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value())
2200 : UseRegister(instr->value()); 2229 : UseRegister(instr->value());
2230 #if !V8_USE_31_BITS_SMI_VALUE
2201 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 2231 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2232 #else
2233 LOperand* key = clobbers_key ? UseTempRegister(instr->key())
2234 : UseRegisterOrConstantAtStart(instr->key());
2235 #endif
2202 LOperand* external_pointer = UseRegister(instr->elements()); 2236 LOperand* external_pointer = UseRegister(instr->elements());
2203 return new(zone()) LStoreKeyed(external_pointer, key, val); 2237 return new(zone()) LStoreKeyed(external_pointer, key, val);
2204 } 2238 }
2205 2239
2206 2240
2207 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 2241 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2208 LOperand* object = UseFixed(instr->object(), rdx); 2242 LOperand* object = UseFixed(instr->object(), rdx);
2209 LOperand* key = UseFixed(instr->key(), rcx); 2243 LOperand* key = UseFixed(instr->key(), rcx);
2210 LOperand* value = UseFixed(instr->value(), rax); 2244 LOperand* value = UseFixed(instr->value(), rax);
2211 2245
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2563 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2597 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2564 LOperand* object = UseRegister(instr->object()); 2598 LOperand* object = UseRegister(instr->object());
2565 LOperand* index = UseTempRegister(instr->index()); 2599 LOperand* index = UseTempRegister(instr->index());
2566 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2600 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2567 } 2601 }
2568 2602
2569 2603
2570 } } // namespace v8::internal 2604 } } // namespace v8::internal
2571 2605
2572 #endif // V8_TARGET_ARCH_X64 2606 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698