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

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

Issue 12217025: For HashTable-backed JS objects, use the proper type in the table() accessor (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 CHECK(length()->IsNumber() || length()->IsUndefined()); 616 CHECK(length()->IsNumber() || length()->IsUndefined());
617 CHECK(elements()->IsUndefined() || 617 CHECK(elements()->IsUndefined() ||
618 elements()->IsFixedArray() || 618 elements()->IsFixedArray() ||
619 elements()->IsFixedDoubleArray()); 619 elements()->IsFixedDoubleArray());
620 } 620 }
621 621
622 622
623 void JSSet::JSSetVerify() { 623 void JSSet::JSSetVerify() {
624 CHECK(IsJSSet()); 624 CHECK(IsJSSet());
625 JSObjectVerify(); 625 JSObjectVerify();
626 VerifyHeapPointer(table()); 626 VerifyObjectField(kTableOffset);
627 CHECK(table()->IsHashTable() || table()->IsUndefined()); 627 Object* table = *RawField(this, kTableOffset);
628 CHECK(table->IsHashTable() || table->IsUndefined());
628 } 629 }
629 630
630 631
631 void JSMap::JSMapVerify() { 632 void JSMap::JSMapVerify() {
632 CHECK(IsJSMap()); 633 CHECK(IsJSMap());
633 JSObjectVerify(); 634 JSObjectVerify();
634 VerifyHeapPointer(table()); 635 VerifyObjectField(kTableOffset);
635 CHECK(table()->IsHashTable() || table()->IsUndefined()); 636 Object* table = *RawField(this, kTableOffset);
637 CHECK(table->IsHashTable() || table->IsUndefined());
636 } 638 }
637 639
638 640
639 void JSWeakMap::JSWeakMapVerify() { 641 void JSWeakMap::JSWeakMapVerify() {
640 CHECK(IsJSWeakMap()); 642 CHECK(IsJSWeakMap());
641 JSObjectVerify(); 643 JSObjectVerify();
642 VerifyHeapPointer(table()); 644 VerifyObjectField(kTableOffset);
643 CHECK(table()->IsHashTable() || table()->IsUndefined()); 645 VerifyObjectField(kNextOffset);
646 Object* table = *RawField(this, kTableOffset);
647 CHECK(table->IsHashTable() || table->IsUndefined());
648 if (next()->IsSmi())
649 CHECK_EQ(0, Smi::cast(next())->value());
650 else
651 CHECK(next()->IsJSWeakMap() || next()->IsUndefined());
644 } 652 }
645 653
646 654
647 void JSRegExp::JSRegExpVerify() { 655 void JSRegExp::JSRegExpVerify() {
648 JSObjectVerify(); 656 JSObjectVerify();
649 CHECK(data()->IsUndefined() || data()->IsFixedArray()); 657 CHECK(data()->IsUndefined() || data()->IsFixedArray());
650 switch (TypeTag()) { 658 switch (TypeTag()) {
651 case JSRegExp::ATOM: { 659 case JSRegExp::ATOM: {
652 FixedArray* arr = FixedArray::cast(data()); 660 FixedArray* arr = FixedArray::cast(data());
653 CHECK(arr->get(JSRegExp::kAtomPatternIndex)->IsString()); 661 CHECK(arr->get(JSRegExp::kAtomPatternIndex)->IsString());
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 for (int i = 0; i < number_of_transitions(); ++i) { 1038 for (int i = 0; i < number_of_transitions(); ++i) {
1031 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; 1039 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false;
1032 } 1040 }
1033 return true; 1041 return true;
1034 } 1042 }
1035 1043
1036 1044
1037 #endif // DEBUG 1045 #endif // DEBUG
1038 1046
1039 } } // namespace v8::internal 1047 } } // 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