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/field-type.h" | 10 #include "src/field-type.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 case JS_ERROR_TYPE: | 102 case JS_ERROR_TYPE: |
103 case JS_ARGUMENTS_TYPE: | 103 case JS_ARGUMENTS_TYPE: |
104 case JS_API_OBJECT_TYPE: | 104 case JS_API_OBJECT_TYPE: |
105 case JS_SPECIAL_API_OBJECT_TYPE: | 105 case JS_SPECIAL_API_OBJECT_TYPE: |
106 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: | 106 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
107 JSObject::cast(this)->JSObjectVerify(); | 107 JSObject::cast(this)->JSObjectVerify(); |
108 break; | 108 break; |
109 case JS_GENERATOR_OBJECT_TYPE: | 109 case JS_GENERATOR_OBJECT_TYPE: |
110 JSGeneratorObject::cast(this)->JSGeneratorObjectVerify(); | 110 JSGeneratorObject::cast(this)->JSGeneratorObjectVerify(); |
111 break; | 111 break; |
| 112 case JS_ASYNC_GENERATOR_OBJECT_TYPE: |
| 113 JSAsyncGeneratorObject::cast(this)->JSAsyncGeneratorObjectVerify(); |
| 114 break; |
112 case JS_VALUE_TYPE: | 115 case JS_VALUE_TYPE: |
113 JSValue::cast(this)->JSValueVerify(); | 116 JSValue::cast(this)->JSValueVerify(); |
114 break; | 117 break; |
115 case JS_DATE_TYPE: | 118 case JS_DATE_TYPE: |
116 JSDate::cast(this)->JSDateVerify(); | 119 JSDate::cast(this)->JSDateVerify(); |
117 break; | 120 break; |
118 case JS_BOUND_FUNCTION_TYPE: | 121 case JS_BOUND_FUNCTION_TYPE: |
119 JSBoundFunction::cast(this)->JSBoundFunctionVerify(); | 122 JSBoundFunction::cast(this)->JSBoundFunctionVerify(); |
120 break; | 123 break; |
121 case JS_FUNCTION_TYPE: | 124 case JS_FUNCTION_TYPE: |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 break; | 229 break; |
227 case JS_ARRAY_BUFFER_TYPE: | 230 case JS_ARRAY_BUFFER_TYPE: |
228 JSArrayBuffer::cast(this)->JSArrayBufferVerify(); | 231 JSArrayBuffer::cast(this)->JSArrayBufferVerify(); |
229 break; | 232 break; |
230 case JS_TYPED_ARRAY_TYPE: | 233 case JS_TYPED_ARRAY_TYPE: |
231 JSTypedArray::cast(this)->JSTypedArrayVerify(); | 234 JSTypedArray::cast(this)->JSTypedArrayVerify(); |
232 break; | 235 break; |
233 case JS_DATA_VIEW_TYPE: | 236 case JS_DATA_VIEW_TYPE: |
234 JSDataView::cast(this)->JSDataViewVerify(); | 237 JSDataView::cast(this)->JSDataViewVerify(); |
235 break; | 238 break; |
| 239 case JS_ASYNC_FROM_SYNC_ITERATOR_TYPE: |
| 240 JSAsyncFromSyncIterator::cast(this)->JSAsyncFromSyncIteratorVerify(); |
| 241 break; |
236 | 242 |
237 #define MAKE_STRUCT_CASE(NAME, Name, name) \ | 243 #define MAKE_STRUCT_CASE(NAME, Name, name) \ |
238 case NAME##_TYPE: \ | 244 case NAME##_TYPE: \ |
239 Name::cast(this)->Name##Verify(); \ | 245 Name::cast(this)->Name##Verify(); \ |
240 break; | 246 break; |
241 STRUCT_LIST(MAKE_STRUCT_CASE) | 247 STRUCT_LIST(MAKE_STRUCT_CASE) |
242 #undef MAKE_STRUCT_CASE | 248 #undef MAKE_STRUCT_CASE |
243 | 249 |
244 default: | 250 default: |
245 UNREACHABLE(); | 251 UNREACHABLE(); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 // In an expression like "new g()", there can be a point where a generator | 476 // In an expression like "new g()", there can be a point where a generator |
471 // object is allocated but its fields are all undefined, as it hasn't yet been | 477 // object is allocated but its fields are all undefined, as it hasn't yet been |
472 // initialized by the generator. Hence these weak checks. | 478 // initialized by the generator. Hence these weak checks. |
473 VerifyObjectField(kFunctionOffset); | 479 VerifyObjectField(kFunctionOffset); |
474 VerifyObjectField(kContextOffset); | 480 VerifyObjectField(kContextOffset); |
475 VerifyObjectField(kReceiverOffset); | 481 VerifyObjectField(kReceiverOffset); |
476 VerifyObjectField(kRegisterFileOffset); | 482 VerifyObjectField(kRegisterFileOffset); |
477 VerifyObjectField(kContinuationOffset); | 483 VerifyObjectField(kContinuationOffset); |
478 } | 484 } |
479 | 485 |
| 486 void JSAsyncGeneratorObject::JSAsyncGeneratorObjectVerify() { |
| 487 // Check inherited fields |
| 488 JSGeneratorObjectVerify(); |
| 489 VerifyObjectField(kQueueOffset); |
| 490 queue()->HeapObjectVerify(); |
| 491 } |
480 | 492 |
481 void JSValue::JSValueVerify() { | 493 void JSValue::JSValueVerify() { |
482 Object* v = value(); | 494 Object* v = value(); |
483 if (v->IsHeapObject()) { | 495 if (v->IsHeapObject()) { |
484 VerifyHeapPointer(v); | 496 VerifyHeapPointer(v); |
485 } | 497 } |
486 } | 498 } |
487 | 499 |
488 | 500 |
489 void JSDate::JSDateVerify() { | 501 void JSDate::JSDateVerify() { |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 deferred_on_resolve()->IsCallable() || | 1069 deferred_on_resolve()->IsCallable() || |
1058 deferred_on_resolve()->IsFixedArray()); | 1070 deferred_on_resolve()->IsFixedArray()); |
1059 CHECK(deferred_on_reject()->IsUndefined(isolate) || | 1071 CHECK(deferred_on_reject()->IsUndefined(isolate) || |
1060 deferred_on_reject()->IsCallable() || | 1072 deferred_on_reject()->IsCallable() || |
1061 deferred_on_reject()->IsFixedArray()); | 1073 deferred_on_reject()->IsFixedArray()); |
1062 VerifySmiField(kDebugIdOffset); | 1074 VerifySmiField(kDebugIdOffset); |
1063 VerifySmiField(kDebugNameOffset); | 1075 VerifySmiField(kDebugNameOffset); |
1064 CHECK(context()->IsContext()); | 1076 CHECK(context()->IsContext()); |
1065 } | 1077 } |
1066 | 1078 |
| 1079 void AsyncGeneratorRequest::AsyncGeneratorRequestVerify() { |
| 1080 CHECK(IsAsyncGeneratorRequest()); |
| 1081 VerifySmiField(kResumeModeOffset); |
| 1082 CHECK_GE(resume_mode(), JSGeneratorObject::kNext); |
| 1083 CHECK_LE(resume_mode(), JSGeneratorObject::kThrow); |
| 1084 CHECK(promise()->IsJSPromise()); |
| 1085 VerifyPointer(value()); |
| 1086 VerifyPointer(next()); |
| 1087 next()->ObjectVerify(); |
| 1088 } |
| 1089 |
1067 void JSModuleNamespace::JSModuleNamespaceVerify() { | 1090 void JSModuleNamespace::JSModuleNamespaceVerify() { |
1068 CHECK(IsJSModuleNamespace()); | 1091 CHECK(IsJSModuleNamespace()); |
1069 VerifyPointer(module()); | 1092 VerifyPointer(module()); |
1070 } | 1093 } |
1071 | 1094 |
1072 void ModuleInfoEntry::ModuleInfoEntryVerify() { | 1095 void ModuleInfoEntry::ModuleInfoEntryVerify() { |
1073 Isolate* isolate = GetIsolate(); | 1096 Isolate* isolate = GetIsolate(); |
1074 CHECK(IsModuleInfoEntry()); | 1097 CHECK(IsModuleInfoEntry()); |
1075 | 1098 |
1076 CHECK(export_name()->IsUndefined(isolate) || export_name()->IsString()); | 1099 CHECK(export_name()->IsUndefined(isolate) || export_name()->IsString()); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 VerifyPointer(shared()); | 1289 VerifyPointer(shared()); |
1267 VerifyPointer(debug_bytecode_array()); | 1290 VerifyPointer(debug_bytecode_array()); |
1268 VerifyPointer(break_points()); | 1291 VerifyPointer(break_points()); |
1269 } | 1292 } |
1270 | 1293 |
1271 | 1294 |
1272 void BreakPointInfo::BreakPointInfoVerify() { | 1295 void BreakPointInfo::BreakPointInfoVerify() { |
1273 CHECK(IsBreakPointInfo()); | 1296 CHECK(IsBreakPointInfo()); |
1274 VerifyPointer(break_point_objects()); | 1297 VerifyPointer(break_point_objects()); |
1275 } | 1298 } |
| 1299 |
| 1300 void JSAsyncFromSyncIterator::JSAsyncFromSyncIteratorVerify() { |
| 1301 CHECK(IsJSAsyncFromSyncIterator()); |
| 1302 VerifyHeapPointer(sync_iterator()); |
| 1303 sync_iterator()->HeapObjectVerify(); |
| 1304 } |
1276 #endif // VERIFY_HEAP | 1305 #endif // VERIFY_HEAP |
1277 | 1306 |
1278 #ifdef DEBUG | 1307 #ifdef DEBUG |
1279 | 1308 |
1280 void JSObject::IncrementSpillStatistics(SpillInformation* info) { | 1309 void JSObject::IncrementSpillStatistics(SpillInformation* info) { |
1281 info->number_of_objects_++; | 1310 info->number_of_objects_++; |
1282 // Named properties | 1311 // Named properties |
1283 if (HasFastProperties()) { | 1312 if (HasFastProperties()) { |
1284 info->number_of_objects_with_fast_properties_++; | 1313 info->number_of_objects_with_fast_properties_++; |
1285 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); | 1314 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 | 1591 |
1563 // Both are done at the same time. | 1592 // Both are done at the same time. |
1564 CHECK_EQ(new_it.done(), old_it.done()); | 1593 CHECK_EQ(new_it.done(), old_it.done()); |
1565 } | 1594 } |
1566 | 1595 |
1567 | 1596 |
1568 #endif // DEBUG | 1597 #endif // DEBUG |
1569 | 1598 |
1570 } // namespace internal | 1599 } // namespace internal |
1571 } // namespace v8 | 1600 } // namespace v8 |
OLD | NEW |