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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
573 } | 573 } |
574 | 574 |
575 | 575 |
576 LOperand* LChunkBuilder::UseOrConstantAtStart(HValue* value) { | 576 LOperand* LChunkBuilder::UseOrConstantAtStart(HValue* value) { |
577 return CanBeImmediateConstant(value) | 577 return CanBeImmediateConstant(value) |
578 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | 578 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
579 : UseAtStart(value); | 579 : UseAtStart(value); |
580 } | 580 } |
581 | 581 |
582 | 582 |
583 LOperand* LChunkBuilder::UseFixedOrConstant(HValue* value, | |
584 Register fixed_register) { | |
585 return CanBeImmediateConstant(value) | |
586 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | |
587 : UseFixed(value, fixed_register); | |
588 } | |
589 | |
590 | |
583 LOperand* LChunkBuilder::UseRegisterOrConstant(HValue* value) { | 591 LOperand* LChunkBuilder::UseRegisterOrConstant(HValue* value) { |
584 return CanBeImmediateConstant(value) | 592 return CanBeImmediateConstant(value) |
585 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | 593 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
586 : UseRegister(value); | 594 : UseRegister(value); |
587 } | 595 } |
588 | 596 |
589 | 597 |
590 LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) { | 598 LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) { |
591 return CanBeImmediateConstant(value) | 599 return CanBeImmediateConstant(value) |
592 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | 600 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1859 | 1867 |
1860 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) { | 1868 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) { |
1861 LOperand* date = UseFixed(instr->value(), eax); | 1869 LOperand* date = UseFixed(instr->value(), eax); |
1862 LDateField* result = | 1870 LDateField* result = |
1863 new(zone()) LDateField(date, FixedTemp(ecx), instr->index()); | 1871 new(zone()) LDateField(date, FixedTemp(ecx), instr->index()); |
1864 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY); | 1872 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY); |
1865 } | 1873 } |
1866 | 1874 |
1867 | 1875 |
1868 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { | 1876 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { |
1869 LOperand* string = UseRegister(instr->string()); | 1877 LOperand* string = UseRegisterAtStart(instr->string()); |
1870 LOperand* index = UseRegister(instr->index()); | 1878 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); |
1871 ASSERT(ecx.is_byte_register()); | 1879 LOperand* value = (instr->encoding() == String::ONE_BYTE_ENCODING) |
1872 LOperand* value = UseFixed(instr->value(), ecx); | 1880 ? UseFixedOrConstant(instr->value(), eax) |
Yang
2013/11/06 09:55:09
Why does this have to be fixed to eax, why not Use
Benedikt Meurer
2013/11/06 10:06:36
Because mov_b() requires a byte register.
| |
1873 LSeqStringSetChar* result = | 1881 : UseRegisterOrConstantAtStart(instr->value()); |
1874 new(zone()) LSeqStringSetChar(instr->encoding(), string, index, value); | 1882 return new(zone()) LSeqStringSetChar(string, index, value); |
1875 return DefineSameAsFirst(result); | |
1876 } | 1883 } |
1877 | 1884 |
1878 | 1885 |
1879 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1886 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
1880 return AssignEnvironment(new(zone()) LBoundsCheck( | 1887 return AssignEnvironment(new(zone()) LBoundsCheck( |
1881 UseRegisterOrConstantAtStart(instr->index()), | 1888 UseRegisterOrConstantAtStart(instr->index()), |
1882 UseAtStart(instr->length()))); | 1889 UseAtStart(instr->length()))); |
1883 } | 1890 } |
1884 | 1891 |
1885 | 1892 |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2736 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2743 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2737 LOperand* object = UseRegister(instr->object()); | 2744 LOperand* object = UseRegister(instr->object()); |
2738 LOperand* index = UseTempRegister(instr->index()); | 2745 LOperand* index = UseTempRegister(instr->index()); |
2739 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2746 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2740 } | 2747 } |
2741 | 2748 |
2742 | 2749 |
2743 } } // namespace v8::internal | 2750 } } // namespace v8::internal |
2744 | 2751 |
2745 #endif // V8_TARGET_ARCH_IA32 | 2752 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |