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