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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 return HAS_FAILURE_TAG(this); | 642 return HAS_FAILURE_TAG(this); |
643 } | 643 } |
644 | 644 |
645 | 645 |
646 bool MaybeObject::IsRetryAfterGC() { | 646 bool MaybeObject::IsRetryAfterGC() { |
647 return HAS_FAILURE_TAG(this) | 647 return HAS_FAILURE_TAG(this) |
648 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC; | 648 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC; |
649 } | 649 } |
650 | 650 |
651 | 651 |
652 bool MaybeObject::IsOutOfMemory() { | |
653 return HAS_FAILURE_TAG(this) | |
654 && Failure::cast(this)->IsOutOfMemoryException(); | |
655 } | |
656 | |
657 | |
658 bool MaybeObject::IsException() { | 652 bool MaybeObject::IsException() { |
659 return this == Failure::Exception(); | 653 return this == Failure::Exception(); |
660 } | 654 } |
661 | 655 |
662 | 656 |
663 bool MaybeObject::IsTheHole() { | 657 bool MaybeObject::IsTheHole() { |
664 return !IsFailure() && ToObjectUnchecked()->IsTheHole(); | 658 return !IsFailure() && ToObjectUnchecked()->IsTheHole(); |
665 } | 659 } |
666 | 660 |
667 | 661 |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 Failure::Type Failure::type() const { | 1232 Failure::Type Failure::type() const { |
1239 return static_cast<Type>(value() & kFailureTypeTagMask); | 1233 return static_cast<Type>(value() & kFailureTypeTagMask); |
1240 } | 1234 } |
1241 | 1235 |
1242 | 1236 |
1243 bool Failure::IsInternalError() const { | 1237 bool Failure::IsInternalError() const { |
1244 return type() == INTERNAL_ERROR; | 1238 return type() == INTERNAL_ERROR; |
1245 } | 1239 } |
1246 | 1240 |
1247 | 1241 |
1248 bool Failure::IsOutOfMemoryException() const { | |
1249 return type() == OUT_OF_MEMORY_EXCEPTION; | |
1250 } | |
1251 | |
1252 | |
1253 AllocationSpace Failure::allocation_space() const { | 1242 AllocationSpace Failure::allocation_space() const { |
1254 ASSERT_EQ(RETRY_AFTER_GC, type()); | 1243 ASSERT_EQ(RETRY_AFTER_GC, type()); |
1255 return static_cast<AllocationSpace>((value() >> kFailureTypeTagSize) | 1244 return static_cast<AllocationSpace>((value() >> kFailureTypeTagSize) |
1256 & kSpaceTagMask); | 1245 & kSpaceTagMask); |
1257 } | 1246 } |
1258 | 1247 |
1259 | 1248 |
1260 Failure* Failure::InternalError() { | 1249 Failure* Failure::InternalError() { |
1261 return Construct(INTERNAL_ERROR); | 1250 return Construct(INTERNAL_ERROR); |
1262 } | 1251 } |
1263 | 1252 |
1264 | 1253 |
1265 Failure* Failure::Exception() { | 1254 Failure* Failure::Exception() { |
1266 return Construct(EXCEPTION); | 1255 return Construct(EXCEPTION); |
1267 } | 1256 } |
1268 | 1257 |
1269 | 1258 |
1270 Failure* Failure::OutOfMemoryException(intptr_t value) { | |
1271 return Construct(OUT_OF_MEMORY_EXCEPTION, value); | |
1272 } | |
1273 | |
1274 | |
1275 intptr_t Failure::value() const { | 1259 intptr_t Failure::value() const { |
1276 return static_cast<intptr_t>( | 1260 return static_cast<intptr_t>( |
1277 reinterpret_cast<uintptr_t>(this) >> kFailureTagSize); | 1261 reinterpret_cast<uintptr_t>(this) >> kFailureTagSize); |
1278 } | 1262 } |
1279 | 1263 |
1280 | 1264 |
1281 Failure* Failure::RetryAfterGC() { | 1265 Failure* Failure::RetryAfterGC() { |
1282 return RetryAfterGC(NEW_SPACE); | 1266 return RetryAfterGC(NEW_SPACE); |
1283 } | 1267 } |
1284 | 1268 |
(...skipping 5530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6815 #undef READ_UINT32_FIELD | 6799 #undef READ_UINT32_FIELD |
6816 #undef WRITE_UINT32_FIELD | 6800 #undef WRITE_UINT32_FIELD |
6817 #undef READ_SHORT_FIELD | 6801 #undef READ_SHORT_FIELD |
6818 #undef WRITE_SHORT_FIELD | 6802 #undef WRITE_SHORT_FIELD |
6819 #undef READ_BYTE_FIELD | 6803 #undef READ_BYTE_FIELD |
6820 #undef WRITE_BYTE_FIELD | 6804 #undef WRITE_BYTE_FIELD |
6821 | 6805 |
6822 } } // namespace v8::internal | 6806 } } // namespace v8::internal |
6823 | 6807 |
6824 #endif // V8_OBJECTS_INL_H_ | 6808 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |