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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE)); | 554 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE)); |
555 } | 555 } |
556 | 556 |
557 | 557 |
558 LOperand* LChunkBuilder::UseAtStart(HValue* value) { | 558 LOperand* LChunkBuilder::UseAtStart(HValue* value) { |
559 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE, | 559 return Use(value, new(zone()) LUnallocated(LUnallocated::NONE, |
560 LUnallocated::USED_AT_START)); | 560 LUnallocated::USED_AT_START)); |
561 } | 561 } |
562 | 562 |
563 | 563 |
| 564 static inline bool CanBeImmediateConstant(HValue* value) { |
| 565 return value->IsConstant() && HConstant::cast(value)->NotInNewSpace(); |
| 566 } |
| 567 |
| 568 |
564 LOperand* LChunkBuilder::UseOrConstant(HValue* value) { | 569 LOperand* LChunkBuilder::UseOrConstant(HValue* value) { |
565 return value->IsConstant() | 570 return CanBeImmediateConstant(value) |
566 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | 571 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
567 : Use(value); | 572 : Use(value); |
568 } | 573 } |
569 | 574 |
570 | 575 |
571 LOperand* LChunkBuilder::UseOrConstantAtStart(HValue* value) { | 576 LOperand* LChunkBuilder::UseOrConstantAtStart(HValue* value) { |
572 return value->IsConstant() | 577 return CanBeImmediateConstant(value) |
573 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | 578 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
574 : UseAtStart(value); | 579 : UseAtStart(value); |
575 } | 580 } |
576 | 581 |
577 | 582 |
578 LOperand* LChunkBuilder::UseRegisterOrConstant(HValue* value) { | 583 LOperand* LChunkBuilder::UseRegisterOrConstant(HValue* value) { |
579 return value->IsConstant() | 584 return CanBeImmediateConstant(value) |
580 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | 585 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
581 : UseRegister(value); | 586 : UseRegister(value); |
582 } | 587 } |
583 | 588 |
584 | 589 |
585 LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) { | 590 LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) { |
586 return value->IsConstant() | 591 return CanBeImmediateConstant(value) |
587 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | 592 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
588 : UseRegisterAtStart(value); | 593 : UseRegisterAtStart(value); |
589 } | 594 } |
590 | 595 |
591 | 596 |
592 LOperand* LChunkBuilder::UseConstant(HValue* value) { | 597 LOperand* LChunkBuilder::UseConstant(HValue* value) { |
593 return chunk_->DefineConstantOperand(HConstant::cast(value)); | 598 return chunk_->DefineConstantOperand(HConstant::cast(value)); |
594 } | 599 } |
595 | 600 |
596 | 601 |
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2732 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2728 LOperand* object = UseRegister(instr->object()); | 2733 LOperand* object = UseRegister(instr->object()); |
2729 LOperand* index = UseTempRegister(instr->index()); | 2734 LOperand* index = UseTempRegister(instr->index()); |
2730 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2735 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2731 } | 2736 } |
2732 | 2737 |
2733 | 2738 |
2734 } } // namespace v8::internal | 2739 } } // namespace v8::internal |
2735 | 2740 |
2736 #endif // V8_TARGET_ARCH_IA32 | 2741 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |