OLD | NEW |
1 // Copyright 2012 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 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 code->set_stack_slots(GetStackSlotCount()); | 84 code->set_stack_slots(GetStackSlotCount()); |
85 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 85 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
86 if (FLAG_weak_embedded_maps_in_optimized_code) { | 86 if (FLAG_weak_embedded_maps_in_optimized_code) { |
87 RegisterDependentCodeForEmbeddedMaps(code); | 87 RegisterDependentCodeForEmbeddedMaps(code); |
88 } | 88 } |
89 PopulateDeoptimizationData(code); | 89 PopulateDeoptimizationData(code); |
90 for (int i = 0 ; i < prototype_maps_.length(); i++) { | 90 for (int i = 0 ; i < prototype_maps_.length(); i++) { |
91 prototype_maps_.at(i)->AddDependentCode( | 91 prototype_maps_.at(i)->AddDependentCode( |
92 DependentCode::kPrototypeCheckGroup, code); | 92 DependentCode::kPrototypeCheckGroup, code); |
93 } | 93 } |
| 94 for (int i = 0 ; i < transition_maps_.length(); i++) { |
| 95 transition_maps_.at(i)->AddDependentCode( |
| 96 DependentCode::kTransitionGroup, code); |
| 97 } |
94 } | 98 } |
95 | 99 |
96 | 100 |
97 void LChunkBuilder::Abort(const char* reason) { | 101 void LChunkBuilder::Abort(const char* reason) { |
98 info()->set_bailout_reason(reason); | 102 info()->set_bailout_reason(reason); |
99 status_ = ABORTED; | 103 status_ = ABORTED; |
100 } | 104 } |
101 | 105 |
102 | 106 |
103 void LCodeGen::Comment(const char* format, ...) { | 107 void LCodeGen::Comment(const char* format, ...) { |
(...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2678 EMIT_REMEMBERED_SET, | 2682 EMIT_REMEMBERED_SET, |
2679 check_needed); | 2683 check_needed); |
2680 } | 2684 } |
2681 | 2685 |
2682 __ bind(&skip_assignment); | 2686 __ bind(&skip_assignment); |
2683 } | 2687 } |
2684 | 2688 |
2685 | 2689 |
2686 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2690 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2687 Register object = ToRegister(instr->object()); | 2691 Register object = ToRegister(instr->object()); |
2688 Register result = ToRegister(instr->result()); | 2692 if (!FLAG_track_double_fields) { |
| 2693 ASSERT(!instr->hydrogen()->representation().IsDouble()); |
| 2694 } |
| 2695 Register temp = instr->hydrogen()->representation().IsDouble() |
| 2696 ? scratch0() : ToRegister(instr->result()); |
2689 if (instr->hydrogen()->is_in_object()) { | 2697 if (instr->hydrogen()->is_in_object()) { |
2690 __ lw(result, FieldMemOperand(object, instr->hydrogen()->offset())); | 2698 __ lw(temp, FieldMemOperand(object, instr->hydrogen()->offset())); |
2691 } else { | 2699 } else { |
2692 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 2700 __ lw(temp, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
2693 __ lw(result, FieldMemOperand(result, instr->hydrogen()->offset())); | 2701 __ lw(temp, FieldMemOperand(temp, instr->hydrogen()->offset())); |
| 2702 } |
| 2703 |
| 2704 if (instr->hydrogen()->representation().IsDouble()) { |
| 2705 Label load_from_heap_number, done; |
| 2706 DoubleRegister result = ToDoubleRegister(instr->result()); |
| 2707 FPURegister flt_scratch = double_scratch0().low(); |
| 2708 __ JumpIfNotSmi(temp, &load_from_heap_number); |
| 2709 __ SmiUntag(temp); |
| 2710 __ mtc1(temp, flt_scratch); |
| 2711 __ cvt_d_w(result, flt_scratch); |
| 2712 __ Branch(&done); |
| 2713 __ bind(&load_from_heap_number); |
| 2714 __ ldc1(result, FieldMemOperand(temp, HeapNumber::kValueOffset)); |
| 2715 __ bind(&done); |
2694 } | 2716 } |
2695 } | 2717 } |
2696 | 2718 |
2697 | 2719 |
2698 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, | 2720 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, |
2699 Register object, | 2721 Register object, |
2700 Handle<Map> type, | 2722 Handle<Map> type, |
2701 Handle<String> name, | 2723 Handle<String> name, |
2702 LEnvironment* env) { | 2724 LEnvironment* env) { |
2703 LookupResult lookup(isolate()); | 2725 LookupResult lookup(isolate()); |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3912 | 3934 |
3913 | 3935 |
3914 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 3936 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
3915 Register result = ToRegister(instr->result()); | 3937 Register result = ToRegister(instr->result()); |
3916 Register base = ToRegister(instr->base_object()); | 3938 Register base = ToRegister(instr->base_object()); |
3917 __ Addu(result, base, Operand(instr->offset())); | 3939 __ Addu(result, base, Operand(instr->offset())); |
3918 } | 3940 } |
3919 | 3941 |
3920 | 3942 |
3921 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 3943 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
| 3944 Representation representation = instr->representation(); |
| 3945 |
3922 Register object = ToRegister(instr->object()); | 3946 Register object = ToRegister(instr->object()); |
3923 Register value = ToRegister(instr->value()); | 3947 Register value = ToRegister(instr->value()); |
| 3948 ASSERT(!object.is(value)); |
3924 Register scratch = scratch0(); | 3949 Register scratch = scratch0(); |
3925 int offset = instr->offset(); | 3950 int offset = instr->offset(); |
3926 | 3951 |
3927 ASSERT(!object.is(value)); | 3952 if (FLAG_track_fields && representation.IsSmi()) { |
| 3953 __ SmiTagCheckOverflow(value, value, scratch); |
| 3954 if (!instr->hydrogen()->value()->range()->IsInSmiRange()) { |
| 3955 DeoptimizeIf(lt, instr->environment(), scratch, Operand(zero_reg)); |
| 3956 } |
| 3957 } else if (FLAG_track_double_fields && representation.IsDouble() && |
| 3958 !instr->hydrogen()->value()->type().IsSmi() && |
| 3959 !instr->hydrogen()->value()->type().IsHeapNumber()) { |
| 3960 Label do_store; |
| 3961 __ JumpIfSmi(value, &do_store); |
| 3962 Handle<Map> map(isolate()->factory()->heap_number_map()); |
3928 | 3963 |
3929 if (!instr->transition().is_null()) { | 3964 __ lw(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); |
3930 __ li(scratch, Operand(instr->transition())); | 3965 DoCheckMapCommon(scratch, map, REQUIRE_EXACT_MAP, instr->environment()); |
| 3966 __ bind(&do_store); |
| 3967 } |
| 3968 |
| 3969 Handle<Map> transition = instr->transition(); |
| 3970 if (!transition.is_null()) { |
| 3971 if (transition->CanBeDeprecated()) { |
| 3972 transition_maps_.Add(transition, info()->zone()); |
| 3973 } |
| 3974 __ li(scratch, Operand(transition)); |
3931 __ sw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 3975 __ sw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
3932 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { | 3976 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { |
3933 Register temp = ToRegister(instr->temp()); | 3977 Register temp = ToRegister(instr->temp()); |
3934 // Update the write barrier for the map field. | 3978 // Update the write barrier for the map field. |
3935 __ RecordWriteField(object, | 3979 __ RecordWriteField(object, |
3936 HeapObject::kMapOffset, | 3980 HeapObject::kMapOffset, |
3937 scratch, | 3981 scratch, |
3938 temp, | 3982 temp, |
3939 GetRAState(), | 3983 GetRAState(), |
3940 kSaveFPRegs, | 3984 kSaveFPRegs, |
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5734 __ Subu(scratch, result, scratch); | 5778 __ Subu(scratch, result, scratch); |
5735 __ lw(result, FieldMemOperand(scratch, | 5779 __ lw(result, FieldMemOperand(scratch, |
5736 FixedArray::kHeaderSize - kPointerSize)); | 5780 FixedArray::kHeaderSize - kPointerSize)); |
5737 __ bind(&done); | 5781 __ bind(&done); |
5738 } | 5782 } |
5739 | 5783 |
5740 | 5784 |
5741 #undef __ | 5785 #undef __ |
5742 | 5786 |
5743 } } // namespace v8::internal | 5787 } } // namespace v8::internal |
OLD | NEW |