OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 case ODDBALL_TYPE: | 131 case ODDBALL_TYPE: |
132 Oddball::cast(this)->OddballVerify(); | 132 Oddball::cast(this)->OddballVerify(); |
133 break; | 133 break; |
134 case JS_OBJECT_TYPE: | 134 case JS_OBJECT_TYPE: |
135 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: | 135 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
136 JSObject::cast(this)->JSObjectVerify(); | 136 JSObject::cast(this)->JSObjectVerify(); |
137 break; | 137 break; |
138 case JS_VALUE_TYPE: | 138 case JS_VALUE_TYPE: |
139 JSValue::cast(this)->JSValueVerify(); | 139 JSValue::cast(this)->JSValueVerify(); |
140 break; | 140 break; |
| 141 case JS_DATE_TYPE: |
| 142 JSDate::cast(this)->JSDateVerify(); |
| 143 break; |
141 case JS_FUNCTION_TYPE: | 144 case JS_FUNCTION_TYPE: |
142 JSFunction::cast(this)->JSFunctionVerify(); | 145 JSFunction::cast(this)->JSFunctionVerify(); |
143 break; | 146 break; |
144 case JS_GLOBAL_PROXY_TYPE: | 147 case JS_GLOBAL_PROXY_TYPE: |
145 JSGlobalProxy::cast(this)->JSGlobalProxyVerify(); | 148 JSGlobalProxy::cast(this)->JSGlobalProxyVerify(); |
146 break; | 149 break; |
147 case JS_GLOBAL_OBJECT_TYPE: | 150 case JS_GLOBAL_OBJECT_TYPE: |
148 JSGlobalObject::cast(this)->JSGlobalObjectVerify(); | 151 JSGlobalObject::cast(this)->JSGlobalObjectVerify(); |
149 break; | 152 break; |
150 case JS_BUILTINS_OBJECT_TYPE: | 153 case JS_BUILTINS_OBJECT_TYPE: |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 353 |
351 | 354 |
352 void JSValue::JSValueVerify() { | 355 void JSValue::JSValueVerify() { |
353 Object* v = value(); | 356 Object* v = value(); |
354 if (v->IsHeapObject()) { | 357 if (v->IsHeapObject()) { |
355 VerifyHeapPointer(v); | 358 VerifyHeapPointer(v); |
356 } | 359 } |
357 } | 360 } |
358 | 361 |
359 | 362 |
| 363 void JSDate::JSDateVerify() { |
| 364 if (value()->IsHeapObject()) { |
| 365 VerifyHeapPointer(value()); |
| 366 } |
| 367 CHECK(value()->IsUndefined() || value()->IsSmi() || value()->IsHeapNumber()); |
| 368 /* Don't check yet, will still be undefined... |
| 369 if (value()->IsHeapNumber() && isnan(HeapNumber::cast(value())->value())) { |
| 370 CHECK(year()->IsHeapNumber() && isnan(HeapNumber::cast(year())->value())); |
| 371 CHECK(month()->IsHeapNumber() && isnan(HeapNumber::cast(month())->value())); |
| 372 CHECK(day()->IsHeapNumber() && isnan(HeapNumber::cast(day())->value())); |
| 373 CHECK(hour()->IsHeapNumber() && isnan(HeapNumber::cast(hour())->value())); |
| 374 CHECK(min()->IsHeapNumber() && isnan(HeapNumber::cast(min())->value())); |
| 375 CHECK(sec()->IsHeapNumber() && isnan(HeapNumber::cast(sec())->value())); |
| 376 CHECK(ms()->IsHeapNumber() && isnan(HeapNumber::cast(ms())->value())); |
| 377 return; |
| 378 } |
| 379 CHECK(year()->IsSmi()); |
| 380 CHECK(month()->IsSmi()); |
| 381 CHECK(day()->IsSmi()); |
| 382 CHECK(hour()->IsSmi()); |
| 383 CHECK(min()->IsSmi()); |
| 384 CHECK(sec()->IsSmi()); |
| 385 CHECK(ms()->IsSmi()); |
| 386 int month = Smi::cast(this->month())->value(); |
| 387 int day = Smi::cast(this->day())->value(); |
| 388 int hour = Smi::cast(this->hour())->value(); |
| 389 int min = Smi::cast(this->min())->value(); |
| 390 int sec = Smi::cast(this->sec())->value(); |
| 391 int ms = Smi::cast(this->ms())->value(); |
| 392 CHECK(1 <= month && month <= 12); |
| 393 CHECK(1 <= day && day <= 31); |
| 394 CHECK(0 <= hour && hour <= 23); |
| 395 CHECK(0 <= min && min <= 59); |
| 396 CHECK(0 <= sec && sec <= 59); |
| 397 CHECK(0 <= ms && ms <= 999); |
| 398 */ |
| 399 } |
| 400 |
| 401 |
360 void JSMessageObject::JSMessageObjectVerify() { | 402 void JSMessageObject::JSMessageObjectVerify() { |
361 CHECK(IsJSMessageObject()); | 403 CHECK(IsJSMessageObject()); |
362 CHECK(type()->IsString()); | 404 CHECK(type()->IsString()); |
363 CHECK(arguments()->IsJSArray()); | 405 CHECK(arguments()->IsJSArray()); |
364 VerifyObjectField(kStartPositionOffset); | 406 VerifyObjectField(kStartPositionOffset); |
365 VerifyObjectField(kEndPositionOffset); | 407 VerifyObjectField(kEndPositionOffset); |
366 VerifyObjectField(kArgumentsOffset); | 408 VerifyObjectField(kArgumentsOffset); |
367 VerifyObjectField(kScriptOffset); | 409 VerifyObjectField(kScriptOffset); |
368 VerifyObjectField(kStackTraceOffset); | 410 VerifyObjectField(kStackTraceOffset); |
369 VerifyObjectField(kStackFramesOffset); | 411 VerifyObjectField(kStackFramesOffset); |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 ASSERT(e->IsUndefined()); | 896 ASSERT(e->IsUndefined()); |
855 } | 897 } |
856 } | 898 } |
857 } | 899 } |
858 } | 900 } |
859 | 901 |
860 | 902 |
861 #endif // DEBUG | 903 #endif // DEBUG |
862 | 904 |
863 } } // namespace v8::internal | 905 } } // namespace v8::internal |
OLD | NEW |