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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 return HAS_FAILURE_TAG(this); | 654 return HAS_FAILURE_TAG(this); |
655 } | 655 } |
656 | 656 |
657 | 657 |
658 bool MaybeObject::IsRetryAfterGC() { | 658 bool MaybeObject::IsRetryAfterGC() { |
659 return HAS_FAILURE_TAG(this) | 659 return HAS_FAILURE_TAG(this) |
660 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC; | 660 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC; |
661 } | 661 } |
662 | 662 |
663 | 663 |
664 bool MaybeObject::IsException() { | |
665 return this == Failure::Exception(); | |
666 } | |
667 | |
668 | |
669 Failure* Failure::cast(MaybeObject* obj) { | 664 Failure* Failure::cast(MaybeObject* obj) { |
670 ASSERT(HAS_FAILURE_TAG(obj)); | 665 ASSERT(HAS_FAILURE_TAG(obj)); |
671 return reinterpret_cast<Failure*>(obj); | 666 return reinterpret_cast<Failure*>(obj); |
672 } | 667 } |
673 | 668 |
674 | 669 |
675 bool Object::IsJSReceiver() { | 670 bool Object::IsJSReceiver() { |
676 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | 671 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
677 return IsHeapObject() && | 672 return IsHeapObject() && |
678 HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_RECEIVER_TYPE; | 673 HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_RECEIVER_TYPE; |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 } | 1285 } |
1291 | 1286 |
1292 | 1287 |
1293 AllocationSpace Failure::allocation_space() const { | 1288 AllocationSpace Failure::allocation_space() const { |
1294 ASSERT_EQ(RETRY_AFTER_GC, type()); | 1289 ASSERT_EQ(RETRY_AFTER_GC, type()); |
1295 return static_cast<AllocationSpace>((value() >> kFailureTypeTagSize) | 1290 return static_cast<AllocationSpace>((value() >> kFailureTypeTagSize) |
1296 & kSpaceTagMask); | 1291 & kSpaceTagMask); |
1297 } | 1292 } |
1298 | 1293 |
1299 | 1294 |
1300 Failure* Failure::InternalError() { | |
1301 return Construct(INTERNAL_ERROR); | |
1302 } | |
1303 | |
1304 | |
1305 Failure* Failure::Exception() { | |
1306 return Construct(EXCEPTION); | |
1307 } | |
1308 | |
1309 | |
1310 intptr_t Failure::value() const { | 1295 intptr_t Failure::value() const { |
1311 return static_cast<intptr_t>( | 1296 return static_cast<intptr_t>( |
1312 reinterpret_cast<uintptr_t>(this) >> kFailureTagSize); | 1297 reinterpret_cast<uintptr_t>(this) >> kFailureTagSize); |
1313 } | 1298 } |
1314 | 1299 |
1315 | 1300 |
1316 Failure* Failure::RetryAfterGC() { | 1301 Failure* Failure::RetryAfterGC() { |
1317 return RetryAfterGC(NEW_SPACE); | 1302 return RetryAfterGC(NEW_SPACE); |
1318 } | 1303 } |
1319 | 1304 |
(...skipping 5700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7020 #undef READ_SHORT_FIELD | 7005 #undef READ_SHORT_FIELD |
7021 #undef WRITE_SHORT_FIELD | 7006 #undef WRITE_SHORT_FIELD |
7022 #undef READ_BYTE_FIELD | 7007 #undef READ_BYTE_FIELD |
7023 #undef WRITE_BYTE_FIELD | 7008 #undef WRITE_BYTE_FIELD |
7024 #undef NOBARRIER_READ_BYTE_FIELD | 7009 #undef NOBARRIER_READ_BYTE_FIELD |
7025 #undef NOBARRIER_WRITE_BYTE_FIELD | 7010 #undef NOBARRIER_WRITE_BYTE_FIELD |
7026 | 7011 |
7027 } } // namespace v8::internal | 7012 } } // namespace v8::internal |
7028 | 7013 |
7029 #endif // V8_OBJECTS_INL_H_ | 7014 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |