OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 | 367 |
365 | 368 |
366 void JSValue::JSValueVerify() { | 369 void JSValue::JSValueVerify() { |
367 Object* v = value(); | 370 Object* v = value(); |
368 if (v->IsHeapObject()) { | 371 if (v->IsHeapObject()) { |
369 VerifyHeapPointer(v); | 372 VerifyHeapPointer(v); |
370 } | 373 } |
371 } | 374 } |
372 | 375 |
373 | 376 |
377 void JSDate::JSDateVerify() { | |
378 if (value()->IsHeapObject()) { | |
379 VerifyHeapPointer(value()); | |
380 } | |
381 CHECK(value()->IsUndefined() || value()->IsSmi() || value()->IsHeapNumber()); | |
382 CHECK(year()->IsUndefined() || year()->IsSmi() || year()->IsNaN()); | |
383 CHECK(month()->IsUndefined() || month()->IsSmi() || month()->IsNaN()); | |
384 CHECK(day()->IsUndefined() || day()->IsSmi() || day()->IsNaN()); | |
385 CHECK(hour()->IsUndefined() || hour()->IsSmi() || hour()->IsNaN()); | |
386 CHECK(min()->IsUndefined() || min()->IsSmi() || min()->IsNaN()); | |
387 CHECK(sec()->IsUndefined() || sec()->IsSmi() || sec()->IsNaN()); | |
388 CHECK(weekday()->IsUndefined() || weekday()->IsSmi() || weekday()->IsNaN()); | |
rossberg
2012/03/06 15:55:50
This is not checking the stamp field.
Also, you m
ulan
2012/03/07 10:55:21
Done.
| |
389 if (month()->IsSmi()) { | |
390 int month = Smi::cast(this->month())->value(); | |
391 CHECK(0 <= month && month <= 11); | |
392 } | |
393 if (day()->IsSmi()) { | |
394 int day = Smi::cast(this->day())->value(); | |
395 CHECK(1 <= day && day <= 31); | |
396 } | |
397 if (hour()->IsSmi()) { | |
398 int hour = Smi::cast(this->hour())->value(); | |
399 CHECK(0 <= hour && hour <= 23); | |
400 } | |
401 if (min()->IsSmi()) { | |
402 int min = Smi::cast(this->min())->value(); | |
403 CHECK(0 <= min && min <= 59); | |
404 } | |
405 if (sec()->IsSmi()) { | |
406 int sec = Smi::cast(this->sec())->value(); | |
407 CHECK(0 <= sec && sec <= 59); | |
408 } | |
409 if (weekday()->IsSmi()) { | |
410 int weekday = Smi::cast(this->weekday())->value(); | |
411 CHECK(0 <= weekday && weekday <= 6); | |
412 } | |
413 } | |
414 | |
415 | |
374 void JSMessageObject::JSMessageObjectVerify() { | 416 void JSMessageObject::JSMessageObjectVerify() { |
375 CHECK(IsJSMessageObject()); | 417 CHECK(IsJSMessageObject()); |
376 CHECK(type()->IsString()); | 418 CHECK(type()->IsString()); |
377 CHECK(arguments()->IsJSArray()); | 419 CHECK(arguments()->IsJSArray()); |
378 VerifyObjectField(kStartPositionOffset); | 420 VerifyObjectField(kStartPositionOffset); |
379 VerifyObjectField(kEndPositionOffset); | 421 VerifyObjectField(kEndPositionOffset); |
380 VerifyObjectField(kArgumentsOffset); | 422 VerifyObjectField(kArgumentsOffset); |
381 VerifyObjectField(kScriptOffset); | 423 VerifyObjectField(kScriptOffset); |
382 VerifyObjectField(kStackTraceOffset); | 424 VerifyObjectField(kStackTraceOffset); |
383 VerifyObjectField(kStackFramesOffset); | 425 VerifyObjectField(kStackFramesOffset); |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
868 ASSERT(e->IsUndefined()); | 910 ASSERT(e->IsUndefined()); |
869 } | 911 } |
870 } | 912 } |
871 } | 913 } |
872 } | 914 } |
873 | 915 |
874 | 916 |
875 #endif // DEBUG | 917 #endif // DEBUG |
876 | 918 |
877 } } // namespace v8::internal | 919 } } // namespace v8::internal |
OLD | NEW |