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 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 const Operand& src2) { | 845 const Operand& src2) { |
846 Deoptimizer::BailoutType bailout_type = info()->IsStub() | 846 Deoptimizer::BailoutType bailout_type = info()->IsStub() |
847 ? Deoptimizer::LAZY | 847 ? Deoptimizer::LAZY |
848 : Deoptimizer::EAGER; | 848 : Deoptimizer::EAGER; |
849 DeoptimizeIf(condition, environment, bailout_type, src1, src2); | 849 DeoptimizeIf(condition, environment, bailout_type, src1, src2); |
850 } | 850 } |
851 | 851 |
852 | 852 |
853 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { | 853 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { |
854 ZoneList<Handle<Map> > maps(1, zone()); | 854 ZoneList<Handle<Map> > maps(1, zone()); |
| 855 ZoneList<Handle<JSObject> > objects(1, zone()); |
855 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 856 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
856 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 857 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
857 RelocInfo::Mode mode = it.rinfo()->rmode(); | 858 if (Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_object())) { |
858 if (mode == RelocInfo::EMBEDDED_OBJECT && | 859 if (it.rinfo()->target_object()->IsMap()) { |
859 it.rinfo()->target_object()->IsMap()) { | 860 Handle<Map> map(Map::cast(it.rinfo()->target_object())); |
860 Handle<Map> map(Map::cast(it.rinfo()->target_object())); | |
861 if (map->CanTransition()) { | |
862 maps.Add(map, zone()); | 861 maps.Add(map, zone()); |
| 862 } else if (it.rinfo()->target_object()->IsJSObject()) { |
| 863 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); |
| 864 objects.Add(object, zone()); |
863 } | 865 } |
864 } | 866 } |
865 } | 867 } |
866 #ifdef VERIFY_HEAP | 868 #ifdef VERIFY_HEAP |
867 // This disables verification of weak embedded maps after full GC. | 869 // This disables verification of weak embedded maps after full GC. |
868 // AddDependentCode can cause a GC, which would observe the state where | 870 // AddDependentCode can cause a GC, which would observe the state where |
869 // this code is not yet in the depended code lists of the embedded maps. | 871 // this code is not yet in the depended code lists of the embedded maps. |
870 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps; | 872 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps; |
871 #endif | 873 #endif |
872 for (int i = 0; i < maps.length(); i++) { | 874 for (int i = 0; i < maps.length(); i++) { |
873 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); | 875 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); |
874 } | 876 } |
| 877 for (int i = 0; i < objects.length(); i++) { |
| 878 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); |
| 879 } |
875 } | 880 } |
876 | 881 |
877 | 882 |
878 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { | 883 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { |
879 int length = deoptimizations_.length(); | 884 int length = deoptimizations_.length(); |
880 if (length == 0) return; | 885 if (length == 0) return; |
881 Handle<DeoptimizationInputData> data = | 886 Handle<DeoptimizationInputData> data = |
882 factory()->NewDeoptimizationInputData(length, TENURED); | 887 factory()->NewDeoptimizationInputData(length, TENURED); |
883 | 888 |
884 Handle<ByteArray> translations = | 889 Handle<ByteArray> translations = |
(...skipping 4959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5844 __ Subu(scratch, result, scratch); | 5849 __ Subu(scratch, result, scratch); |
5845 __ lw(result, FieldMemOperand(scratch, | 5850 __ lw(result, FieldMemOperand(scratch, |
5846 FixedArray::kHeaderSize - kPointerSize)); | 5851 FixedArray::kHeaderSize - kPointerSize)); |
5847 __ bind(&done); | 5852 __ bind(&done); |
5848 } | 5853 } |
5849 | 5854 |
5850 | 5855 |
5851 #undef __ | 5856 #undef __ |
5852 | 5857 |
5853 } } // namespace v8::internal | 5858 } } // namespace v8::internal |
OLD | NEW |