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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 GenerateDeferredCode() && | 77 GenerateDeferredCode() && |
78 GenerateDeoptJumpTable() && | 78 GenerateDeoptJumpTable() && |
79 GenerateSafepointTable(); | 79 GenerateSafepointTable(); |
80 } | 80 } |
81 | 81 |
82 | 82 |
83 void LCodeGen::FinishCode(Handle<Code> code) { | 83 void LCodeGen::FinishCode(Handle<Code> code) { |
84 ASSERT(is_done()); | 84 ASSERT(is_done()); |
85 code->set_stack_slots(GetStackSlotCount()); | 85 code->set_stack_slots(GetStackSlotCount()); |
86 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 86 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
87 if (FLAG_weak_embedded_maps_in_optimized_code) { | 87 RegisterDependentCodeForEmbeddedMaps(code); |
88 RegisterDependentCodeForEmbeddedMaps(code); | |
89 } | |
90 PopulateDeoptimizationData(code); | 88 PopulateDeoptimizationData(code); |
91 info()->CommitDependencies(code); | 89 info()->CommitDependencies(code); |
92 } | 90 } |
93 | 91 |
94 | 92 |
95 void LChunkBuilder::Abort(BailoutReason reason) { | 93 void LChunkBuilder::Abort(BailoutReason reason) { |
96 info()->set_bailout_reason(reason); | 94 info()->set_bailout_reason(reason); |
97 status_ = ABORTED; | 95 status_ = ABORTED; |
98 } | 96 } |
99 | 97 |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 LEnvironment* environment, | 838 LEnvironment* environment, |
841 Register src1, | 839 Register src1, |
842 const Operand& src2) { | 840 const Operand& src2) { |
843 Deoptimizer::BailoutType bailout_type = info()->IsStub() | 841 Deoptimizer::BailoutType bailout_type = info()->IsStub() |
844 ? Deoptimizer::LAZY | 842 ? Deoptimizer::LAZY |
845 : Deoptimizer::EAGER; | 843 : Deoptimizer::EAGER; |
846 DeoptimizeIf(condition, environment, bailout_type, src1, src2); | 844 DeoptimizeIf(condition, environment, bailout_type, src1, src2); |
847 } | 845 } |
848 | 846 |
849 | 847 |
850 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { | |
851 ZoneList<Handle<Map> > maps(1, zone()); | |
852 ZoneList<Handle<JSObject> > objects(1, zone()); | |
853 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | |
854 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | |
855 if (Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_object())) { | |
856 if (it.rinfo()->target_object()->IsMap()) { | |
857 Handle<Map> map(Map::cast(it.rinfo()->target_object())); | |
858 maps.Add(map, zone()); | |
859 } else if (it.rinfo()->target_object()->IsJSObject()) { | |
860 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); | |
861 objects.Add(object, zone()); | |
862 } | |
863 } | |
864 } | |
865 #ifdef VERIFY_HEAP | |
866 // This disables verification of weak embedded objects after full GC. | |
867 // AddDependentCode can cause a GC, which would observe the state where | |
868 // this code is not yet in the depended code lists of the embedded maps. | |
869 NoWeakObjectVerificationScope disable_verification_of_embedded_objects; | |
870 #endif | |
871 for (int i = 0; i < maps.length(); i++) { | |
872 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); | |
873 } | |
874 for (int i = 0; i < objects.length(); i++) { | |
875 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); | |
876 } | |
877 } | |
878 | |
879 | |
880 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { | 848 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { |
881 int length = deoptimizations_.length(); | 849 int length = deoptimizations_.length(); |
882 if (length == 0) return; | 850 if (length == 0) return; |
883 Handle<DeoptimizationInputData> data = | 851 Handle<DeoptimizationInputData> data = |
884 factory()->NewDeoptimizationInputData(length, TENURED); | 852 factory()->NewDeoptimizationInputData(length, TENURED); |
885 | 853 |
886 Handle<ByteArray> translations = | 854 Handle<ByteArray> translations = |
887 translations_.CreateByteArray(isolate()->factory()); | 855 translations_.CreateByteArray(isolate()->factory()); |
888 data->SetTranslationByteArray(*translations); | 856 data->SetTranslationByteArray(*translations); |
889 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_)); | 857 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_)); |
(...skipping 4979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5869 __ Subu(scratch, result, scratch); | 5837 __ Subu(scratch, result, scratch); |
5870 __ lw(result, FieldMemOperand(scratch, | 5838 __ lw(result, FieldMemOperand(scratch, |
5871 FixedArray::kHeaderSize - kPointerSize)); | 5839 FixedArray::kHeaderSize - kPointerSize)); |
5872 __ bind(&done); | 5840 __ bind(&done); |
5873 } | 5841 } |
5874 | 5842 |
5875 | 5843 |
5876 #undef __ | 5844 #undef __ |
5877 | 5845 |
5878 } } // namespace v8::internal | 5846 } } // namespace v8::internal |
OLD | NEW |