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 360 matching lines...) Loading... |
371 if (v->IsHeapObject()) { | 371 if (v->IsHeapObject()) { |
372 VerifyHeapPointer(v); | 372 VerifyHeapPointer(v); |
373 } | 373 } |
374 } | 374 } |
375 | 375 |
376 | 376 |
377 void JSDate::JSDateVerify() { | 377 void JSDate::JSDateVerify() { |
378 if (value()->IsHeapObject()) { | 378 if (value()->IsHeapObject()) { |
379 VerifyHeapPointer(value()); | 379 VerifyHeapPointer(value()); |
380 } | 380 } |
| 381 if (local()->IsHeapObject()) { |
| 382 VerifyHeapPointer(local()); |
| 383 } |
381 CHECK(value()->IsUndefined() || value()->IsSmi() || value()->IsHeapNumber()); | 384 CHECK(value()->IsUndefined() || value()->IsSmi() || value()->IsHeapNumber()); |
382 /* Don't check yet, will still be undefined... | 385 CHECK(local()->IsUndefined() || local()->IsSmi() || local()->IsHeapNumber()); |
383 if (value()->IsHeapNumber() && isnan(HeapNumber::cast(value())->value())) { | 386 CHECK(year()->IsUndefined() || year()->IsSmi() || year()->IsNaN()); |
384 CHECK(year()->IsHeapNumber() && isnan(HeapNumber::cast(year())->value())); | 387 CHECK(month()->IsUndefined() || month()->IsSmi() || month()->IsNaN()); |
385 CHECK(month()->IsHeapNumber() && isnan(HeapNumber::cast(month())->value())); | 388 CHECK(day()->IsUndefined() || day()->IsSmi() || day()->IsNaN()); |
386 CHECK(day()->IsHeapNumber() && isnan(HeapNumber::cast(day())->value())); | 389 CHECK(hour()->IsUndefined() || hour()->IsSmi() || hour()->IsNaN()); |
387 CHECK(hour()->IsHeapNumber() && isnan(HeapNumber::cast(hour())->value())); | 390 CHECK(min()->IsUndefined() || min()->IsSmi() || min()->IsNaN()); |
388 CHECK(min()->IsHeapNumber() && isnan(HeapNumber::cast(min())->value())); | 391 CHECK(sec()->IsUndefined() || sec()->IsSmi() || sec()->IsNaN()); |
389 CHECK(sec()->IsHeapNumber() && isnan(HeapNumber::cast(sec())->value())); | 392 CHECK(weekday()->IsUndefined() || weekday()->IsSmi() || weekday()->IsNaN()); |
390 CHECK(ms()->IsHeapNumber() && isnan(HeapNumber::cast(ms())->value())); | 393 if (month()->IsSmi()) { |
391 return; | 394 int month = Smi::cast(this->month())->value(); |
| 395 CHECK(0 <= month && month <= 11); |
392 } | 396 } |
393 CHECK(year()->IsSmi()); | 397 if (day()->IsSmi()) { |
394 CHECK(month()->IsSmi()); | 398 int day = Smi::cast(this->day())->value(); |
395 CHECK(day()->IsSmi()); | 399 CHECK(1 <= day && day <= 31); |
396 CHECK(hour()->IsSmi()); | 400 } |
397 CHECK(min()->IsSmi()); | 401 if (hour()->IsSmi()) { |
398 CHECK(sec()->IsSmi()); | 402 int hour = Smi::cast(this->hour())->value(); |
399 CHECK(ms()->IsSmi()); | 403 CHECK(0 <= hour && hour <= 23); |
400 int month = Smi::cast(this->month())->value(); | 404 } |
401 int day = Smi::cast(this->day())->value(); | 405 if (min()->IsSmi()) { |
402 int hour = Smi::cast(this->hour())->value(); | 406 int min = Smi::cast(this->min())->value(); |
403 int min = Smi::cast(this->min())->value(); | 407 CHECK(0 <= min && min <= 59); |
404 int sec = Smi::cast(this->sec())->value(); | 408 } |
405 int ms = Smi::cast(this->ms())->value(); | 409 if (sec()->IsSmi()) { |
406 CHECK(1 <= month && month <= 12); | 410 int sec = Smi::cast(this->sec())->value(); |
407 CHECK(1 <= day && day <= 31); | 411 CHECK(0 <= sec && sec <= 59); |
408 CHECK(0 <= hour && hour <= 23); | 412 } |
409 CHECK(0 <= min && min <= 59); | 413 if (weekday()->IsSmi()) { |
410 CHECK(0 <= sec && sec <= 59); | 414 int weekday = Smi::cast(this->weekday())->value(); |
411 CHECK(0 <= ms && ms <= 999); | 415 CHECK(0 <= weekday && weekday <= 6); |
412 */ | 416 } |
413 } | 417 } |
414 | 418 |
415 | 419 |
416 void JSMessageObject::JSMessageObjectVerify() { | 420 void JSMessageObject::JSMessageObjectVerify() { |
417 CHECK(IsJSMessageObject()); | 421 CHECK(IsJSMessageObject()); |
418 CHECK(type()->IsString()); | 422 CHECK(type()->IsString()); |
419 CHECK(arguments()->IsJSArray()); | 423 CHECK(arguments()->IsJSArray()); |
420 VerifyObjectField(kStartPositionOffset); | 424 VerifyObjectField(kStartPositionOffset); |
421 VerifyObjectField(kEndPositionOffset); | 425 VerifyObjectField(kEndPositionOffset); |
422 VerifyObjectField(kArgumentsOffset); | 426 VerifyObjectField(kArgumentsOffset); |
(...skipping 487 matching lines...) Loading... |
910 ASSERT(e->IsUndefined()); | 914 ASSERT(e->IsUndefined()); |
911 } | 915 } |
912 } | 916 } |
913 } | 917 } |
914 } | 918 } |
915 | 919 |
916 | 920 |
917 #endif // DEBUG | 921 #endif // DEBUG |
918 | 922 |
919 } } // namespace v8::internal | 923 } } // namespace v8::internal |
OLD | NEW |