Chromium Code Reviews| 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER, | 501 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER, |
| 502 LUnallocated::USED_AT_START)); | 502 LUnallocated::USED_AT_START)); |
| 503 } | 503 } |
| 504 | 504 |
| 505 | 505 |
| 506 LOperand* LChunkBuilder::UseTempRegister(HValue* value) { | 506 LOperand* LChunkBuilder::UseTempRegister(HValue* value) { |
| 507 return Use(value, new(zone()) LUnallocated(LUnallocated::WRITABLE_REGISTER)); | 507 return Use(value, new(zone()) LUnallocated(LUnallocated::WRITABLE_REGISTER)); |
| 508 } | 508 } |
| 509 | 509 |
| 510 | 510 |
| 511 LOperand* LChunkBuilder::UseTempRegisterOrConstant(HValue* value) { | |
| 512 return value->IsConstant() | |
| 513 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | |
| 514 : UseTempRegister(value); | |
| 515 } | |
| 516 | |
| 517 | |
| 511 LOperand* LChunkBuilder::Use(HValue* value) { | 518 LOperand* LChunkBuilder::Use(HValue* value) { |
| 512 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE)); | 519 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE)); |
| 513 } | 520 } |
| 514 | 521 |
| 515 | 522 |
| 516 LOperand* LChunkBuilder::UseAtStart(HValue* value) { | 523 LOperand* LChunkBuilder::UseAtStart(HValue* value) { |
| 517 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE, | 524 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE, |
| 518 LUnallocated::USED_AT_START)); | 525 LUnallocated::USED_AT_START)); |
| 519 } | 526 } |
| 520 | 527 |
| (...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2171 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2178 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2172 ElementsKind elements_kind = instr->elements_kind(); | 2179 ElementsKind elements_kind = instr->elements_kind(); |
| 2173 | 2180 |
| 2174 if (!instr->is_external()) { | 2181 if (!instr->is_external()) { |
| 2175 ASSERT(instr->elements()->representation().IsTagged()); | 2182 ASSERT(instr->elements()->representation().IsTagged()); |
| 2176 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2183 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2177 LOperand* object = NULL; | 2184 LOperand* object = NULL; |
| 2178 LOperand* key = NULL; | 2185 LOperand* key = NULL; |
| 2179 LOperand* val = NULL; | 2186 LOperand* val = NULL; |
| 2180 | 2187 |
| 2181 if (instr->value()->representation().IsDouble()) { | 2188 Representation value_representation = instr->value()->representation(); |
| 2189 if (value_representation.IsDouble()) { | |
| 2182 object = UseRegisterAtStart(instr->elements()); | 2190 object = UseRegisterAtStart(instr->elements()); |
| 2183 val = UseTempRegister(instr->value()); | 2191 val = UseTempRegister(instr->value()); |
| 2184 key = UseRegisterOrConstantAtStart(instr->key()); | 2192 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2185 } else { | 2193 } else { |
| 2186 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2194 ASSERT(value_representation.IsSmiOrTagged() || |
| 2187 object = UseTempRegister(instr->elements()); | 2195 value_representation.IsInteger32()); |
| 2188 if (needs_write_barrier) { | 2196 if (needs_write_barrier) { |
| 2197 object = UseTempRegister(instr->elements()); | |
| 2189 val = UseTempRegister(instr->value()); | 2198 val = UseTempRegister(instr->value()); |
| 2190 key = UseTempRegister(instr->key()); | 2199 key = UseTempRegister(instr->key()); |
| 2191 } else { | 2200 } else { |
| 2192 val = UseRegisterOrConstantAtStart(instr->value()); | 2201 object = UseRegisterAtStart(instr->elements()); |
|
Toon Verwaest
2013/12/17 13:53:04
None of the variables here should probably be "AtS
Igor Sheludko
2013/12/18 10:01:33
We discussed the "AtStart" issue and decided that
| |
| 2202 if (value_representation.IsInteger32() && | |
| 2203 !instr->store_to_initialized_element()) { | |
| 2204 // In this case we will need a writable register to convert | |
| 2205 // int32 to smi if the value is in register. | |
| 2206 val = UseTempRegisterOrConstant(instr->value()); | |
| 2207 } else { | |
| 2208 val = UseRegisterOrConstantAtStart(instr->value()); | |
| 2209 } | |
| 2193 key = UseRegisterOrConstantAtStart(instr->key()); | 2210 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2194 } | 2211 } |
| 2195 } | 2212 } |
| 2196 | 2213 |
| 2197 return new(zone()) LStoreKeyed(object, key, val); | 2214 return new(zone()) LStoreKeyed(object, key, val); |
| 2198 } | 2215 } |
| 2199 | 2216 |
| 2200 ASSERT( | 2217 ASSERT( |
| 2201 (instr->value()->representation().IsInteger32() && | 2218 (instr->value()->representation().IsInteger32() && |
| 2202 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2219 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2600 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2617 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2601 LOperand* object = UseRegister(instr->object()); | 2618 LOperand* object = UseRegister(instr->object()); |
| 2602 LOperand* index = UseTempRegister(instr->index()); | 2619 LOperand* index = UseTempRegister(instr->index()); |
| 2603 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2620 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2604 } | 2621 } |
| 2605 | 2622 |
| 2606 | 2623 |
| 2607 } } // namespace v8::internal | 2624 } } // namespace v8::internal |
| 2608 | 2625 |
| 2609 #endif // V8_TARGET_ARCH_X64 | 2626 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |