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(); |
112 case JS_VALUE_TYPE: | 114 case JS_VALUE_TYPE: |
113 JSValue::cast(this)->JSValueVerify(); | 115 JSValue::cast(this)->JSValueVerify(); |
114 break; | 116 break; |
115 case JS_DATE_TYPE: | 117 case JS_DATE_TYPE: |
116 JSDate::cast(this)->JSDateVerify(); | 118 JSDate::cast(this)->JSDateVerify(); |
117 break; | 119 break; |
118 case JS_BOUND_FUNCTION_TYPE: | 120 case JS_BOUND_FUNCTION_TYPE: |
119 JSBoundFunction::cast(this)->JSBoundFunctionVerify(); | 121 JSBoundFunction::cast(this)->JSBoundFunctionVerify(); |
120 break; | 122 break; |
121 case JS_FUNCTION_TYPE: | 123 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 | 472 // 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 | 473 // object is allocated but its fields are all undefined, as it hasn't yet been |
472 // initialized by the generator. Hence these weak checks. | 474 // initialized by the generator. Hence these weak checks. |
473 VerifyObjectField(kFunctionOffset); | 475 VerifyObjectField(kFunctionOffset); |
474 VerifyObjectField(kContextOffset); | 476 VerifyObjectField(kContextOffset); |
475 VerifyObjectField(kReceiverOffset); | 477 VerifyObjectField(kReceiverOffset); |
476 VerifyObjectField(kRegisterFileOffset); | 478 VerifyObjectField(kRegisterFileOffset); |
477 VerifyObjectField(kContinuationOffset); | 479 VerifyObjectField(kContinuationOffset); |
478 } | 480 } |
479 | 481 |
| 482 void JSAsyncGeneratorObject::JSAsyncGeneratorObjectVerify() { |
| 483 // Check inherited fields |
| 484 JSGeneratorObjectVerify(); |
| 485 VerifyObjectField(kQueueOffset); |
| 486 queue()->HeapObjectVerify(); |
| 487 } |
480 | 488 |
481 void JSValue::JSValueVerify() { | 489 void JSValue::JSValueVerify() { |
482 Object* v = value(); | 490 Object* v = value(); |
483 if (v->IsHeapObject()) { | 491 if (v->IsHeapObject()) { |
484 VerifyHeapPointer(v); | 492 VerifyHeapPointer(v); |
485 } | 493 } |
486 } | 494 } |
487 | 495 |
488 | 496 |
489 void JSDate::JSDateVerify() { | 497 void JSDate::JSDateVerify() { |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 deferred_on_resolve()->IsCallable() || | 1058 deferred_on_resolve()->IsCallable() || |
1051 deferred_on_resolve()->IsFixedArray()); | 1059 deferred_on_resolve()->IsFixedArray()); |
1052 CHECK(deferred_on_reject()->IsUndefined(isolate) || | 1060 CHECK(deferred_on_reject()->IsUndefined(isolate) || |
1053 deferred_on_reject()->IsCallable() || | 1061 deferred_on_reject()->IsCallable() || |
1054 deferred_on_reject()->IsFixedArray()); | 1062 deferred_on_reject()->IsFixedArray()); |
1055 VerifySmiField(kDebugIdOffset); | 1063 VerifySmiField(kDebugIdOffset); |
1056 VerifySmiField(kDebugNameOffset); | 1064 VerifySmiField(kDebugNameOffset); |
1057 CHECK(context()->IsContext()); | 1065 CHECK(context()->IsContext()); |
1058 } | 1066 } |
1059 | 1067 |
| 1068 void AsyncGeneratorRequest::AsyncGeneratorRequestVerify() { |
| 1069 CHECK(IsAsyncGeneratorRequest()); |
| 1070 VerifySmiField(kResumeModeOffset); |
| 1071 CHECK_GE(resume_mode(), JSGeneratorObject::kNext); |
| 1072 CHECK_LE(resume_mode(), JSGeneratorObject::kThrow); |
| 1073 CHECK(promise()->IsJSPromise()); |
| 1074 VerifyPointer(value()); |
| 1075 VerifyPointer(next()); |
| 1076 next()->ObjectVerify(); |
| 1077 } |
| 1078 |
1060 void JSModuleNamespace::JSModuleNamespaceVerify() { | 1079 void JSModuleNamespace::JSModuleNamespaceVerify() { |
1061 CHECK(IsJSModuleNamespace()); | 1080 CHECK(IsJSModuleNamespace()); |
1062 VerifyPointer(module()); | 1081 VerifyPointer(module()); |
1063 } | 1082 } |
1064 | 1083 |
1065 void ModuleInfoEntry::ModuleInfoEntryVerify() { | 1084 void ModuleInfoEntry::ModuleInfoEntryVerify() { |
1066 Isolate* isolate = GetIsolate(); | 1085 Isolate* isolate = GetIsolate(); |
1067 CHECK(IsModuleInfoEntry()); | 1086 CHECK(IsModuleInfoEntry()); |
1068 | 1087 |
1069 CHECK(export_name()->IsUndefined(isolate) || export_name()->IsString()); | 1088 CHECK(export_name()->IsUndefined(isolate) || export_name()->IsString()); |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 | 1574 |
1556 // Both are done at the same time. | 1575 // Both are done at the same time. |
1557 CHECK_EQ(new_it.done(), old_it.done()); | 1576 CHECK_EQ(new_it.done(), old_it.done()); |
1558 } | 1577 } |
1559 | 1578 |
1560 | 1579 |
1561 #endif // DEBUG | 1580 #endif // DEBUG |
1562 | 1581 |
1563 } // namespace internal | 1582 } // namespace internal |
1564 } // namespace v8 | 1583 } // namespace v8 |
OLD | NEW |