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 348 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 | 473 // 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 | 474 // object is allocated but its fields are all undefined, as it hasn't yet been |
472 // initialized by the generator. Hence these weak checks. | 475 // initialized by the generator. Hence these weak checks. |
473 VerifyObjectField(kFunctionOffset); | 476 VerifyObjectField(kFunctionOffset); |
474 VerifyObjectField(kContextOffset); | 477 VerifyObjectField(kContextOffset); |
475 VerifyObjectField(kReceiverOffset); | 478 VerifyObjectField(kReceiverOffset); |
476 VerifyObjectField(kRegisterFileOffset); | 479 VerifyObjectField(kRegisterFileOffset); |
477 VerifyObjectField(kContinuationOffset); | 480 VerifyObjectField(kContinuationOffset); |
478 } | 481 } |
479 | 482 |
| 483 void JSAsyncGeneratorObject::JSAsyncGeneratorObjectVerify() { |
| 484 // Check inherited fields |
| 485 JSGeneratorObjectVerify(); |
| 486 VerifyObjectField(kQueueOffset); |
| 487 queue()->HeapObjectVerify(); |
| 488 } |
480 | 489 |
481 void JSValue::JSValueVerify() { | 490 void JSValue::JSValueVerify() { |
482 Object* v = value(); | 491 Object* v = value(); |
483 if (v->IsHeapObject()) { | 492 if (v->IsHeapObject()) { |
484 VerifyHeapPointer(v); | 493 VerifyHeapPointer(v); |
485 } | 494 } |
486 } | 495 } |
487 | 496 |
488 | 497 |
489 void JSDate::JSDateVerify() { | 498 void JSDate::JSDateVerify() { |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 deferred_on_resolve()->IsCallable() || | 1066 deferred_on_resolve()->IsCallable() || |
1058 deferred_on_resolve()->IsFixedArray()); | 1067 deferred_on_resolve()->IsFixedArray()); |
1059 CHECK(deferred_on_reject()->IsUndefined(isolate) || | 1068 CHECK(deferred_on_reject()->IsUndefined(isolate) || |
1060 deferred_on_reject()->IsCallable() || | 1069 deferred_on_reject()->IsCallable() || |
1061 deferred_on_reject()->IsFixedArray()); | 1070 deferred_on_reject()->IsFixedArray()); |
1062 VerifySmiField(kDebugIdOffset); | 1071 VerifySmiField(kDebugIdOffset); |
1063 VerifySmiField(kDebugNameOffset); | 1072 VerifySmiField(kDebugNameOffset); |
1064 CHECK(context()->IsContext()); | 1073 CHECK(context()->IsContext()); |
1065 } | 1074 } |
1066 | 1075 |
| 1076 void AsyncGeneratorRequest::AsyncGeneratorRequestVerify() { |
| 1077 CHECK(IsAsyncGeneratorRequest()); |
| 1078 VerifySmiField(kResumeModeOffset); |
| 1079 CHECK_GE(resume_mode(), JSGeneratorObject::kNext); |
| 1080 CHECK_LE(resume_mode(), JSGeneratorObject::kThrow); |
| 1081 CHECK(promise()->IsJSPromise()); |
| 1082 VerifyPointer(value()); |
| 1083 VerifyPointer(next()); |
| 1084 next()->ObjectVerify(); |
| 1085 } |
| 1086 |
1067 void JSModuleNamespace::JSModuleNamespaceVerify() { | 1087 void JSModuleNamespace::JSModuleNamespaceVerify() { |
1068 CHECK(IsJSModuleNamespace()); | 1088 CHECK(IsJSModuleNamespace()); |
1069 VerifyPointer(module()); | 1089 VerifyPointer(module()); |
1070 } | 1090 } |
1071 | 1091 |
1072 void ModuleInfoEntry::ModuleInfoEntryVerify() { | 1092 void ModuleInfoEntry::ModuleInfoEntryVerify() { |
1073 Isolate* isolate = GetIsolate(); | 1093 Isolate* isolate = GetIsolate(); |
1074 CHECK(IsModuleInfoEntry()); | 1094 CHECK(IsModuleInfoEntry()); |
1075 | 1095 |
1076 CHECK(export_name()->IsUndefined(isolate) || export_name()->IsString()); | 1096 CHECK(export_name()->IsUndefined(isolate) || export_name()->IsString()); |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 | 1582 |
1563 // Both are done at the same time. | 1583 // Both are done at the same time. |
1564 CHECK_EQ(new_it.done(), old_it.done()); | 1584 CHECK_EQ(new_it.done(), old_it.done()); |
1565 } | 1585 } |
1566 | 1586 |
1567 | 1587 |
1568 #endif // DEBUG | 1588 #endif // DEBUG |
1569 | 1589 |
1570 } // namespace internal | 1590 } // namespace internal |
1571 } // namespace v8 | 1591 } // namespace v8 |
OLD | NEW |