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

Side by Side Diff: src/objects-debug.cc

Issue 871253005: Use weak cells in dependent code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments 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 | « src/objects.cc ('k') | 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/disasm.h" 7 #include "src/disasm.h"
8 #include "src/disassembler.h" 8 #include "src/disassembler.h"
9 #include "src/heap/objects-visiting.h" 9 #include "src/heap/objects-visiting.h"
10 #include "src/jsregexp.h" 10 #include "src/jsregexp.h"
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 last_gc_pc = it.rinfo()->pc(); 670 last_gc_pc = it.rinfo()->pc();
671 } 671 }
672 } 672 }
673 CHECK(raw_type_feedback_info() == Smi::FromInt(0) || 673 CHECK(raw_type_feedback_info() == Smi::FromInt(0) ||
674 raw_type_feedback_info()->IsSmi() == IsCodeStubOrIC()); 674 raw_type_feedback_info()->IsSmi() == IsCodeStubOrIC());
675 } 675 }
676 676
677 677
678 void Code::VerifyEmbeddedObjectsDependency() { 678 void Code::VerifyEmbeddedObjectsDependency() {
679 if (!CanContainWeakObjects()) return; 679 if (!CanContainWeakObjects()) return;
680 WeakCell* cell = CachedWeakCell();
680 DisallowHeapAllocation no_gc; 681 DisallowHeapAllocation no_gc;
681 Isolate* isolate = GetIsolate(); 682 Isolate* isolate = GetIsolate();
682 HandleScope scope(isolate); 683 HandleScope scope(isolate);
683 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); 684 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
684 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { 685 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
685 Object* obj = it.rinfo()->target_object(); 686 Object* obj = it.rinfo()->target_object();
686 if (IsWeakObject(obj)) { 687 if (IsWeakObject(obj)) {
687 if (obj->IsMap()) { 688 if (obj->IsMap()) {
688 Map* map = Map::cast(obj); 689 Map* map = Map::cast(obj);
689 CHECK(map->dependent_code()->Contains(DependentCode::kWeakCodeGroup, 690 CHECK(map->dependent_code()->Contains(DependentCode::kWeakCodeGroup,
690 this)); 691 cell));
691 } else if (obj->IsJSObject()) { 692 } else if (obj->IsJSObject()) {
692 Object* raw_table = GetIsolate()->heap()->weak_object_to_code_table(); 693 WeakHashTable* table =
693 WeakHashTable* table = WeakHashTable::cast(raw_table); 694 GetIsolate()->heap()->weak_object_to_code_table();
694 Handle<Object> key_obj(obj, isolate); 695 Handle<HeapObject> key_obj(HeapObject::cast(obj), isolate);
695 CHECK(DependentCode::cast(table->Lookup(key_obj))->Contains( 696 CHECK(DependentCode::cast(table->Lookup(key_obj))
696 DependentCode::kWeakCodeGroup, this)); 697 ->Contains(DependentCode::kWeakCodeGroup, cell));
697 } 698 }
698 } 699 }
699 } 700 }
700 } 701 }
701 702
702 703
703 void JSArray::JSArrayVerify() { 704 void JSArray::JSArrayVerify() {
704 JSObjectVerify(); 705 JSObjectVerify();
705 CHECK(length()->IsNumber() || length()->IsUndefined()); 706 CHECK(length()->IsNumber() || length()->IsUndefined());
706 // If a GC was caused while constructing this array, the elements 707 // If a GC was caused while constructing this array, the elements
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 ? it.rinfo()->target_cell() 1279 ? it.rinfo()->target_cell()
1279 : it.rinfo()->target_object(); 1280 : it.rinfo()->target_object();
1280 CHECK(!CanLeak(target, heap, skip_weak_cell)); 1281 CHECK(!CanLeak(target, heap, skip_weak_cell));
1281 } 1282 }
1282 } 1283 }
1283 1284
1284 1285
1285 #endif // DEBUG 1286 #endif // DEBUG
1286 1287
1287 } } // namespace v8::internal 1288 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698