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 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 | 2111 |
2112 | 2112 |
2113 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( | 2113 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( |
2114 HLoadExternalArrayPointer* instr) { | 2114 HLoadExternalArrayPointer* instr) { |
2115 LOperand* input = UseRegisterAtStart(instr->value()); | 2115 LOperand* input = UseRegisterAtStart(instr->value()); |
2116 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 2116 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
2117 } | 2117 } |
2118 | 2118 |
2119 | 2119 |
2120 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2120 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
2121 ASSERT(instr->key()->representation().IsInteger32() || | 2121 ASSERT(instr->key()->representation().IsInteger32()); |
2122 instr->key()->representation().IsSmi()); | |
2123 ElementsKind elements_kind = instr->elements_kind(); | 2122 ElementsKind elements_kind = instr->elements_kind(); |
2124 bool clobbers_key = instr->key()->representation().IsSmi(); | 2123 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2125 LOperand* key = clobbers_key | |
2126 ? UseTempRegister(instr->key()) | |
2127 : UseRegisterOrConstantAtStart(instr->key()); | |
2128 LLoadKeyed* result = NULL; | 2124 LLoadKeyed* result = NULL; |
2129 | 2125 |
2130 if (!instr->is_external()) { | 2126 if (!instr->is_external()) { |
2131 LOperand* obj = UseRegisterAtStart(instr->elements()); | 2127 LOperand* obj = UseRegisterAtStart(instr->elements()); |
2132 result = new(zone()) LLoadKeyed(obj, key); | 2128 result = new(zone()) LLoadKeyed(obj, key); |
2133 } else { | 2129 } else { |
2134 ASSERT( | 2130 ASSERT( |
2135 (instr->representation().IsInteger32() && | 2131 (instr->representation().IsInteger32() && |
2136 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2132 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
2137 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 2133 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
(...skipping 17 matching lines...) Expand all Loading... |
2155 LOperand* object = UseFixed(instr->object(), rdx); | 2151 LOperand* object = UseFixed(instr->object(), rdx); |
2156 LOperand* key = UseFixed(instr->key(), rax); | 2152 LOperand* key = UseFixed(instr->key(), rax); |
2157 | 2153 |
2158 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); | 2154 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); |
2159 return MarkAsCall(DefineFixed(result, rax), instr); | 2155 return MarkAsCall(DefineFixed(result, rax), instr); |
2160 } | 2156 } |
2161 | 2157 |
2162 | 2158 |
2163 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2159 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2164 ElementsKind elements_kind = instr->elements_kind(); | 2160 ElementsKind elements_kind = instr->elements_kind(); |
2165 bool clobbers_key = instr->key()->representation().IsSmi(); | |
2166 | 2161 |
2167 if (!instr->is_external()) { | 2162 if (!instr->is_external()) { |
2168 ASSERT(instr->elements()->representation().IsTagged()); | 2163 ASSERT(instr->elements()->representation().IsTagged()); |
2169 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2164 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2170 LOperand* object = NULL; | 2165 LOperand* object = NULL; |
2171 LOperand* key = NULL; | 2166 LOperand* key = NULL; |
2172 LOperand* val = NULL; | 2167 LOperand* val = NULL; |
2173 | 2168 |
2174 if (instr->value()->representation().IsDouble()) { | 2169 if (instr->value()->representation().IsDouble()) { |
2175 object = UseRegisterAtStart(instr->elements()); | 2170 object = UseRegisterAtStart(instr->elements()); |
2176 val = UseTempRegister(instr->value()); | 2171 val = UseTempRegister(instr->value()); |
2177 key = clobbers_key ? UseTempRegister(instr->key()) | 2172 key = UseRegisterOrConstantAtStart(instr->key()); |
2178 : UseRegisterOrConstantAtStart(instr->key()); | |
2179 } else { | 2173 } else { |
2180 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2174 ASSERT(instr->value()->representation().IsSmiOrTagged()); |
2181 object = UseTempRegister(instr->elements()); | 2175 object = UseTempRegister(instr->elements()); |
2182 if (needs_write_barrier) { | 2176 if (needs_write_barrier) { |
2183 val = UseTempRegister(instr->value()); | 2177 val = UseTempRegister(instr->value()); |
2184 key = UseTempRegister(instr->key()); | 2178 key = UseTempRegister(instr->key()); |
2185 } else { | 2179 } else { |
2186 val = UseRegisterOrConstantAtStart(instr->value()); | 2180 val = UseRegisterOrConstantAtStart(instr->value()); |
2187 | 2181 key = UseRegisterOrConstantAtStart(instr->key()); |
2188 if (clobbers_key) { | |
2189 key = UseTempRegister(instr->key()); | |
2190 } else { | |
2191 key = UseRegisterOrConstantAtStart(instr->key()); | |
2192 } | |
2193 } | 2182 } |
2194 } | 2183 } |
2195 | 2184 |
2196 return new(zone()) LStoreKeyed(object, key, val); | 2185 return new(zone()) LStoreKeyed(object, key, val); |
2197 } | 2186 } |
2198 | 2187 |
2199 ASSERT( | 2188 ASSERT( |
2200 (instr->value()->representation().IsInteger32() && | 2189 (instr->value()->representation().IsInteger32() && |
2201 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2190 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
2202 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 2191 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
2203 (instr->value()->representation().IsDouble() && | 2192 (instr->value()->representation().IsDouble() && |
2204 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 2193 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
2205 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 2194 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
2206 ASSERT(instr->elements()->representation().IsExternal()); | 2195 ASSERT(instr->elements()->representation().IsExternal()); |
2207 bool val_is_temp_register = | 2196 bool val_is_temp_register = |
2208 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | 2197 elements_kind == EXTERNAL_PIXEL_ELEMENTS || |
2209 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | 2198 elements_kind == EXTERNAL_FLOAT_ELEMENTS; |
2210 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) | 2199 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) |
2211 : UseRegister(instr->value()); | 2200 : UseRegister(instr->value()); |
2212 LOperand* key = clobbers_key ? UseTempRegister(instr->key()) | 2201 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2213 : UseRegisterOrConstantAtStart(instr->key()); | |
2214 LOperand* external_pointer = UseRegister(instr->elements()); | 2202 LOperand* external_pointer = UseRegister(instr->elements()); |
2215 return new(zone()) LStoreKeyed(external_pointer, key, val); | 2203 return new(zone()) LStoreKeyed(external_pointer, key, val); |
2216 } | 2204 } |
2217 | 2205 |
2218 | 2206 |
2219 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2207 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
2220 LOperand* object = UseFixed(instr->object(), rdx); | 2208 LOperand* object = UseFixed(instr->object(), rdx); |
2221 LOperand* key = UseFixed(instr->key(), rcx); | 2209 LOperand* key = UseFixed(instr->key(), rcx); |
2222 LOperand* value = UseFixed(instr->value(), rax); | 2210 LOperand* value = UseFixed(instr->value(), rax); |
2223 | 2211 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2563 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2576 LOperand* object = UseRegister(instr->object()); | 2564 LOperand* object = UseRegister(instr->object()); |
2577 LOperand* index = UseTempRegister(instr->index()); | 2565 LOperand* index = UseTempRegister(instr->index()); |
2578 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2566 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2579 } | 2567 } |
2580 | 2568 |
2581 | 2569 |
2582 } } // namespace v8::internal | 2570 } } // namespace v8::internal |
2583 | 2571 |
2584 #endif // V8_TARGET_ARCH_X64 | 2572 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |