OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 3728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3740 isolate()->factory()->NewJSGlobalPropertyCell(target); | 3740 isolate()->factory()->NewJSGlobalPropertyCell(target); |
3741 __ movq(kScratchRegister, cell, RelocInfo::GLOBAL_PROPERTY_CELL); | 3741 __ movq(kScratchRegister, cell, RelocInfo::GLOBAL_PROPERTY_CELL); |
3742 __ cmpq(reg, Operand(kScratchRegister, 0)); | 3742 __ cmpq(reg, Operand(kScratchRegister, 0)); |
3743 } else { | 3743 } else { |
3744 __ Cmp(reg, target); | 3744 __ Cmp(reg, target); |
3745 } | 3745 } |
3746 DeoptimizeIf(not_equal, instr->environment()); | 3746 DeoptimizeIf(not_equal, instr->environment()); |
3747 } | 3747 } |
3748 | 3748 |
3749 | 3749 |
| 3750 void LCodeGen::DoCheckMapCommon(Register reg, |
| 3751 Handle<Map> map, |
| 3752 CompareMapMode mode, |
| 3753 LEnvironment* env) { |
| 3754 Label success; |
| 3755 __ CompareMap(reg, map, &success, mode); |
| 3756 DeoptimizeIf(not_equal, env); |
| 3757 __ bind(&success); |
| 3758 } |
| 3759 |
| 3760 |
3750 void LCodeGen::DoCheckMap(LCheckMap* instr) { | 3761 void LCodeGen::DoCheckMap(LCheckMap* instr) { |
3751 LOperand* input = instr->InputAt(0); | 3762 LOperand* input = instr->InputAt(0); |
3752 ASSERT(input->IsRegister()); | 3763 ASSERT(input->IsRegister()); |
3753 Register reg = ToRegister(input); | 3764 Register reg = ToRegister(input); |
3754 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), | 3765 Handle<Map> map = instr->hydrogen()->map(); |
3755 instr->hydrogen()->map()); | 3766 DoCheckMapCommon(reg, map, instr->hydrogen()->mode(), instr->environment()); |
3756 DeoptimizeIf(not_equal, instr->environment()); | |
3757 } | 3767 } |
3758 | 3768 |
3759 | 3769 |
3760 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { | 3770 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { |
3761 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); | 3771 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); |
3762 Register result_reg = ToRegister(instr->result()); | 3772 Register result_reg = ToRegister(instr->result()); |
3763 Register temp_reg = ToRegister(instr->TempAt(0)); | 3773 Register temp_reg = ToRegister(instr->TempAt(0)); |
3764 __ ClampDoubleToUint8(value_reg, xmm0, result_reg, temp_reg); | 3774 __ ClampDoubleToUint8(value_reg, xmm0, result_reg, temp_reg); |
3765 } | 3775 } |
3766 | 3776 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3812 Register reg = ToRegister(instr->TempAt(0)); | 3822 Register reg = ToRegister(instr->TempAt(0)); |
3813 | 3823 |
3814 Handle<JSObject> holder = instr->holder(); | 3824 Handle<JSObject> holder = instr->holder(); |
3815 Handle<JSObject> current_prototype = instr->prototype(); | 3825 Handle<JSObject> current_prototype = instr->prototype(); |
3816 | 3826 |
3817 // Load prototype object. | 3827 // Load prototype object. |
3818 __ LoadHeapObject(reg, current_prototype); | 3828 __ LoadHeapObject(reg, current_prototype); |
3819 | 3829 |
3820 // Check prototype maps up to the holder. | 3830 // Check prototype maps up to the holder. |
3821 while (!current_prototype.is_identical_to(holder)) { | 3831 while (!current_prototype.is_identical_to(holder)) { |
3822 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), | 3832 DoCheckMapCommon(reg, Handle<Map>(current_prototype->map()), |
3823 Handle<Map>(current_prototype->map())); | 3833 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); |
3824 DeoptimizeIf(not_equal, instr->environment()); | |
3825 current_prototype = | 3834 current_prototype = |
3826 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); | 3835 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); |
3827 // Load next prototype object. | 3836 // Load next prototype object. |
3828 __ LoadHeapObject(reg, current_prototype); | 3837 __ LoadHeapObject(reg, current_prototype); |
3829 } | 3838 } |
3830 | 3839 |
3831 // Check the holder map. | 3840 // Check the holder map. |
3832 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), | 3841 DoCheckMapCommon(reg, Handle<Map>(current_prototype->map()), |
3833 Handle<Map>(current_prototype->map())); | 3842 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); |
3834 DeoptimizeIf(not_equal, instr->environment()); | |
3835 } | 3843 } |
3836 | 3844 |
3837 | 3845 |
3838 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 3846 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
3839 Heap* heap = isolate()->heap(); | 3847 Heap* heap = isolate()->heap(); |
3840 ElementsKind boilerplate_elements_kind = | 3848 ElementsKind boilerplate_elements_kind = |
3841 instr->hydrogen()->boilerplate_elements_kind(); | 3849 instr->hydrogen()->boilerplate_elements_kind(); |
3842 | 3850 |
3843 // Deopt if the array literal boilerplate ElementsKind is of a type different | 3851 // Deopt if the array literal boilerplate ElementsKind is of a type different |
3844 // than the expected one. The check isn't necessary if the boilerplate has | 3852 // than the expected one. The check isn't necessary if the boilerplate has |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4329 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4337 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
4330 ASSERT(osr_pc_offset_ == -1); | 4338 ASSERT(osr_pc_offset_ == -1); |
4331 osr_pc_offset_ = masm()->pc_offset(); | 4339 osr_pc_offset_ = masm()->pc_offset(); |
4332 } | 4340 } |
4333 | 4341 |
4334 #undef __ | 4342 #undef __ |
4335 | 4343 |
4336 } } // namespace v8::internal | 4344 } } // namespace v8::internal |
4337 | 4345 |
4338 #endif // V8_TARGET_ARCH_X64 | 4346 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |