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

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

Issue 893073006: Add map-based read barrier to WeakCell Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix merge 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"
11 #include "src/macro-assembler.h" 11 #include "src/macro-assembler.h"
12 #include "src/objects-inl.h"
12 #include "src/ostreams.h" 13 #include "src/ostreams.h"
13 14
14 namespace v8 { 15 namespace v8 {
15 namespace internal { 16 namespace internal {
16 17
17 #ifdef VERIFY_HEAP 18 #ifdef VERIFY_HEAP
18 19
19 void Object::ObjectVerify() { 20 void Object::ObjectVerify() {
20 if (IsSmi()) { 21 if (IsSmi()) {
21 Smi::cast(this)->SmiVerify(); 22 Smi::cast(this)->SmiVerify();
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 641
641 void PropertyCell::PropertyCellVerify() { 642 void PropertyCell::PropertyCellVerify() {
642 CHECK(IsPropertyCell()); 643 CHECK(IsPropertyCell());
643 VerifyObjectField(kValueOffset); 644 VerifyObjectField(kValueOffset);
644 VerifyObjectField(kTypeOffset); 645 VerifyObjectField(kTypeOffset);
645 } 646 }
646 647
647 648
648 void WeakCell::WeakCellVerify() { 649 void WeakCell::WeakCellVerify() {
649 CHECK(IsWeakCell()); 650 CHECK(IsWeakCell());
650 VerifyObjectField(kValueOffset); 651 Object* value = ValueNoReadBarrier();
652 VerifyPointer(value);
651 VerifyObjectField(kNextOffset); 653 VerifyObjectField(kNextOffset);
652 } 654 }
653 655
654 656
655 void Code::CodeVerify() { 657 void Code::CodeVerify() {
656 CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()), 658 CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()),
657 kCodeAlignment)); 659 kCodeAlignment));
658 relocation_info()->ObjectVerify(); 660 relocation_info()->ObjectVerify();
659 Address last_gc_pc = NULL; 661 Address last_gc_pc = NULL;
660 Isolate* isolate = GetIsolate(); 662 Isolate* isolate = GetIsolate();
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 } 1238 }
1237 1239
1238 1240
1239 // Estimates if there is a path from the object to a context. 1241 // Estimates if there is a path from the object to a context.
1240 // This function is not precise, and can return false even if 1242 // This function is not precise, and can return false even if
1241 // there is a path to a context. 1243 // there is a path to a context.
1242 bool CanLeak(Object* obj, Heap* heap, bool skip_weak_cell) { 1244 bool CanLeak(Object* obj, Heap* heap, bool skip_weak_cell) {
1243 if (!obj->IsHeapObject()) return false; 1245 if (!obj->IsHeapObject()) return false;
1244 if (obj->IsWeakCell()) { 1246 if (obj->IsWeakCell()) {
1245 if (skip_weak_cell) return false; 1247 if (skip_weak_cell) return false;
1246 return CanLeak(WeakCell::cast(obj)->value(), heap, skip_weak_cell); 1248 return CanLeak(WeakCell::cast(obj)->value(heap), heap, skip_weak_cell);
1247 } 1249 }
1248 if (obj->IsCell()) { 1250 if (obj->IsCell()) {
1249 return CanLeak(Cell::cast(obj)->value(), heap, skip_weak_cell); 1251 return CanLeak(Cell::cast(obj)->value(), heap, skip_weak_cell);
1250 } 1252 }
1251 if (obj->IsPropertyCell()) { 1253 if (obj->IsPropertyCell()) {
1252 return CanLeak(PropertyCell::cast(obj)->value(), heap, skip_weak_cell); 1254 return CanLeak(PropertyCell::cast(obj)->value(), heap, skip_weak_cell);
1253 } 1255 }
1254 if (obj->IsContext()) return true; 1256 if (obj->IsContext()) return true;
1255 if (obj->IsMap()) { 1257 if (obj->IsMap()) {
1256 Map* map = Map::cast(obj); 1258 Map* map = Map::cast(obj);
(...skipping 17 matching lines...) Expand all
1274 ? it.rinfo()->target_cell() 1276 ? it.rinfo()->target_cell()
1275 : it.rinfo()->target_object(); 1277 : it.rinfo()->target_object();
1276 CHECK(!CanLeak(target, heap, skip_weak_cell)); 1278 CHECK(!CanLeak(target, heap, skip_weak_cell));
1277 } 1279 }
1278 } 1280 }
1279 1281
1280 1282
1281 #endif // DEBUG 1283 #endif // DEBUG
1282 1284
1283 } } // namespace v8::internal 1285 } } // 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