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 3285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3296 ASSERT(ToRegister(instr->key()).is(ecx)); | 3296 ASSERT(ToRegister(instr->key()).is(ecx)); |
3297 ASSERT(ToRegister(instr->value()).is(eax)); | 3297 ASSERT(ToRegister(instr->value()).is(eax)); |
3298 | 3298 |
3299 Handle<Code> ic = instr->strict_mode() | 3299 Handle<Code> ic = instr->strict_mode() |
3300 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 3300 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
3301 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 3301 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
3302 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3302 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3303 } | 3303 } |
3304 | 3304 |
3305 | 3305 |
3306 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | |
3307 Register object_reg = ToRegister(instr->object()); | |
3308 Register new_map_reg = ToRegister(instr->new_map_reg()); | |
3309 | |
3310 Handle<Map> from_map = instr->original_map(); | |
3311 Handle<Map> to_map = instr->transitioned_map(); | |
3312 ElementsKind from_elements = from_map->elements_kind(); | |
3313 ElementsKind to_elements = to_map->elements_kind(); | |
3314 | |
3315 Label not_applicable; | |
3316 __ cmp(FieldOperand(object_reg, HeapObject::kMapOffset), from_map); | |
3317 __ j(not_equal, ¬_applicable); | |
3318 __ push(object_reg); | |
danno
2011/10/17 12:36:05
You always push object_reg, even if it isn't neede
Jakob Kummerow
2011/10/18 08:13:09
Done.
danno
2011/10/18 08:57:03
Done.
| |
3319 __ mov(new_map_reg, to_map); | |
danno
2011/10/17 12:36:05
You only need this is the FAST_SMI_ONLY_ELEMENTS -
Jakob Kummerow
2011/10/18 08:13:09
Nope, I really do need it in all cases (due to the
| |
3320 if (from_elements == FAST_SMI_ONLY_ELEMENTS) { | |
3321 if (to_elements == FAST_DOUBLE_ELEMENTS) { | |
3322 ASSERT(object_reg.is(edx)); | |
3323 ASSERT(new_map_reg.is(ebx)); | |
3324 Handle<Code> stub = | |
3325 isolate()->builtins()->TransitionElementsSmiToDouble(); | |
3326 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
3327 } else if (to_elements == FAST_ELEMENTS) { | |
3328 __ mov(FieldOperand(object_reg, HeapObject::kMapOffset), new_map_reg); | |
3329 // Write barrier. | |
3330 ASSERT_NE(instr->temp_reg(), NULL); | |
3331 __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, | |
3332 ToRegister(instr->temp_reg()), kDontSaveFPRegs); | |
3333 } else { | |
3334 UNREACHABLE(); | |
3335 } | |
3336 } else if (from_elements == FAST_DOUBLE_ELEMENTS && | |
3337 to_elements == FAST_ELEMENTS) { | |
3338 ASSERT(object_reg.is(edx)); | |
3339 ASSERT(new_map_reg.is(ebx)); | |
3340 Handle<Code> stub = | |
3341 isolate()->builtins()->TransitionElementsDoubleToObject(); | |
3342 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
3343 } else { | |
3344 UNREACHABLE(); | |
3345 } | |
3346 __ pop(object_reg); | |
danno
2011/10/17 12:36:05
The register allocator should be able to help you
Jakob Kummerow
2011/10/18 08:13:09
Done.
| |
3347 __ bind(¬_applicable); | |
3348 } | |
3349 | |
3350 | |
3306 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 3351 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
3307 class DeferredStringCharCodeAt: public LDeferredCode { | 3352 class DeferredStringCharCodeAt: public LDeferredCode { |
3308 public: | 3353 public: |
3309 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) | 3354 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) |
3310 : LDeferredCode(codegen), instr_(instr) { } | 3355 : LDeferredCode(codegen), instr_(instr) { } |
3311 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); } | 3356 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); } |
3312 virtual LInstruction* instr() { return instr_; } | 3357 virtual LInstruction* instr() { return instr_; } |
3313 private: | 3358 private: |
3314 LStringCharCodeAt* instr_; | 3359 LStringCharCodeAt* instr_; |
3315 }; | 3360 }; |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4489 env->deoptimization_index()); | 4534 env->deoptimization_index()); |
4490 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4535 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4491 } | 4536 } |
4492 | 4537 |
4493 | 4538 |
4494 #undef __ | 4539 #undef __ |
4495 | 4540 |
4496 } } // namespace v8::internal | 4541 } } // namespace v8::internal |
4497 | 4542 |
4498 #endif // V8_TARGET_ARCH_IA32 | 4543 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |