Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 12256038: Register dependent codes before populating deoptimization data, which can cause GC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/lithium.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 GenerateDeferredCode() && 89 GenerateDeferredCode() &&
90 GenerateJumpTable() && 90 GenerateJumpTable() &&
91 GenerateSafepointTable(); 91 GenerateSafepointTable();
92 } 92 }
93 93
94 94
95 void LCodeGen::FinishCode(Handle<Code> code) { 95 void LCodeGen::FinishCode(Handle<Code> code) {
96 ASSERT(is_done()); 96 ASSERT(is_done());
97 code->set_stack_slots(GetStackSlotCount()); 97 code->set_stack_slots(GetStackSlotCount());
98 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); 98 code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
99 if (FLAG_weak_embedded_maps_in_optimized_code) {
100 RegisterDependentCodeForEmbeddedMaps(code);
101 }
99 PopulateDeoptimizationData(code); 102 PopulateDeoptimizationData(code);
100 if (!info()->IsStub()) { 103 if (!info()->IsStub()) {
101 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code); 104 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code);
102 } 105 }
103 } 106 }
104 107
105 108
106 void LCodeGen::Abort(const char* reason) { 109 void LCodeGen::Abort(const char* reason) {
107 info()->set_bailout_reason(reason); 110 info()->set_bailout_reason(reason);
108 status_ = ABORTED; 111 status_ = ABORTED;
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 } 892 }
890 if (cc == no_condition) { 893 if (cc == no_condition) {
891 __ jmp(&jump_table_.last().label); 894 __ jmp(&jump_table_.last().label);
892 } else { 895 } else {
893 __ j(cc, &jump_table_.last().label); 896 __ j(cc, &jump_table_.last().label);
894 } 897 }
895 } 898 }
896 } 899 }
897 900
898 901
902 void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) {
903 ZoneList<Handle<Map> > maps(1, zone());
904 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
905 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
906 RelocInfo::Mode mode = it.rinfo()->rmode();
907 if (mode == RelocInfo::EMBEDDED_OBJECT &&
908 it.rinfo()->target_object()->IsMap()) {
909 Handle<Map> map(Map::cast(it.rinfo()->target_object()));
910 if (map->CanTransition()) {
911 maps.Add(map, zone());
912 }
913 }
914 }
915 #ifdef VERIFY_HEAP
916 // This disables verification of weak embedded maps after full GC.
917 // AddDependentCode can cause a GC, which would observe the state where
918 // this code is not yet in the depended code lists of the embedded maps.
919 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps;
920 #endif
921 for (int i = 0; i < maps.length(); i++) {
922 maps.at(i)->AddDependentCode(code);
923 }
924 }
925
926
899 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { 927 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
900 int length = deoptimizations_.length(); 928 int length = deoptimizations_.length();
901 if (length == 0) return; 929 if (length == 0) return;
902 Handle<DeoptimizationInputData> data = 930 Handle<DeoptimizationInputData> data =
903 factory()->NewDeoptimizationInputData(length, TENURED); 931 factory()->NewDeoptimizationInputData(length, TENURED);
904 932
905 Handle<ByteArray> translations = translations_.CreateByteArray(); 933 Handle<ByteArray> translations = translations_.CreateByteArray();
906 data->SetTranslationByteArray(*translations); 934 data->SetTranslationByteArray(*translations);
907 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_)); 935 data->SetInlinedFunctionCount(Smi::FromInt(inlined_function_count_));
908 936
(...skipping 5234 matching lines...) Expand 10 before | Expand all | Expand 10 after
6143 FixedArray::kHeaderSize - kPointerSize)); 6171 FixedArray::kHeaderSize - kPointerSize));
6144 __ bind(&done); 6172 __ bind(&done);
6145 } 6173 }
6146 6174
6147 6175
6148 #undef __ 6176 #undef __
6149 6177
6150 } } // namespace v8::internal 6178 } } // namespace v8::internal
6151 6179
6152 #endif // V8_TARGET_ARCH_IA32 6180 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/lithium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698