OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 int LCodeGenBase::GetNextEmittedBlock() const { | 167 int LCodeGenBase::GetNextEmittedBlock() const { |
168 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { | 168 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { |
169 if (!graph()->blocks()->at(i)->IsReachable()) continue; | 169 if (!graph()->blocks()->at(i)->IsReachable()) continue; |
170 if (!chunk_->GetLabel(i)->HasReplacement()) return i; | 170 if (!chunk_->GetLabel(i)->HasReplacement()) return i; |
171 } | 171 } |
172 return -1; | 172 return -1; |
173 } | 173 } |
174 | 174 |
175 | 175 |
176 static void AddWeakObjectToCodeDependency(Isolate* isolate, | |
177 Handle<Object> object, | |
178 Handle<Code> code) { | |
179 Heap* heap = isolate->heap(); | |
180 heap->EnsureWeakObjectToCodeTable(); | |
181 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(*object)); | |
182 dep = DependentCode::Insert(dep, DependentCode::kWeakCodeGroup, code); | |
183 CALL_HEAP_FUNCTION_VOID(isolate, | |
184 heap->AddWeakObjectToCodeDependency(*object, *dep)); | |
185 } | |
186 | |
187 | |
188 void LCodeGenBase::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) { | 176 void LCodeGenBase::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) { |
189 ASSERT(code->is_optimized_code()); | 177 ASSERT(code->is_optimized_code()); |
190 ZoneList<Handle<Map> > maps(1, zone()); | 178 ZoneList<Handle<Map> > maps(1, zone()); |
191 ZoneList<Handle<JSObject> > objects(1, zone()); | 179 ZoneList<Handle<JSObject> > objects(1, zone()); |
192 ZoneList<Handle<Cell> > cells(1, zone()); | 180 ZoneList<Handle<Cell> > cells(1, zone()); |
193 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 181 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
194 RelocInfo::ModeMask(RelocInfo::CELL); | 182 RelocInfo::ModeMask(RelocInfo::CELL); |
195 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 183 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
196 RelocInfo::Mode mode = it.rinfo()->rmode(); | 184 RelocInfo::Mode mode = it.rinfo()->rmode(); |
197 if (mode == RelocInfo::CELL && | 185 if (mode == RelocInfo::CELL && |
(...skipping 21 matching lines...) Expand all Loading... |
219 #ifdef VERIFY_HEAP | 207 #ifdef VERIFY_HEAP |
220 // This disables verification of weak embedded objects after full GC. | 208 // This disables verification of weak embedded objects after full GC. |
221 // AddDependentCode can cause a GC, which would observe the state where | 209 // AddDependentCode can cause a GC, which would observe the state where |
222 // this code is not yet in the depended code lists of the embedded maps. | 210 // this code is not yet in the depended code lists of the embedded maps. |
223 NoWeakObjectVerificationScope disable_verification_of_embedded_objects; | 211 NoWeakObjectVerificationScope disable_verification_of_embedded_objects; |
224 #endif | 212 #endif |
225 for (int i = 0; i < maps.length(); i++) { | 213 for (int i = 0; i < maps.length(); i++) { |
226 Map::AddDependentCode(maps.at(i), DependentCode::kWeakCodeGroup, code); | 214 Map::AddDependentCode(maps.at(i), DependentCode::kWeakCodeGroup, code); |
227 } | 215 } |
228 for (int i = 0; i < objects.length(); i++) { | 216 for (int i = 0; i < objects.length(); i++) { |
229 AddWeakObjectToCodeDependency(isolate(), objects.at(i), code); | 217 AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); |
230 } | 218 } |
231 for (int i = 0; i < cells.length(); i++) { | 219 for (int i = 0; i < cells.length(); i++) { |
232 AddWeakObjectToCodeDependency(isolate(), cells.at(i), code); | 220 AddWeakObjectToCodeDependency(isolate()->heap(), cells.at(i), code); |
233 } | 221 } |
234 } | 222 } |
235 | 223 |
236 | 224 |
237 } } // namespace v8::internal | 225 } } // namespace v8::internal |
OLD | NEW |