Declare more functions returing a MaybeObject* with MUST_USE_RESULT.

No violations found this time.

Additionally I changed one function JSDate::GetField that never returns
a failure to return a Object* instead.
Review URL: https://chromiumcodereview.appspot.com/10383088

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11532 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 132af256
......@@ -424,7 +424,7 @@ class ElementsAccessorBase : public ElementsAccessor {
receiver, holder, key, BackingStore::cast(backing_store));
}
virtual MaybeObject* Get(Object* receiver,
MUST_USE_RESULT virtual MaybeObject* Get(Object* receiver,
JSObject* holder,
uint32_t key,
FixedArrayBase* backing_store) {
......@@ -435,7 +435,7 @@ class ElementsAccessorBase : public ElementsAccessor {
receiver, holder, key, BackingStore::cast(backing_store));
}
static MaybeObject* GetImpl(Object* receiver,
MUST_USE_RESULT static MaybeObject* GetImpl(Object* receiver,
JSObject* obj,
uint32_t key,
BackingStore* backing_store) {
......@@ -444,17 +444,18 @@ class ElementsAccessorBase : public ElementsAccessor {
: backing_store->GetHeap()->the_hole_value();
}
virtual MaybeObject* SetLength(JSArray* array,
MUST_USE_RESULT virtual MaybeObject* SetLength(JSArray* array,
Object* length) {
return ElementsAccessorSubclass::SetLengthImpl(
array, length, BackingStore::cast(array->elements()));
}
static MaybeObject* SetLengthImpl(JSObject* obj,
MUST_USE_RESULT static MaybeObject* SetLengthImpl(
JSObject* obj,
Object* length,
BackingStore* backing_store);
virtual MaybeObject* SetCapacityAndLength(JSArray* array,
MUST_USE_RESULT virtual MaybeObject* SetCapacityAndLength(JSArray* array,
int capacity,
int length) {
return ElementsAccessorSubclass::SetFastElementsCapacityAndLength(
......@@ -463,18 +464,19 @@ class ElementsAccessorBase : public ElementsAccessor {
length);
}
static MaybeObject* SetFastElementsCapacityAndLength(JSObject* obj,
MUST_USE_RESULT static MaybeObject* SetFastElementsCapacityAndLength(
JSObject* obj,
int capacity,
int length) {
UNIMPLEMENTED();
return obj;
}
virtual MaybeObject* Delete(JSObject* obj,
MUST_USE_RESULT virtual MaybeObject* Delete(JSObject* obj,
uint32_t key,
JSReceiver::DeleteMode mode) = 0;
static MaybeObject* CopyElementsImpl(FixedArrayBase* from,
MUST_USE_RESULT static MaybeObject* CopyElementsImpl(FixedArrayBase* from,
uint32_t from_start,
FixedArrayBase* to,
ElementsKind to_kind,
......@@ -484,7 +486,7 @@ class ElementsAccessorBase : public ElementsAccessor {
return NULL;
}
virtual MaybeObject* CopyElements(JSObject* from_holder,
MUST_USE_RESULT virtual MaybeObject* CopyElements(JSObject* from_holder,
uint32_t from_start,
FixedArrayBase* to,
ElementsKind to_kind,
......@@ -501,7 +503,8 @@ class ElementsAccessorBase : public ElementsAccessor {
from, from_start, to, to_kind, to_start, copy_size);
}
virtual MaybeObject* AddElementsToFixedArray(Object* receiver,
MUST_USE_RESULT virtual MaybeObject* AddElementsToFixedArray(
Object* receiver,
JSObject* holder,
FixedArray* to,
FixedArrayBase* from) {
......@@ -866,7 +869,7 @@ class ExternalElementsAccessor
friend class ElementsAccessorBase<ExternalElementsAccessorSubclass,
ElementsKindTraits<Kind> >;
static MaybeObject* GetImpl(Object* receiver,
MUST_USE_RESULT static MaybeObject* GetImpl(Object* receiver,
JSObject* obj,
uint32_t key,
BackingStore* backing_store) {
......@@ -876,7 +879,8 @@ class ExternalElementsAccessor
: backing_store->GetHeap()->undefined_value();
}
static MaybeObject* SetLengthImpl(JSObject* obj,
MUST_USE_RESULT static MaybeObject* SetLengthImpl(
JSObject* obj,
Object* length,
BackingStore* backing_store) {
// External arrays do not support changing their length.
......@@ -884,7 +888,7 @@ class ExternalElementsAccessor
return obj;
}
virtual MaybeObject* Delete(JSObject* obj,
MUST_USE_RESULT virtual MaybeObject* Delete(JSObject* obj,
uint32_t key,
JSReceiver::DeleteMode mode) {
// External arrays always ignore deletes.
......@@ -1002,7 +1006,8 @@ class DictionaryElementsAccessor
// Adjusts the length of the dictionary backing store and returns the new
// length according to ES5 section 15.4.5.2 behavior.
static MaybeObject* SetLengthWithoutNormalize(SeededNumberDictionary* dict,
MUST_USE_RESULT static MaybeObject* SetLengthWithoutNormalize(
SeededNumberDictionary* dict,
JSArray* array,
Object* length_object,
uint32_t length) {
......@@ -1057,7 +1062,8 @@ class DictionaryElementsAccessor
return length_object;
}
static MaybeObject* DeleteCommon(JSObject* obj,
MUST_USE_RESULT static MaybeObject* DeleteCommon(
JSObject* obj,
uint32_t key,
JSReceiver::DeleteMode mode) {
Isolate* isolate = obj->GetIsolate();
......@@ -1102,7 +1108,7 @@ class DictionaryElementsAccessor
return heap->true_value();
}
static MaybeObject* CopyElementsImpl(FixedArrayBase* from,
MUST_USE_RESULT static MaybeObject* CopyElementsImpl(FixedArrayBase* from,
uint32_t from_start,
FixedArrayBase* to,
ElementsKind to_kind,
......@@ -1131,13 +1137,14 @@ class DictionaryElementsAccessor
friend class ElementsAccessorBase<DictionaryElementsAccessor,
ElementsKindTraits<DICTIONARY_ELEMENTS> >;
virtual MaybeObject* Delete(JSObject* obj,
MUST_USE_RESULT virtual MaybeObject* Delete(JSObject* obj,
uint32_t key,
JSReceiver::DeleteMode mode) {
return DeleteCommon(obj, key, mode);
}
static MaybeObject* GetImpl(Object* receiver,
MUST_USE_RESULT static MaybeObject* GetImpl(
Object* receiver,
JSObject* obj,
uint32_t key,
SeededNumberDictionary* backing_store) {
......@@ -1186,7 +1193,7 @@ class NonStrictArgumentsElementsAccessor : public ElementsAccessorBase<
NonStrictArgumentsElementsAccessor,
ElementsKindTraits<NON_STRICT_ARGUMENTS_ELEMENTS> >;
static MaybeObject* GetImpl(Object* receiver,
MUST_USE_RESULT static MaybeObject* GetImpl(Object* receiver,
JSObject* obj,
uint32_t key,
FixedArray* parameter_map) {
......@@ -1216,7 +1223,8 @@ class NonStrictArgumentsElementsAccessor : public ElementsAccessorBase<
}
}
static MaybeObject* SetLengthImpl(JSObject* obj,
MUST_USE_RESULT static MaybeObject* SetLengthImpl(
JSObject* obj,
Object* length,
FixedArray* parameter_map) {
// TODO(mstarzinger): This was never implemented but will be used once we
......@@ -1225,7 +1233,7 @@ class NonStrictArgumentsElementsAccessor : public ElementsAccessorBase<
return obj;
}
virtual MaybeObject* Delete(JSObject* obj,
MUST_USE_RESULT virtual MaybeObject* Delete(JSObject* obj,
uint32_t key,
JSReceiver::DeleteMode mode) {
FixedArray* parameter_map = FixedArray::cast(obj->elements());
......@@ -1246,7 +1254,7 @@ class NonStrictArgumentsElementsAccessor : public ElementsAccessorBase<
return obj->GetHeap()->true_value();
}
static MaybeObject* CopyElementsImpl(FixedArrayBase* from,
MUST_USE_RESULT static MaybeObject* CopyElementsImpl(FixedArrayBase* from,
uint32_t from_start,
FixedArrayBase* to,
ElementsKind to_kind,
......@@ -1354,7 +1362,7 @@ void ElementsAccessor::TearDown() {
template <typename ElementsAccessorSubclass, typename ElementsKindTraits>
MaybeObject* ElementsAccessorBase<ElementsAccessorSubclass,
MUST_USE_RESULT MaybeObject* ElementsAccessorBase<ElementsAccessorSubclass,
ElementsKindTraits>::
SetLengthImpl(JSObject* obj,
Object* length,
......
......@@ -12987,7 +12987,7 @@ int BreakPointInfo::GetBreakPointCount() {
#endif // ENABLE_DEBUGGER_SUPPORT
MaybeObject* JSDate::GetField(Object* object, Smi* index) {
Object* JSDate::GetField(Object* object, Smi* index) {
return JSDate::cast(object)->DoGetField(
static_cast<FieldIndex>(index->value()));
}
......
......@@ -6139,7 +6139,7 @@ class JSDate: public JSObject {
// Returns the date field with the specified index.
// See FieldIndex for the list of date fields.
static MaybeObject* GetField(Object* date, Smi* index);
static Object* GetField(Object* date, Smi* index);
void SetValue(Object* value, bool is_value_nan);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment