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