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

Side by Side Diff: src/compiler.cc

Issue 917193002: Fix GCMole after b79b985988fd (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Created 5 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
« no previous file with comments | « no previous file | no next file » | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 8
9 #include "src/ast-numbering.h" 9 #include "src/ast-numbering.h"
10 #include "src/ast-this-access-visitor.h" 10 #include "src/ast-this-access-visitor.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 void CompilationInfo::CommitDependencies(Handle<Code> code) { 208 void CompilationInfo::CommitDependencies(Handle<Code> code) {
209 bool has_dependencies = false; 209 bool has_dependencies = false;
210 for (int i = 0; i < DependentCode::kGroupCount; i++) { 210 for (int i = 0; i < DependentCode::kGroupCount; i++) {
211 has_dependencies |= 211 has_dependencies |=
212 dependencies_[i] != NULL && dependencies_[i]->length() > 0; 212 dependencies_[i] != NULL && dependencies_[i]->length() > 0;
213 } 213 }
214 // Avoid creating a weak cell for code with no dependencies. 214 // Avoid creating a weak cell for code with no dependencies.
215 if (!has_dependencies) return; 215 if (!has_dependencies) return;
216 216
217 AllowDeferredHandleDereference get_object_wrapper; 217 AllowDeferredHandleDereference get_object_wrapper;
218 Handle<WeakCell> cell = Code::WeakCellFor(code); 218 WeakCell* cell = *Code::WeakCellFor(code);
219 for (int i = 0; i < DependentCode::kGroupCount; i++) { 219 for (int i = 0; i < DependentCode::kGroupCount; i++) {
220 ZoneList<Handle<HeapObject> >* group_objects = dependencies_[i]; 220 ZoneList<Handle<HeapObject> >* group_objects = dependencies_[i];
221 if (group_objects == NULL) continue; 221 if (group_objects == NULL) continue;
222 DCHECK(!object_wrapper_.is_null()); 222 DCHECK(!object_wrapper_.is_null());
223 for (int j = 0; j < group_objects->length(); j++) { 223 for (int j = 0; j < group_objects->length(); j++) {
224 DependentCode::DependencyGroup group = 224 DependentCode::DependencyGroup group =
225 static_cast<DependentCode::DependencyGroup>(i); 225 static_cast<DependentCode::DependencyGroup>(i);
226 Foreign* info = *object_wrapper();
226 DependentCode* dependent_code = 227 DependentCode* dependent_code =
227 DependentCode::ForObject(group_objects->at(j), group); 228 DependentCode::ForObject(group_objects->at(j), group);
228 dependent_code->UpdateToFinishedCode(group, *object_wrapper(), *cell); 229 dependent_code->UpdateToFinishedCode(group, info, cell);
229 } 230 }
230 dependencies_[i] = NULL; // Zone-allocated, no need to delete. 231 dependencies_[i] = NULL; // Zone-allocated, no need to delete.
231 } 232 }
232 } 233 }
233 234
234 235
235 void CompilationInfo::RollbackDependencies() { 236 void CompilationInfo::RollbackDependencies() {
236 AllowDeferredHandleDereference get_object_wrapper; 237 AllowDeferredHandleDereference get_object_wrapper;
237 // Unregister from all dependent maps if not yet committed. 238 // Unregister from all dependent maps if not yet committed.
238 for (int i = 0; i < DependentCode::kGroupCount; i++) { 239 for (int i = 0; i < DependentCode::kGroupCount; i++) {
239 ZoneList<Handle<HeapObject> >* group_objects = dependencies_[i]; 240 ZoneList<Handle<HeapObject> >* group_objects = dependencies_[i];
240 if (group_objects == NULL) continue; 241 if (group_objects == NULL) continue;
241 for (int j = 0; j < group_objects->length(); j++) { 242 for (int j = 0; j < group_objects->length(); j++) {
242 DependentCode::DependencyGroup group = 243 DependentCode::DependencyGroup group =
243 static_cast<DependentCode::DependencyGroup>(i); 244 static_cast<DependentCode::DependencyGroup>(i);
245 Foreign* info = *object_wrapper();
244 DependentCode* dependent_code = 246 DependentCode* dependent_code =
245 DependentCode::ForObject(group_objects->at(j), group); 247 DependentCode::ForObject(group_objects->at(j), group);
246 dependent_code->RemoveCompilationInfo(group, *object_wrapper()); 248 dependent_code->RemoveCompilationInfo(group, info);
247 } 249 }
248 dependencies_[i] = NULL; // Zone-allocated, no need to delete. 250 dependencies_[i] = NULL; // Zone-allocated, no need to delete.
249 } 251 }
250 } 252 }
251 253
252 254
253 int CompilationInfo::num_parameters() const { 255 int CompilationInfo::num_parameters() const {
254 if (IsStub()) { 256 if (IsStub()) {
255 DCHECK(parameter_count_ > 0); 257 DCHECK(parameter_count_ > 0);
256 return parameter_count_; 258 return parameter_count_;
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 } 1583 }
1582 1584
1583 1585
1584 #if DEBUG 1586 #if DEBUG
1585 void CompilationInfo::PrintAstForTesting() { 1587 void CompilationInfo::PrintAstForTesting() {
1586 PrintF("--- Source from AST ---\n%s\n", 1588 PrintF("--- Source from AST ---\n%s\n",
1587 PrettyPrinter(isolate(), zone()).PrintProgram(function())); 1589 PrettyPrinter(isolate(), zone()).PrintProgram(function()));
1588 } 1590 }
1589 #endif 1591 #endif
1590 } } // namespace v8::internal 1592 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698