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

Side by Side Diff: src/lithium.cc

Issue 882913006: Make functions contexts in optimized code weak. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | src/objects-inl.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 // 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/lithium.h" 5 #include "src/lithium.h"
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/scopes.h" 9 #include "src/scopes.h"
10 #include "src/serialize.h" 10 #include "src/serialize.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 heap->EnsureWeakObjectToCodeTable(); 420 heap->EnsureWeakObjectToCodeTable();
421 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(object)); 421 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(object));
422 dep = DependentCode::Insert(dep, DependentCode::kWeakCodeGroup, code); 422 dep = DependentCode::Insert(dep, DependentCode::kWeakCodeGroup, code);
423 heap->AddWeakObjectToCodeDependency(object, dep); 423 heap->AddWeakObjectToCodeDependency(object, dep);
424 } 424 }
425 425
426 426
427 void LChunk::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) const { 427 void LChunk::RegisterWeakObjectsInOptimizedCode(Handle<Code> code) const {
428 DCHECK(code->is_optimized_code()); 428 DCHECK(code->is_optimized_code());
429 ZoneList<Handle<Map> > maps(1, zone()); 429 ZoneList<Handle<Map> > maps(1, zone());
430 ZoneList<Handle<JSObject> > objects(1, zone()); 430 ZoneList<Handle<HeapObject> > objects(1, zone());
431 ZoneList<Handle<Cell> > cells(1, zone());
432 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | 431 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
433 RelocInfo::ModeMask(RelocInfo::CELL); 432 RelocInfo::ModeMask(RelocInfo::CELL);
434 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { 433 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
435 RelocInfo::Mode mode = it.rinfo()->rmode(); 434 RelocInfo::Mode mode = it.rinfo()->rmode();
436 if (mode == RelocInfo::CELL && 435 if (mode == RelocInfo::CELL &&
437 code->IsWeakObjectInOptimizedCode(it.rinfo()->target_cell())) { 436 code->IsWeakObjectInOptimizedCode(it.rinfo()->target_cell())) {
438 Handle<Cell> cell(it.rinfo()->target_cell()); 437 objects.Add(Handle<HeapObject>(it.rinfo()->target_cell()), zone());
439 cells.Add(cell, zone());
440 } else if (mode == RelocInfo::EMBEDDED_OBJECT && 438 } else if (mode == RelocInfo::EMBEDDED_OBJECT &&
441 code->IsWeakObjectInOptimizedCode(it.rinfo()->target_object())) { 439 code->IsWeakObjectInOptimizedCode(it.rinfo()->target_object())) {
442 if (it.rinfo()->target_object()->IsMap()) { 440 if (it.rinfo()->target_object()->IsMap()) {
443 Handle<Map> map(Map::cast(it.rinfo()->target_object())); 441 Handle<Map> map(Map::cast(it.rinfo()->target_object()));
444 maps.Add(map, zone()); 442 maps.Add(map, zone());
445 } else if (it.rinfo()->target_object()->IsJSObject()) { 443 } else {
446 Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); 444 Handle<HeapObject> object(
445 HeapObject::cast(it.rinfo()->target_object()));
447 objects.Add(object, zone()); 446 objects.Add(object, zone());
448 } else if (it.rinfo()->target_object()->IsCell()) {
449 Handle<Cell> cell(Cell::cast(it.rinfo()->target_object()));
450 cells.Add(cell, zone());
451 } 447 }
452 } 448 }
453 } 449 }
454 for (int i = 0; i < maps.length(); i++) { 450 for (int i = 0; i < maps.length(); i++) {
455 Map::AddDependentCode(maps.at(i), DependentCode::kWeakCodeGroup, code); 451 Map::AddDependentCode(maps.at(i), DependentCode::kWeakCodeGroup, code);
456 } 452 }
457 for (int i = 0; i < objects.length(); i++) { 453 for (int i = 0; i < objects.length(); i++) {
458 AddWeakObjectToCodeDependency(isolate(), objects.at(i), code); 454 AddWeakObjectToCodeDependency(isolate(), objects.at(i), code);
459 } 455 }
460 for (int i = 0; i < cells.length(); i++) {
461 AddWeakObjectToCodeDependency(isolate(), cells.at(i), code);
462 }
463 if (FLAG_enable_ool_constant_pool) { 456 if (FLAG_enable_ool_constant_pool) {
464 code->constant_pool()->set_weak_object_state( 457 code->constant_pool()->set_weak_object_state(
465 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE); 458 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE);
466 } 459 }
467 code->set_can_have_weak_objects(true); 460 code->set_can_have_weak_objects(true);
468 } 461 }
469 462
470 463
471 void LChunk::CommitDependencies(Handle<Code> code) const { 464 void LChunk::CommitDependencies(Handle<Code> code) const {
472 for (MapSet::const_iterator it = deprecation_dependencies_.begin(), 465 for (MapSet::const_iterator it = deprecation_dependencies_.begin(),
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 714
722 715
723 LPhase::~LPhase() { 716 LPhase::~LPhase() {
724 if (ShouldProduceTraceOutput()) { 717 if (ShouldProduceTraceOutput()) {
725 isolate()->GetHTracer()->TraceLithium(name(), chunk_); 718 isolate()->GetHTracer()->TraceLithium(name(), chunk_);
726 } 719 }
727 } 720 }
728 721
729 722
730 } } // namespace v8::internal 723 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698