OLD | NEW |
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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/disasm.h" | 8 #include "src/disasm.h" |
9 #include "src/disassembler.h" | 9 #include "src/disassembler.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 break; | 112 break; |
113 case JS_FUNCTION_TYPE: | 113 case JS_FUNCTION_TYPE: |
114 JSFunction::cast(this)->JSFunctionVerify(); | 114 JSFunction::cast(this)->JSFunctionVerify(); |
115 break; | 115 break; |
116 case JS_GLOBAL_PROXY_TYPE: | 116 case JS_GLOBAL_PROXY_TYPE: |
117 JSGlobalProxy::cast(this)->JSGlobalProxyVerify(); | 117 JSGlobalProxy::cast(this)->JSGlobalProxyVerify(); |
118 break; | 118 break; |
119 case JS_GLOBAL_OBJECT_TYPE: | 119 case JS_GLOBAL_OBJECT_TYPE: |
120 JSGlobalObject::cast(this)->JSGlobalObjectVerify(); | 120 JSGlobalObject::cast(this)->JSGlobalObjectVerify(); |
121 break; | 121 break; |
122 case JS_BUILTINS_OBJECT_TYPE: | |
123 JSBuiltinsObject::cast(this)->JSBuiltinsObjectVerify(); | |
124 break; | |
125 case CELL_TYPE: | 122 case CELL_TYPE: |
126 Cell::cast(this)->CellVerify(); | 123 Cell::cast(this)->CellVerify(); |
127 break; | 124 break; |
128 case PROPERTY_CELL_TYPE: | 125 case PROPERTY_CELL_TYPE: |
129 PropertyCell::cast(this)->PropertyCellVerify(); | 126 PropertyCell::cast(this)->PropertyCellVerify(); |
130 break; | 127 break; |
131 case WEAK_CELL_TYPE: | 128 case WEAK_CELL_TYPE: |
132 WeakCell::cast(this)->WeakCellVerify(); | 129 WeakCell::cast(this)->WeakCellVerify(); |
133 break; | 130 break; |
134 case JS_ARRAY_TYPE: | 131 case JS_ARRAY_TYPE: |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 JSObjectVerify(); | 560 JSObjectVerify(); |
564 VerifyObjectField(JSGlobalProxy::kNativeContextOffset); | 561 VerifyObjectField(JSGlobalProxy::kNativeContextOffset); |
565 // Make sure that this object has no properties, elements. | 562 // Make sure that this object has no properties, elements. |
566 CHECK_EQ(0, properties()->length()); | 563 CHECK_EQ(0, properties()->length()); |
567 CHECK_EQ(0, FixedArray::cast(elements())->length()); | 564 CHECK_EQ(0, FixedArray::cast(elements())->length()); |
568 } | 565 } |
569 | 566 |
570 | 567 |
571 void JSGlobalObject::JSGlobalObjectVerify() { | 568 void JSGlobalObject::JSGlobalObjectVerify() { |
572 CHECK(IsJSGlobalObject()); | 569 CHECK(IsJSGlobalObject()); |
| 570 // Do not check the dummy global object for the builtins. |
| 571 if (GlobalDictionary::cast(properties())->NumberOfElements() == 0 && |
| 572 elements()->length() == 0) { |
| 573 return; |
| 574 } |
573 JSObjectVerify(); | 575 JSObjectVerify(); |
574 for (int i = GlobalObject::kBuiltinsOffset; | 576 for (int i = GlobalObject::kHeaderSize; i < JSGlobalObject::kSize; |
575 i < JSGlobalObject::kSize; | |
576 i += kPointerSize) { | 577 i += kPointerSize) { |
577 VerifyObjectField(i); | 578 VerifyObjectField(i); |
578 } | 579 } |
579 } | |
580 | |
581 | |
582 void JSBuiltinsObject::JSBuiltinsObjectVerify() { | |
583 CHECK(IsJSBuiltinsObject()); | |
584 JSObjectVerify(); | |
585 for (int i = GlobalObject::kBuiltinsOffset; | |
586 i < JSBuiltinsObject::kSize; | |
587 i += kPointerSize) { | |
588 VerifyObjectField(i); | |
589 } | |
590 } | 580 } |
591 | 581 |
592 | 582 |
593 void Oddball::OddballVerify() { | 583 void Oddball::OddballVerify() { |
594 CHECK(IsOddball()); | 584 CHECK(IsOddball()); |
595 Heap* heap = GetHeap(); | 585 Heap* heap = GetHeap(); |
596 VerifyHeapPointer(to_string()); | 586 VerifyHeapPointer(to_string()); |
597 Object* number = to_number(); | 587 Object* number = to_number(); |
598 if (number->IsHeapObject()) { | 588 if (number->IsHeapObject()) { |
599 CHECK(number == heap->nan_value()); | 589 CHECK(number == heap->nan_value()); |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 | 1313 |
1324 // Both are done at the same time. | 1314 // Both are done at the same time. |
1325 CHECK_EQ(new_it.done(), old_it.done()); | 1315 CHECK_EQ(new_it.done(), old_it.done()); |
1326 } | 1316 } |
1327 | 1317 |
1328 | 1318 |
1329 #endif // DEBUG | 1319 #endif // DEBUG |
1330 | 1320 |
1331 } // namespace internal | 1321 } // namespace internal |
1332 } // namespace v8 | 1322 } // namespace v8 |
OLD | NEW |