Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: src/objects-inl.h

Issue 245963007: Clean up some uses of Failures and MaybeObjects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/spaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698