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

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: Add comment 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
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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 last_gc_pc = it.rinfo()->pc(); 666 last_gc_pc = it.rinfo()->pc();
667 } 667 }
668 } 668 }
669 CHECK(raw_type_feedback_info() == Smi::FromInt(0) || 669 CHECK(raw_type_feedback_info() == Smi::FromInt(0) ||
670 raw_type_feedback_info()->IsSmi() == IsCodeStubOrIC()); 670 raw_type_feedback_info()->IsSmi() == IsCodeStubOrIC());
671 } 671 }
672 672
673 673
674 void Code::VerifyEmbeddedObjectsDependency() { 674 void Code::VerifyEmbeddedObjectsDependency() {
675 if (!CanContainWeakObjects()) return; 675 if (!CanContainWeakObjects()) return;
676 WeakCell* cell = CachedWeakCell();
676 DisallowHeapAllocation no_gc; 677 DisallowHeapAllocation no_gc;
677 Isolate* isolate = GetIsolate(); 678 Isolate* isolate = GetIsolate();
678 HandleScope scope(isolate); 679 HandleScope scope(isolate);
679 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); 680 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
680 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { 681 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
681 Object* obj = it.rinfo()->target_object(); 682 Object* obj = it.rinfo()->target_object();
682 if (IsWeakObject(obj)) { 683 if (IsWeakObject(obj)) {
683 if (obj->IsMap()) { 684 if (obj->IsMap()) {
684 Map* map = Map::cast(obj); 685 Map* map = Map::cast(obj);
685 CHECK(map->dependent_code()->Contains(DependentCode::kWeakCodeGroup, 686 CHECK(map->dependent_code()->Contains(DependentCode::kWeakCodeGroup,
686 this)); 687 cell));
687 } else if (obj->IsJSObject()) { 688 } else if (obj->IsJSObject()) {
688 Object* raw_table = GetIsolate()->heap()->weak_object_to_code_table(); 689 Object* raw_table = GetIsolate()->heap()->weak_object_to_code_table();
689 WeakHashTable* table = WeakHashTable::cast(raw_table); 690 WeakHashTable* table = WeakHashTable::cast(raw_table);
690 Handle<Object> key_obj(obj, isolate); 691 Handle<Object> key_obj(obj, isolate);
691 CHECK(DependentCode::cast(table->Lookup(key_obj))->Contains( 692 CHECK(DependentCode::cast(table->Lookup(key_obj))
692 DependentCode::kWeakCodeGroup, this)); 693 ->Contains(DependentCode::kWeakCodeGroup, cell));
693 } 694 }
694 } 695 }
695 } 696 }
696 } 697 }
697 698
698 699
699 void JSArray::JSArrayVerify() { 700 void JSArray::JSArrayVerify() {
700 JSObjectVerify(); 701 JSObjectVerify();
701 CHECK(length()->IsNumber() || length()->IsUndefined()); 702 CHECK(length()->IsNumber() || length()->IsUndefined());
702 // If a GC was caused while constructing this array, the elements 703 // If a GC was caused while constructing this array, the elements
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 while (map != heap->roots_array_start()[i++]) { 1251 while (map != heap->roots_array_start()[i++]) {
1251 CHECK_LT(i, Heap::kStrongRootListLength); 1252 CHECK_LT(i, Heap::kStrongRootListLength);
1252 } 1253 }
1253 } 1254 }
1254 } 1255 }
1255 1256
1256 1257
1257 #endif // DEBUG 1258 #endif // DEBUG
1258 1259
1259 } } // namespace v8::internal 1260 } } // namespace v8::internal
OLDNEW
« src/objects.cc ('K') | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698