Chromium Code Reviews| Index: src/ia32/lithium-codegen-ia32.cc |
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
| index 28f4679a41cf5e7c37fc7545a0283bdceac37271..da7fce56754c9a7a6245c51b4983fe17a193b4bc 100644 |
| --- a/src/ia32/lithium-codegen-ia32.cc |
| +++ b/src/ia32/lithium-codegen-ia32.cc |
| @@ -3007,6 +3007,56 @@ void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) { |
| } |
| +void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
| + class DeferredStringCharFromCode: public LDeferredCode { |
| + public: |
| + DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
| + : LDeferredCode(codegen), instr_(instr) { } |
| + virtual void Generate() { codegen()->DoDeferredStringCharFromCode(instr_); } |
| + private: |
| + LStringCharFromCode* instr_; |
| + }; |
| + |
| + DeferredStringCharFromCode* deferred = |
| + new DeferredStringCharFromCode(this, instr); |
| + |
| + ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
| + Register char_code = ToRegister(instr->char_code()); |
| + Register result = ToRegister(instr->result()); |
| + ASSERT(!char_code.is(result)); |
| + |
| + __ cmp(char_code, String::kMaxAsciiCharCode); |
| + __ j(above, deferred->entry()); |
| + __ Set(result, Immediate(Factory::single_character_string_cache())); |
| + __ mov(result, FieldOperand(result, |
| + char_code, times_pointer_size, |
| + FixedArray::kHeaderSize)); |
| + __ cmp(result, Factory::undefined_value()); |
| + __ j(equal, deferred->entry()); |
| + __ bind(deferred->exit()); |
| +} |
| + |
| + |
| +void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) { |
| + Register char_code = ToRegister(instr->char_code()); |
| + Register result = ToRegister(instr->result()); |
| + |
| + // TODO(3095996): Get rid of this. For now, we need to make the |
| + // result register contain a valid pointer because it is already |
| + // contained in the register pointer map. |
| + __ Set(result, Immediate(0)); |
| + |
| + __ PushSafepointRegisters(); |
| + __ SmiTag(char_code); |
| + __ push(char_code); |
| + __ CallRuntimeSaveDoubles(Runtime::kCharFromCode); |
| + RecordSafepointWithRegisters( |
| + instr->pointer_map(), 1, Safepoint::kNoDeoptimizationIndex); |
|
fschneider
2011/03/14 11:34:17
I think it is ok to have no deoptimization index h
Vitaly Repeshko
2011/03/14 14:15:50
Thanks for the explanation! But if this runtime fu
|
| + __ StoreToSafepointRegisterSlot(result, eax); |
| + __ PopSafepointRegisters(); |
| +} |
| + |
| + |
| void LCodeGen::DoStringLength(LStringLength* instr) { |
| Register string = ToRegister(instr->string()); |
| Register result = ToRegister(instr->result()); |