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

Unified Diff: src/objects.h

Issue 3522008: This is a little experiment to move Failure to a superclass above Object... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ic.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
===================================================================
--- src/objects.h (revision 5559)
+++ src/objects.h (working copy)
@@ -585,13 +585,26 @@
template <class C> static inline bool Is(Object* obj);
+class Object;
+
+
+class TryAllocation BASE_EMBEDDED {
+ public:
+ inline bool ToObject(Object** out) {
+ if (this->IsFailure()) return false;
+ *out = Object::cast(this);
+ return true;
+ }
+};
+
+
// Object is the abstract superclass for all classes in the
// object hierarchy.
// Object does not use any virtual functions to avoid the
// allocation of the C++ vtable.
// Since Smi and Failure are subclasses of Object no
// data members can be present in Object.
-class Object BASE_EMBEDDED {
+class Object : public TryAllocation {
public:
// Type testing.
inline bool IsSmi();
@@ -619,7 +632,6 @@
inline bool IsExternalIntArray();
inline bool IsExternalUnsignedIntArray();
inline bool IsExternalFloatArray();
- inline bool IsFailure();
inline bool IsRetryAfterGC();
inline bool IsOutOfMemoryFailure();
inline bool IsException();
@@ -820,7 +832,7 @@
const int kFailureTypeTagSize = 2;
const int kFailureTypeTagMask = (1 << kFailureTypeTagSize) - 1;
-class Failure: public Object {
+class Failure: public TryAllocation {
public:
// RuntimeStubs assumes EXCEPTION = 1 in the compiler-generated code.
enum Type {
@@ -1282,7 +1294,7 @@
Object* PrepareElementsForSort(uint32_t limit);
// As PrepareElementsForSort, but only on objects where elements is
// a dictionary, and it will stay a dictionary.
- MUST_USE_RESULT Object* PrepareSlowElementsForSort(uint32_t limit);
+ TryAllocation* PrepareSlowElementsForSort(uint32_t limit);
Object* SetProperty(String* key,
Object* value,
« no previous file with comments | « src/ic.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698