| 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 2869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2880 Register result = ToRegister(instr->result()); | 2880 Register result = ToRegister(instr->result()); |
| 2881 Register scratch = scratch0(); | 2881 Register scratch = scratch0(); |
| 2882 | 2882 |
| 2883 // TODO(3095996): Get rid of this. For now, we need to make the | 2883 // TODO(3095996): Get rid of this. For now, we need to make the |
| 2884 // result register contain a valid pointer because it is already | 2884 // result register contain a valid pointer because it is already |
| 2885 // contained in the register pointer map. | 2885 // contained in the register pointer map. |
| 2886 __ mov(result, Operand(0)); | 2886 __ mov(result, Operand(0)); |
| 2887 | 2887 |
| 2888 __ PushSafepointRegisters(); | 2888 __ PushSafepointRegisters(); |
| 2889 __ push(string); | 2889 __ push(string); |
| 2890 // Push the index as a smi. | 2890 // Push the index as a smi. It's safe because this instruction must |
| 2891 // be dominated by a bounds check and because of the assert. |
| 2892 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); |
| 2891 if (instr->index()->IsConstantOperand()) { | 2893 if (instr->index()->IsConstantOperand()) { |
| 2892 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); | 2894 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); |
| 2895 if (!Smi::IsValid(const_index)) { |
| 2896 // Guaranteed to be out of bounds, so we can use "-1" to have a |
| 2897 // valid smi. |
| 2898 const_index = -1; |
| 2899 } |
| 2893 __ mov(scratch, Operand(Smi::FromInt(const_index))); | 2900 __ mov(scratch, Operand(Smi::FromInt(const_index))); |
| 2894 __ push(scratch); | 2901 __ push(scratch); |
| 2895 } else { | 2902 } else { |
| 2896 Register index = ToRegister(instr->index()); | 2903 Register index = ToRegister(instr->index()); |
| 2897 __ SmiTag(index); | 2904 __ SmiTag(index); |
| 2898 __ push(index); | 2905 __ push(index); |
| 2899 } | 2906 } |
| 2900 __ CallRuntimeSaveDoubles(Runtime::kStringCharCodeAt); | 2907 __ CallRuntimeSaveDoubles(Runtime::kStringCharCodeAt); |
| 2901 RecordSafepointWithRegisters( | 2908 RecordSafepointWithRegisters( |
| 2902 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex); | 2909 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex); |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3601 | 3608 |
| 3602 | 3609 |
| 3603 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 3610 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
| 3604 Abort("DoOsrEntry unimplemented."); | 3611 Abort("DoOsrEntry unimplemented."); |
| 3605 } | 3612 } |
| 3606 | 3613 |
| 3607 | 3614 |
| 3608 #undef __ | 3615 #undef __ |
| 3609 | 3616 |
| 3610 } } // namespace v8::internal | 3617 } } // namespace v8::internal |
| OLD | NEW |