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 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2177 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2171 ElementsKind elements_kind = instr->elements_kind(); | 2178 ElementsKind elements_kind = instr->elements_kind(); |
2172 | 2179 |
2173 if (!instr->is_external()) { | 2180 if (!instr->is_external()) { |
2174 ASSERT(instr->elements()->representation().IsTagged()); | 2181 ASSERT(instr->elements()->representation().IsTagged()); |
2175 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2182 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2176 LOperand* object = NULL; | 2183 LOperand* object = NULL; |
2177 LOperand* key = NULL; | 2184 LOperand* key = NULL; |
2178 LOperand* val = NULL; | 2185 LOperand* val = NULL; |
2179 | 2186 |
2180 if (instr->value()->representation().IsDouble()) { | 2187 Representation value_representation = instr->value()->representation(); |
| 2188 if (value_representation.IsDouble()) { |
2181 object = UseRegisterAtStart(instr->elements()); | 2189 object = UseRegisterAtStart(instr->elements()); |
2182 val = UseTempRegister(instr->value()); | 2190 val = UseTempRegister(instr->value()); |
2183 key = UseRegisterOrConstantAtStart(instr->key()); | 2191 key = UseRegisterOrConstantAtStart(instr->key()); |
2184 } else { | 2192 } else { |
2185 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2193 ASSERT(value_representation.IsSmiOrTagged() || |
2186 object = UseTempRegister(instr->elements()); | 2194 value_representation.IsInteger32()); |
2187 if (needs_write_barrier) { | 2195 if (needs_write_barrier) { |
| 2196 object = UseTempRegister(instr->elements()); |
2188 val = UseTempRegister(instr->value()); | 2197 val = UseTempRegister(instr->value()); |
2189 key = UseTempRegister(instr->key()); | 2198 key = UseTempRegister(instr->key()); |
2190 } else { | 2199 } else { |
| 2200 object = UseRegisterAtStart(instr->elements()); |
2191 val = UseRegisterOrConstantAtStart(instr->value()); | 2201 val = UseRegisterOrConstantAtStart(instr->value()); |
2192 key = UseRegisterOrConstantAtStart(instr->key()); | 2202 key = UseRegisterOrConstantAtStart(instr->key()); |
2193 } | 2203 } |
2194 } | 2204 } |
2195 | 2205 |
2196 return new(zone()) LStoreKeyed(object, key, val); | 2206 return new(zone()) LStoreKeyed(object, key, val); |
2197 } | 2207 } |
2198 | 2208 |
2199 ASSERT( | 2209 ASSERT( |
2200 (instr->value()->representation().IsInteger32() && | 2210 (instr->value()->representation().IsInteger32() && |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2599 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2609 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2600 LOperand* object = UseRegister(instr->object()); | 2610 LOperand* object = UseRegister(instr->object()); |
2601 LOperand* index = UseTempRegister(instr->index()); | 2611 LOperand* index = UseTempRegister(instr->index()); |
2602 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2612 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2603 } | 2613 } |
2604 | 2614 |
2605 | 2615 |
2606 } } // namespace v8::internal | 2616 } } // namespace v8::internal |
2607 | 2617 |
2608 #endif // V8_TARGET_ARCH_X64 | 2618 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |