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 2989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3000 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex); | 3000 instr->pointer_map(), 2, Safepoint::kNoDeoptimizationIndex); |
3001 if (FLAG_debug_code) { | 3001 if (FLAG_debug_code) { |
3002 __ AbortIfNotSmi(eax); | 3002 __ AbortIfNotSmi(eax); |
3003 } | 3003 } |
3004 __ SmiUntag(eax); | 3004 __ SmiUntag(eax); |
3005 __ StoreToSafepointRegisterSlot(result, eax); | 3005 __ StoreToSafepointRegisterSlot(result, eax); |
3006 __ PopSafepointRegisters(); | 3006 __ PopSafepointRegisters(); |
3007 } | 3007 } |
3008 | 3008 |
3009 | 3009 |
3010 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | |
3011 class DeferredStringCharFromCode: public LDeferredCode { | |
3012 public: | |
3013 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | |
3014 : LDeferredCode(codegen), instr_(instr) { } | |
3015 virtual void Generate() { codegen()->DoDeferredStringCharFromCode(instr_); } | |
3016 private: | |
3017 LStringCharFromCode* instr_; | |
3018 }; | |
3019 | |
3020 DeferredStringCharFromCode* deferred = | |
3021 new DeferredStringCharFromCode(this, instr); | |
3022 | |
3023 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | |
3024 Register char_code = ToRegister(instr->char_code()); | |
3025 Register result = ToRegister(instr->result()); | |
3026 ASSERT(!char_code.is(result)); | |
3027 | |
3028 __ cmp(char_code, String::kMaxAsciiCharCode); | |
3029 __ j(above, deferred->entry()); | |
3030 __ Set(result, Immediate(Factory::single_character_string_cache())); | |
3031 __ mov(result, FieldOperand(result, | |
3032 char_code, times_pointer_size, | |
3033 FixedArray::kHeaderSize)); | |
3034 __ cmp(result, Factory::undefined_value()); | |
3035 __ j(equal, deferred->entry()); | |
3036 __ bind(deferred->exit()); | |
3037 } | |
3038 | |
3039 | |
3040 void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) { | |
3041 Register char_code = ToRegister(instr->char_code()); | |
3042 Register result = ToRegister(instr->result()); | |
3043 | |
3044 // TODO(3095996): Get rid of this. For now, we need to make the | |
3045 // result register contain a valid pointer because it is already | |
3046 // contained in the register pointer map. | |
3047 __ Set(result, Immediate(0)); | |
3048 | |
3049 __ PushSafepointRegisters(); | |
3050 __ SmiTag(char_code); | |
3051 __ push(char_code); | |
3052 __ CallRuntimeSaveDoubles(Runtime::kCharFromCode); | |
3053 RecordSafepointWithRegisters( | |
3054 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
| |
3055 __ StoreToSafepointRegisterSlot(result, eax); | |
3056 __ PopSafepointRegisters(); | |
3057 } | |
3058 | |
3059 | |
3010 void LCodeGen::DoStringLength(LStringLength* instr) { | 3060 void LCodeGen::DoStringLength(LStringLength* instr) { |
3011 Register string = ToRegister(instr->string()); | 3061 Register string = ToRegister(instr->string()); |
3012 Register result = ToRegister(instr->result()); | 3062 Register result = ToRegister(instr->result()); |
3013 __ mov(result, FieldOperand(string, String::kLengthOffset)); | 3063 __ mov(result, FieldOperand(string, String::kLengthOffset)); |
3014 } | 3064 } |
3015 | 3065 |
3016 | 3066 |
3017 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { | 3067 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { |
3018 LOperand* input = instr->InputAt(0); | 3068 LOperand* input = instr->InputAt(0); |
3019 ASSERT(input->IsRegister() || input->IsStackSlot()); | 3069 ASSERT(input->IsRegister() || input->IsStackSlot()); |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3870 ASSERT(osr_pc_offset_ == -1); | 3920 ASSERT(osr_pc_offset_ == -1); |
3871 osr_pc_offset_ = masm()->pc_offset(); | 3921 osr_pc_offset_ = masm()->pc_offset(); |
3872 } | 3922 } |
3873 | 3923 |
3874 | 3924 |
3875 #undef __ | 3925 #undef __ |
3876 | 3926 |
3877 } } // namespace v8::internal | 3927 } } // namespace v8::internal |
3878 | 3928 |
3879 #endif // V8_TARGET_ARCH_IA32 | 3929 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |