Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2743 Register string = ToRegister(instr->string()); | 2743 Register string = ToRegister(instr->string()); |
| 2744 Register result = ToRegister(instr->result()); | 2744 Register result = ToRegister(instr->result()); |
| 2745 | 2745 |
| 2746 // TODO(3095996): Get rid of this. For now, we need to make the | 2746 // TODO(3095996): Get rid of this. For now, we need to make the |
| 2747 // result register contain a valid pointer because it is already | 2747 // result register contain a valid pointer because it is already |
| 2748 // contained in the register pointer map. | 2748 // contained in the register pointer map. |
| 2749 __ Set(result, Immediate(0)); | 2749 __ Set(result, Immediate(0)); |
| 2750 | 2750 |
| 2751 __ PushSafepointRegisters(); | 2751 __ PushSafepointRegisters(); |
| 2752 __ push(string); | 2752 __ push(string); |
| 2753 // Push the index as a smi. | 2753 // Push the index as a smi. It's safe because this instruction must |
| 2754 // be dominated by a bounds check and because of the assert. | |
| 2755 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); | |
| 2754 if (instr->index()->IsConstantOperand()) { | 2756 if (instr->index()->IsConstantOperand()) { |
| 2755 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); | 2757 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); |
| 2758 if (!Smi::IsValid(const_index)) { | |
|
Mads Ager (chromium)
2011/01/20 15:03:17
We shouldn't generate code at all for this instruc
| |
| 2759 // Guaranteed to be out of bounds, so we can use "-1" to have a | |
| 2760 // valid smi. | |
| 2761 const_index = -1; | |
| 2762 } | |
| 2756 __ push(Immediate(Smi::FromInt(const_index))); | 2763 __ push(Immediate(Smi::FromInt(const_index))); |
| 2757 } else { | 2764 } else { |
| 2758 Register index = ToRegister(instr->index()); | 2765 Register index = ToRegister(instr->index()); |
| 2759 __ SmiTag(index); | 2766 __ SmiTag(index); |
| 2760 __ push(index); | 2767 __ push(index); |
| 2761 } | 2768 } |
| 2762 __ CallRuntimeSaveDoubles(Runtime::kStringCharCodeAt); | 2769 __ CallRuntimeSaveDoubles(Runtime::kStringCharCodeAt); |
| 2763 RecordSafepointWithRegisters( | 2770 RecordSafepointWithRegisters( |
| 2764 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex); | 2771 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex); |
| 2765 if (FLAG_debug_code) { | 2772 if (FLAG_debug_code) { |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3583 ASSERT(osr_pc_offset_ == -1); | 3590 ASSERT(osr_pc_offset_ == -1); |
| 3584 osr_pc_offset_ = masm()->pc_offset(); | 3591 osr_pc_offset_ = masm()->pc_offset(); |
| 3585 } | 3592 } |
| 3586 | 3593 |
| 3587 | 3594 |
| 3588 #undef __ | 3595 #undef __ |
| 3589 | 3596 |
| 3590 } } // namespace v8::internal | 3597 } } // namespace v8::internal |
| 3591 | 3598 |
| 3592 #endif // V8_TARGET_ARCH_IA32 | 3599 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |