OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2162 } else { | 2162 } else { |
2163 return new(zone()) LStoreGlobalCell(value, TempRegister(), NULL); | 2163 return new(zone()) LStoreGlobalCell(value, TempRegister(), NULL); |
2164 } | 2164 } |
2165 } | 2165 } |
2166 | 2166 |
2167 | 2167 |
2168 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2168 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2169 LOperand* temp = NULL; | 2169 LOperand* temp = NULL; |
2170 LOperand* elements = NULL; | 2170 LOperand* elements = NULL; |
2171 LOperand* val = NULL; | 2171 LOperand* val = NULL; |
2172 LOperand* key = NULL; | 2172 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2173 | 2173 |
2174 if (!instr->is_typed_elements() && | 2174 if (!instr->is_typed_elements() && |
2175 instr->value()->representation().IsTagged() && | 2175 instr->value()->representation().IsTagged() && |
2176 instr->NeedsWriteBarrier()) { | 2176 instr->NeedsWriteBarrier()) { |
2177 // RecordWrite() will clobber all registers. | 2177 // RecordWrite() will clobber all registers. |
2178 elements = UseRegisterAndClobber(instr->elements()); | 2178 elements = UseRegisterAndClobber(instr->elements()); |
2179 val = UseRegisterAndClobber(instr->value()); | 2179 val = UseRegisterAndClobber(instr->value()); |
2180 key = UseRegisterAndClobber(instr->key()); | 2180 temp = TempRegister(); |
2181 } else { | 2181 } else { |
2182 elements = UseRegister(instr->elements()); | 2182 elements = UseRegister(instr->elements()); |
2183 val = UseRegister(instr->value()); | 2183 val = UseRegister(instr->value()); |
2184 key = UseRegisterOrConstantAtStart(instr->key()); | 2184 temp = instr->key()->IsConstant() ? NULL : TempRegister(); |
2185 } | 2185 } |
2186 | 2186 |
2187 if (instr->is_typed_elements()) { | 2187 if (instr->is_typed_elements()) { |
2188 ASSERT((instr->value()->representation().IsInteger32() && | 2188 ASSERT((instr->value()->representation().IsInteger32() && |
2189 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || | 2189 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
2190 (instr->value()->representation().IsDouble() && | 2190 (instr->value()->representation().IsDouble() && |
2191 IsDoubleOrFloatElementsKind(instr->elements_kind()))); | 2191 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
2192 ASSERT((instr->is_fixed_typed_array() && | 2192 ASSERT((instr->is_fixed_typed_array() && |
2193 instr->elements()->representation().IsTagged()) || | 2193 instr->elements()->representation().IsTagged()) || |
2194 (instr->is_external() && | 2194 (instr->is_external() && |
2195 instr->elements()->representation().IsExternal())); | 2195 instr->elements()->representation().IsExternal())); |
2196 temp = instr->key()->IsConstant() ? NULL : TempRegister(); | |
2197 return new(zone()) LStoreKeyedExternal(elements, key, val, temp); | 2196 return new(zone()) LStoreKeyedExternal(elements, key, val, temp); |
2198 | 2197 |
2199 } else if (instr->value()->representation().IsDouble()) { | 2198 } else if (instr->value()->representation().IsDouble()) { |
2200 ASSERT(instr->elements()->representation().IsTagged()); | 2199 ASSERT(instr->elements()->representation().IsTagged()); |
2201 | |
2202 // The constraint used here is UseRegister, even though the StoreKeyed | |
2203 // instruction may canonicalize the value in the register if it is a NaN. | |
2204 temp = TempRegister(); | |
2205 return new(zone()) LStoreKeyedFixedDouble(elements, key, val, temp); | 2200 return new(zone()) LStoreKeyedFixedDouble(elements, key, val, temp); |
2206 | 2201 |
2207 } else { | 2202 } else { |
2208 ASSERT(instr->elements()->representation().IsTagged()); | 2203 ASSERT(instr->elements()->representation().IsTagged()); |
2209 ASSERT(instr->value()->representation().IsSmiOrTagged() || | 2204 ASSERT(instr->value()->representation().IsSmiOrTagged() || |
2210 instr->value()->representation().IsInteger32()); | 2205 instr->value()->representation().IsInteger32()); |
2211 | |
2212 temp = TempRegister(); | |
2213 return new(zone()) LStoreKeyedFixed(elements, key, val, temp); | 2206 return new(zone()) LStoreKeyedFixed(elements, key, val, temp); |
2214 } | 2207 } |
2215 } | 2208 } |
2216 | 2209 |
2217 | 2210 |
2218 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2211 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
2219 LOperand* context = UseFixed(instr->context(), cp); | 2212 LOperand* context = UseFixed(instr->context(), cp); |
2220 LOperand* object = UseFixed(instr->object(), x2); | 2213 LOperand* object = UseFixed(instr->object(), x2); |
2221 LOperand* key = UseFixed(instr->key(), x1); | 2214 LOperand* key = UseFixed(instr->key(), x1); |
2222 LOperand* value = UseFixed(instr->value(), x0); | 2215 LOperand* value = UseFixed(instr->value(), x0); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2552 | 2545 |
2553 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2546 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
2554 LOperand* receiver = UseRegister(instr->receiver()); | 2547 LOperand* receiver = UseRegister(instr->receiver()); |
2555 LOperand* function = UseRegister(instr->function()); | 2548 LOperand* function = UseRegister(instr->function()); |
2556 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2549 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
2557 return AssignEnvironment(DefineAsRegister(result)); | 2550 return AssignEnvironment(DefineAsRegister(result)); |
2558 } | 2551 } |
2559 | 2552 |
2560 | 2553 |
2561 } } // namespace v8::internal | 2554 } } // namespace v8::internal |
OLD | NEW |