};
// Accessor functions called directly from the runtime system.
- static Object* FunctionGetPrototype(Object* object, void*);
- static Object* FunctionSetPrototype(JSObject* object, Object* value, void*);
+ MUST_USE_RESULT static Object* FunctionGetPrototype(Object* object, void*);
+ MUST_USE_RESULT static Object* FunctionSetPrototype(JSObject* object,
+ Object* value,
+ void*);
private:
// Accessor functions only used through the descriptor.
static Object* FunctionGetLength(Object* object, void*);
}
-static Object* AllocateJSArray() {
+MUST_USE_RESULT static Object* AllocateJSArray() {
JSFunction* array_function =
Top::context()->global_context()->array_function();
Object* result = Heap::AllocateJSObject(array_function);
}
-static Object* AllocateEmptyJSArray() {
+MUST_USE_RESULT static Object* AllocateEmptyJSArray() {
Object* result = AllocateJSArray();
if (result->IsFailure()) return result;
JSArray* result_array = JSArray::cast(result);
for (int i = 0; i < array->length(); i++) {
Handle<Object> o(array->get(i));
if (CheckBreakPoint(o)) {
- break_points_hit->SetElement(break_points_hit_count++, *o);
+ SetElement(break_points_hit, break_points_hit_count++, o);
}
}
} else {
if (CheckBreakPoint(break_point_objects)) {
- break_points_hit->SetElement(break_points_hit_count++,
- *break_point_objects);
+ SetElement(break_points_hit,
+ break_points_hit_count++,
+ break_point_objects);
}
}
- // Return undefined if no break points where triggered.
+ // Return undefined if no break points were triggered.
if (break_points_hit_count == 0) {
return Factory::undefined_value();
}
#define TRACK_MEMORY(name)
#endif
-// define used for helping GCC to make better inlining. Don't bother for debug
+// Define used for helping GCC to make better inlining. Don't bother for debug
// builds. On GCC 3.4.5 using __attribute__((always_inline)) causes compilation
// errors in debug build.
#if defined(__GNUC__) && !defined(DEBUG)
#define NO_INLINE(header) header
#endif
+
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define MUST_USE_RESULT __attribute__ ((warn_unused_result))
+#else
+#define MUST_USE_RESULT
+#endif
+
+
// Feature flags bit positions. They are mostly based on the CPUID spec.
// (We assign CPUID itself to one of the currently reserved bits --
// feel free to change this if needed.)
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateJSObject(JSFunction* constructor,
- PretenureFlag pretenure = NOT_TENURED);
+ MUST_USE_RESULT static Object* AllocateJSObject(
+ JSFunction* constructor, PretenureFlag pretenure = NOT_TENURED);
// Allocates and initializes a new global object based on a constructor.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateGlobalObject(JSFunction* constructor);
+ MUST_USE_RESULT static Object* AllocateGlobalObject(JSFunction* constructor);
// Returns a deep copy of the JavaScript object.
// Properties and elements are copied too.
// Returns failure if allocation failed.
- static Object* CopyJSObject(JSObject* source);
+ MUST_USE_RESULT static Object* CopyJSObject(JSObject* source);
// Allocates the function prototype.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateFunctionPrototype(JSFunction* function);
+ MUST_USE_RESULT static Object* AllocateFunctionPrototype(
+ JSFunction* function);
// Reinitialize an JSGlobalProxy based on a constructor. The object
// must have the same size as objects allocated using the
// constructor. The object is reinitialized and behaves as an
// object that has been freshly allocated using the constructor.
- static Object* ReinitializeJSGlobalProxy(JSFunction* constructor,
- JSGlobalProxy* global);
+ MUST_USE_RESULT static Object* ReinitializeJSGlobalProxy(
+ JSFunction* constructor,
+ JSGlobalProxy* global);
// Allocates and initializes a new JavaScript object based on a map.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateJSObjectFromMap(Map* map,
- PretenureFlag pretenure = NOT_TENURED);
+ MUST_USE_RESULT static Object* AllocateJSObjectFromMap(
+ Map* map, PretenureFlag pretenure = NOT_TENURED);
// Allocates a heap object based on the map.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this function does not perform a garbage collection.
- static Object* Allocate(Map* map, AllocationSpace space);
+ MUST_USE_RESULT static Object* Allocate(Map* map, AllocationSpace space);
// Allocates a JS Map in the heap.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this function does not perform a garbage collection.
- static Object* AllocateMap(InstanceType instance_type, int instance_size);
+ MUST_USE_RESULT static Object* AllocateMap(InstanceType instance_type,
+ int instance_size);
// Allocates a partial map for bootstrapping.
- static Object* AllocatePartialMap(InstanceType instance_type,
- int instance_size);
+ MUST_USE_RESULT static Object* AllocatePartialMap(InstanceType instance_type,
+ int instance_size);
// Allocate a map for the specified function
- static Object* AllocateInitialMap(JSFunction* fun);
+ MUST_USE_RESULT static Object* AllocateInitialMap(JSFunction* fun);
// Allocates an empty code cache.
- static Object* AllocateCodeCache();
+ MUST_USE_RESULT static Object* AllocateCodeCache();
// Clear the Instanceof cache (used when a prototype changes).
static void ClearInstanceofCache() {
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateStringFromAscii(
+ MUST_USE_RESULT static Object* AllocateStringFromAscii(
Vector<const char> str,
PretenureFlag pretenure = NOT_TENURED);
- static Object* AllocateStringFromUtf8(
+ MUST_USE_RESULT static Object* AllocateStringFromUtf8(
Vector<const char> str,
PretenureFlag pretenure = NOT_TENURED);
- static Object* AllocateStringFromTwoByte(
+ MUST_USE_RESULT static Object* AllocateStringFromTwoByte(
Vector<const uc16> str,
PretenureFlag pretenure = NOT_TENURED);
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this function does not perform a garbage collection.
- static inline Object* AllocateSymbol(Vector<const char> str,
- int chars,
- uint32_t hash_field);
+ MUST_USE_RESULT static inline Object* AllocateSymbol(Vector<const char> str,
+ int chars,
+ uint32_t hash_field);
- static Object* AllocateInternalSymbol(unibrow::CharacterStream* buffer,
- int chars,
- uint32_t hash_field);
+ MUST_USE_RESULT static Object* AllocateInternalSymbol(
+ unibrow::CharacterStream* buffer, int chars, uint32_t hash_field);
- static Object* AllocateExternalSymbol(Vector<const char> str,
- int chars);
+ MUST_USE_RESULT static Object* AllocateExternalSymbol(Vector<const char> str,
+ int chars);
// Allocates and partially initializes a String. There are two String
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateRawAsciiString(
+ MUST_USE_RESULT static Object* AllocateRawAsciiString(
int length,
PretenureFlag pretenure = NOT_TENURED);
- static Object* AllocateRawTwoByteString(
+ MUST_USE_RESULT static Object* AllocateRawTwoByteString(
int length,
PretenureFlag pretenure = NOT_TENURED);
// A cache is used for ascii codes.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed. Please note this does not perform a garbage collection.
- static Object* LookupSingleCharacterStringFromCode(uint16_t code);
+ MUST_USE_RESULT static Object* LookupSingleCharacterStringFromCode(
+ uint16_t code);
// Allocate a byte array of the specified length
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateByteArray(int length, PretenureFlag pretenure);
+ MUST_USE_RESULT static Object* AllocateByteArray(int length,
+ PretenureFlag pretenure);
// Allocate a non-tenured byte array of the specified length
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateByteArray(int length);
+ MUST_USE_RESULT static Object* AllocateByteArray(int length);
// Allocate a pixel array of the specified length
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocatePixelArray(int length,
- uint8_t* external_pointer,
- PretenureFlag pretenure);
+ MUST_USE_RESULT static Object* AllocatePixelArray(int length,
+ uint8_t* external_pointer,
+ PretenureFlag pretenure);
// Allocates an external array of the specified length and type.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateExternalArray(int length,
- ExternalArrayType array_type,
- void* external_pointer,
- PretenureFlag pretenure);
+ MUST_USE_RESULT static Object* AllocateExternalArray(
+ int length,
+ ExternalArrayType array_type,
+ void* external_pointer,
+ PretenureFlag pretenure);
// Allocate a tenured JS global property cell.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateJSGlobalPropertyCell(Object* value);
+ MUST_USE_RESULT static Object* AllocateJSGlobalPropertyCell(Object* value);
// Allocates a fixed array initialized with undefined values
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateFixedArray(int length, PretenureFlag pretenure);
+ MUST_USE_RESULT static Object* AllocateFixedArray(int length,
+ PretenureFlag pretenure);
// Allocates a fixed array initialized with undefined values
- static Object* AllocateFixedArray(int length);
+ MUST_USE_RESULT static Object* AllocateFixedArray(int length);
// Allocates an uninitialized fixed array. It must be filled by the caller.
//
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateUninitializedFixedArray(int length);
+ MUST_USE_RESULT static Object* AllocateUninitializedFixedArray(int length);
// Make a copy of src and return it. Returns
// Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
- static Object* CopyFixedArray(FixedArray* src);
+ MUST_USE_RESULT static Object* CopyFixedArray(FixedArray* src);
// Allocates a fixed array initialized with the hole values.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateFixedArrayWithHoles(
+ MUST_USE_RESULT static Object* AllocateFixedArrayWithHoles(
int length,
PretenureFlag pretenure = NOT_TENURED);
// AllocateHashTable is identical to AllocateFixedArray except
// that the resulting object has hash_table_map as map.
- static Object* AllocateHashTable(int length,
- PretenureFlag pretenure = NOT_TENURED);
+ MUST_USE_RESULT static Object* AllocateHashTable(
+ int length, PretenureFlag pretenure = NOT_TENURED);
// Allocate a global (but otherwise uninitialized) context.
- static Object* AllocateGlobalContext();
+ MUST_USE_RESULT static Object* AllocateGlobalContext();
// Allocate a function context.
- static Object* AllocateFunctionContext(int length, JSFunction* closure);
+ MUST_USE_RESULT static Object* AllocateFunctionContext(int length,
+ JSFunction* closure);
// Allocate a 'with' context.
- static Object* AllocateWithContext(Context* previous,
- JSObject* extension,
- bool is_catch_context);
+ MUST_USE_RESULT static Object* AllocateWithContext(Context* previous,
+ JSObject* extension,
+ bool is_catch_context);
// Allocates a new utility object in the old generation.
- static Object* AllocateStruct(InstanceType type);
+ MUST_USE_RESULT static Object* AllocateStruct(InstanceType type);
// Allocates a function initialized with a shared part.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateFunction(Map* function_map,
- SharedFunctionInfo* shared,
- Object* prototype,
- PretenureFlag pretenure = TENURED);
+ MUST_USE_RESULT static Object* AllocateFunction(
+ Map* function_map,
+ SharedFunctionInfo* shared,
+ Object* prototype,
+ PretenureFlag pretenure = TENURED);
// Indicies for direct access into argument objects.
static const int kArgumentsObjectSize =
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateArgumentsObject(Object* callee, int length);
+ MUST_USE_RESULT static Object* AllocateArgumentsObject(Object* callee,
+ int length);
// Same as NewNumberFromDouble, but may return a preallocated/immutable
// number object (e.g., minus_zero_value_, nan_value_)
- static Object* NumberFromDouble(double value,
- PretenureFlag pretenure = NOT_TENURED);
+ MUST_USE_RESULT static Object* NumberFromDouble(
+ double value, PretenureFlag pretenure = NOT_TENURED);
// Allocated a HeapNumber from value.
- static Object* AllocateHeapNumber(double value, PretenureFlag pretenure);
- static Object* AllocateHeapNumber(double value); // pretenure = NOT_TENURED
+ MUST_USE_RESULT static Object* AllocateHeapNumber(double value,
+ PretenureFlag pretenure);
+ // pretenure = NOT_TENURED.
+ MUST_USE_RESULT static Object* AllocateHeapNumber(double value);
// Converts an int into either a Smi or a HeapNumber object.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static inline Object* NumberFromInt32(int32_t value);
+ MUST_USE_RESULT static inline Object* NumberFromInt32(int32_t value);
// Converts an int into either a Smi or a HeapNumber object.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static inline Object* NumberFromUint32(uint32_t value);
+ MUST_USE_RESULT static inline Object* NumberFromUint32(uint32_t value);
// Allocates a new proxy object.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateProxy(Address proxy,
- PretenureFlag pretenure = NOT_TENURED);
+ MUST_USE_RESULT static Object* AllocateProxy(
+ Address proxy,
+ PretenureFlag pretenure = NOT_TENURED);
// Allocates a new SharedFunctionInfo object.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateSharedFunctionInfo(Object* name);
+ MUST_USE_RESULT static Object* AllocateSharedFunctionInfo(Object* name);
// Allocates a new cons string object.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateConsString(String* first, String* second);
+ MUST_USE_RESULT static Object* AllocateConsString(String* first,
+ String* second);
// Allocates a new sub string object which is a substring of an underlying
// string buffer stretching from the index start (inclusive) to the index
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateSubString(String* buffer,
- int start,
- int end,
- PretenureFlag pretenure = NOT_TENURED);
+ MUST_USE_RESULT static Object* AllocateSubString(
+ String* buffer,
+ int start,
+ int end,
+ PretenureFlag pretenure = NOT_TENURED);
// Allocate a new external string object, which is backed by a string
// resource that resides outside the V8 heap.
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this does not perform a garbage collection.
- static Object* AllocateExternalStringFromAscii(
+ MUST_USE_RESULT static Object* AllocateExternalStringFromAscii(
ExternalAsciiString::Resource* resource);
- static Object* AllocateExternalStringFromTwoByte(
+ MUST_USE_RESULT static Object* AllocateExternalStringFromTwoByte(
ExternalTwoByteString::Resource* resource);
// Finalizes an external string by deleting the associated external
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this function does not perform a garbage collection.
- static inline Object* AllocateRaw(int size_in_bytes,
- AllocationSpace space,
- AllocationSpace retry_space);
+ MUST_USE_RESULT static inline Object* AllocateRaw(
+ int size_in_bytes,
+ AllocationSpace space,
+ AllocationSpace retry_space);
// Initialize a filler object to keep the ability to iterate over the heap
// when shortening objects.
// self_reference. This allows generated code to reference its own Code
// object by containing this pointer.
// Please note this function does not perform a garbage collection.
- static Object* CreateCode(const CodeDesc& desc,
- Code::Flags flags,
- Handle<Object> self_reference);
+ MUST_USE_RESULT static Object* CreateCode(const CodeDesc& desc,
+ Code::Flags flags,
+ Handle<Object> self_reference);
- static Object* CopyCode(Code* code);
+ MUST_USE_RESULT static Object* CopyCode(Code* code);
// Copy the code and scope info part of the code object, but insert
// the provided data as the relocation information.
- static Object* CopyCode(Code* code, Vector<byte> reloc_info);
+ MUST_USE_RESULT static Object* CopyCode(Code* code, Vector<byte> reloc_info);
// Finds the symbol for string in the symbol table.
// If not found, a new symbol is added to the table and returned.
// Returns Failure::RetryAfterGC(requested_bytes, space) if allocation
// failed.
// Please note this function does not perform a garbage collection.
- static Object* LookupSymbol(Vector<const char> str);
- static Object* LookupAsciiSymbol(const char* str) {
+ MUST_USE_RESULT static Object* LookupSymbol(Vector<const char> str);
+ MUST_USE_RESULT static Object* LookupAsciiSymbol(const char* str) {
return LookupSymbol(CStrVector(str));
}
- static Object* LookupSymbol(String* str);
+ MUST_USE_RESULT static Object* LookupSymbol(String* str);
static bool LookupSymbolIfExists(String* str, String** symbol);
static bool LookupTwoCharsSymbolIfExists(String* str, String** symbol);
// string might stay non-flat even when not a failure is returned.
//
// Please note this function does not perform a garbage collection.
- static inline Object* PrepareForCompare(String* str);
+ MUST_USE_RESULT static inline Object* PrepareForCompare(String* str);
// Converts the given boolean condition to JavaScript boolean value.
static Object* ToBoolean(bool condition) {
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
// failed.
// Please note this function does not perform a garbage collection.
- static Object* CreateSymbol(const char* str, int length, int hash);
- static Object* CreateSymbol(String* str);
+ MUST_USE_RESULT static Object* CreateSymbol(const char* str,
+ int length,
+ int hash);
+ MUST_USE_RESULT static Object* CreateSymbol(String* str);
// Write barrier support for address[offset] = o.
static inline void RecordWrite(Address address, int offset);
static inline int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes);
// Allocate uninitialized fixed array.
- static Object* AllocateRawFixedArray(int length);
- static Object* AllocateRawFixedArray(int length,
- PretenureFlag pretenure);
+ MUST_USE_RESULT static Object* AllocateRawFixedArray(int length);
+ MUST_USE_RESULT static Object* AllocateRawFixedArray(int length,
+ PretenureFlag pretenure);
// True if we have reached the allocation limit in the old generation that
// should force the next GC (caused normally) to be a full one.
kRootListLength
};
- static Object* NumberToString(Object* number,
- bool check_number_string_cache = true);
+ MUST_USE_RESULT static Object* NumberToString(
+ Object* number,
+ bool check_number_string_cache = true);
static Map* MapForExternalArrayType(ExternalArrayType array_type);
static RootListIndex RootIndexForExternalArrayType(
// to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't
// have to test the allocation space argument and (b) can reduce code size
// (since both AllocateRaw and AllocateRawMap are inlined).
- static inline Object* AllocateRawMap();
+ MUST_USE_RESULT static inline Object* AllocateRawMap();
// Allocate an uninitialized object in the global property cell space.
- static inline Object* AllocateRawCell();
+ MUST_USE_RESULT static inline Object* AllocateRawCell();
// Initializes a JSObject based on its map.
static void InitializeJSObjectFromMap(JSObject* obj,
// other parts of the VM could use it. Specifically, a function that creates
// instances of type JS_FUNCTION_TYPE benefit from the use of this function.
// Please note this does not perform a garbage collection.
- static inline Object* InitializeFunction(JSFunction* function,
- SharedFunctionInfo* shared,
- Object* prototype);
+ MUST_USE_RESULT static inline Object* InitializeFunction(
+ JSFunction* function,
+ SharedFunctionInfo* shared,
+ Object* prototype);
static GCTracer* tracer_;
// Returns a heap number with f(input), where f is a math function specified
// by the 'type' argument.
- static inline Object* Get(Type type, double input) {
+ MUST_USE_RESULT static inline Object* Get(Type type, double input) {
TranscendentalCache* cache = caches_[type];
if (cache == NULL) {
caches_[type] = cache = new TranscendentalCache(type);
static void Clear();
private:
- inline Object* Get(double input) {
+ MUST_USE_RESULT inline Object* Get(double input) {
Converter c;
c.dbl = input;
int hash = Hash(c);
Handle<String> name_handle(String::cast(info->name()));
info_wrapper.SetProperties(name_handle, info->start_position(),
info->end_position(), info);
- array->SetElement(i, *(info_wrapper.GetJSArray()));
+ SetElement(array, i, info_wrapper.GetJSArray());
}
}
for (int i = 0; i < array_len; i++) {
if (result->GetElement(i) ==
Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) {
- result->SetElement(i, Smi::FromInt(
- LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK));
+ Handle<Object> replaced(
+ Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK));
+ SetElement(result, i, replaced);
}
}
return NULL;
const int kSetterIndex = 1;
-static Object* CreateJSValue(JSFunction* constructor, Object* value) {
+MUST_USE_RESULT static Object* CreateJSValue(JSFunction* constructor,
+ Object* value) {
Object* result = Heap::AllocateJSObject(constructor);
if (result->IsFailure()) return result;
JSValue::cast(result)->set_value(value);
Object* PrepareElementsForSort(uint32_t limit);
// As PrepareElementsForSort, but only on objects where elements is
// a dictionary, and it will stay a dictionary.
- Object* PrepareSlowElementsForSort(uint32_t limit);
+ MUST_USE_RESULT Object* PrepareSlowElementsForSort(uint32_t limit);
Object* SetProperty(String* key,
Object* value,
// Sets the property value in a normalized object given (key, value, details).
// Handles the special representation of JS global objects.
- Object* SetNormalizedProperty(String* name,
- Object* value,
- PropertyDetails details);
+ MUST_USE_RESULT Object* SetNormalizedProperty(String* name,
+ Object* value,
+ PropertyDetails details);
// Deletes the named property in a normalized object.
- Object* DeleteNormalizedProperty(String* name, DeleteMode mode);
+ MUST_USE_RESULT Object* DeleteNormalizedProperty(String* name,
+ DeleteMode mode);
// Returns the class name ([[Class]] property in the specification).
String* class_name();
String* name);
PropertyAttributes GetLocalPropertyAttribute(String* name);
- Object* DefineAccessor(String* name, bool is_getter, JSFunction* fun,
- PropertyAttributes attributes);
+ MUST_USE_RESULT Object* DefineAccessor(String* name,
+ bool is_getter,
+ JSFunction* fun,
+ PropertyAttributes attributes);
Object* LookupAccessor(String* name, bool is_getter);
- Object* DefineAccessor(AccessorInfo* info);
+ MUST_USE_RESULT Object* DefineAccessor(AccessorInfo* info);
// Used from Object::GetProperty().
Object* GetPropertyWithFailedAccessCheck(Object* receiver,
inline Object* GetHiddenPropertiesObject();
inline Object* SetHiddenPropertiesObject(Object* hidden_obj);
- Object* DeleteProperty(String* name, DeleteMode mode);
- Object* DeleteElement(uint32_t index, DeleteMode mode);
+ MUST_USE_RESULT Object* DeleteProperty(String* name, DeleteMode mode);
+ MUST_USE_RESULT Object* DeleteElement(uint32_t index, DeleteMode mode);
// Tests for the fast common case for property enumeration.
bool IsSimpleEnum();
bool HasElementWithInterceptor(JSObject* receiver, uint32_t index);
bool HasElementPostInterceptor(JSObject* receiver, uint32_t index);
- Object* SetFastElement(uint32_t index, Object* value);
+ MUST_USE_RESULT Object* SetFastElement(uint32_t index, Object* value);
// Set the index'th array element.
// A Failure object is returned if GC is needed.
- Object* SetElement(uint32_t index, Object* value);
+ MUST_USE_RESULT Object* SetElement(uint32_t index, Object* value);
// Returns the index'th element.
// The undefined object if index is out of bounds.
Object* GetElementWithReceiver(JSObject* receiver, uint32_t index);
Object* GetElementWithInterceptor(JSObject* receiver, uint32_t index);
- Object* SetFastElementsCapacityAndLength(int capacity, int length);
- Object* SetSlowElements(Object* length);
+ MUST_USE_RESULT Object* SetFastElementsCapacityAndLength(int capacity,
+ int length);
+ MUST_USE_RESULT Object* SetSlowElements(Object* length);
// Lookup interceptors are used for handling properties controlled by host
// objects.
bool HasRealNamedCallbackProperty(String* key);
// Initializes the array to a certain length
- Object* SetElementsLength(Object* length);
+ MUST_USE_RESULT Object* SetElementsLength(Object* length);
// Get the header size for a JSObject. Used to compute the index of
// internal fields as well as the number of internal fields.
static inline JSObject* cast(Object* obj);
// Disalow further properties to be added to the object.
- Object* PreventExtensions();
+ MUST_USE_RESULT Object* PreventExtensions();
// Dispatched behavior.
uint32_t index,
Object* value,
JSObject* holder);
- Object* SetElementWithInterceptor(uint32_t index, Object* value);
- Object* SetElementWithoutInterceptor(uint32_t index, Object* value);
+ MUST_USE_RESULT Object* SetElementWithInterceptor(uint32_t index,
+ Object* value);
+ MUST_USE_RESULT Object* SetElementWithoutInterceptor(uint32_t index,
+ Object* value);
Object* GetElementPostInterceptor(JSObject* receiver, uint32_t index);
- Object* DeletePropertyPostInterceptor(String* name, DeleteMode mode);
- Object* DeletePropertyWithInterceptor(String* name);
+ MUST_USE_RESULT Object* DeletePropertyPostInterceptor(String* name,
+ DeleteMode mode);
+ MUST_USE_RESULT Object* DeletePropertyWithInterceptor(String* name);
- Object* DeleteElementPostInterceptor(uint32_t index, DeleteMode mode);
- Object* DeleteElementWithInterceptor(uint32_t index);
+ MUST_USE_RESULT Object* DeleteElementPostInterceptor(uint32_t index,
+ DeleteMode mode);
+ MUST_USE_RESULT Object* DeleteElementWithInterceptor(uint32_t index);
PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver,
String* name,
bool HasDenseElements();
bool CanSetCallback(String* name);
- Object* SetElementCallback(uint32_t index,
- Object* structure,
- PropertyAttributes attributes);
- Object* SetPropertyCallback(String* name,
- Object* structure,
- PropertyAttributes attributes);
- Object* DefineGetterSetter(String* name, PropertyAttributes attributes);
+ MUST_USE_RESULT Object* SetElementCallback(uint32_t index,
+ Object* structure,
+ PropertyAttributes attributes);
+ MUST_USE_RESULT Object* SetPropertyCallback(String* name,
+ Object* structure,
+ PropertyAttributes attributes);
+ MUST_USE_RESULT Object* DefineGetterSetter(String* name,
+ PropertyAttributes attributes);
void LookupInDescriptor(String* name, LookupResult* result);
// Copy operations.
inline Object* Copy();
- Object* CopySize(int new_length);
+ MUST_USE_RESULT Object* CopySize(int new_length);
// Add the elements of a JSArray to this FixedArray.
- Object* AddKeysFromJSArray(JSArray* array);
+ MUST_USE_RESULT Object* AddKeysFromJSArray(JSArray* array);
// Compute the union of this and other.
- Object* UnionOfKeys(FixedArray* other);
+ MUST_USE_RESULT Object* UnionOfKeys(FixedArray* other);
// Copy a sub array from the receiver to dest.
void CopyTo(int pos, FixedArray* dest, int dest_pos, int len);
// or null), its enumeration index is kept as is.
// If adding a real property, map transitions must be removed. If adding
// a transition, they must not be removed. All null descriptors are removed.
- Object* CopyInsert(Descriptor* descriptor, TransitionFlag transition_flag);
+ MUST_USE_RESULT Object* CopyInsert(Descriptor* descriptor,
+ TransitionFlag transition_flag);
// Remove all transitions. Return a copy of the array with all transitions
// removed, or a Failure object if the new array could not be allocated.
- Object* RemoveTransitions();
+ MUST_USE_RESULT Object* RemoveTransitions();
// Sort the instance descriptors by the hash codes of their keys.
void Sort();
// Allocates a DescriptorArray, but returns the singleton
// empty descriptor array object if number_of_descriptors is 0.
- static Object* Allocate(int number_of_descriptors);
+ MUST_USE_RESULT static Object* Allocate(int number_of_descriptors);
// Casting.
static inline DescriptorArray* cast(Object* obj);
}
// Returns a new HashTable object. Might return Failure.
- static Object* Allocate(int at_least_space_for,
- PretenureFlag pretenure = NOT_TENURED);
+ MUST_USE_RESULT static Object* Allocate(
+ int at_least_space_for,
+ PretenureFlag pretenure = NOT_TENURED);
// Returns the key at entry.
Object* KeyAt(int entry) { return get(EntryToIndex(entry)); }
}
// Ensure enough space for n additional elements.
- Object* EnsureCapacity(int n, Key key);
+ MUST_USE_RESULT Object* EnsureCapacity(int n, Key key);
};
virtual uint32_t HashForObject(Object* key) = 0;
// Returns the key object for storing into the hash table.
// If allocations fails a failure object is returned.
- virtual Object* AsObject() = 0;
+ MUST_USE_RESULT virtual Object* AsObject() = 0;
// Required.
virtual ~HashTableKey() {}
};
static uint32_t HashForObject(HashTableKey* key, Object* object) {
return key->HashForObject(object);
}
- static Object* AsObject(HashTableKey* key) {
+ MUST_USE_RESULT static Object* AsObject(HashTableKey* key) {
return key->AsObject();
}
return key->HashForObject(object);
}
- static Object* AsObject(HashTableKey* key) {
+ MUST_USE_RESULT static Object* AsObject(HashTableKey* key) {
return key->AsObject();
}
}
// Returns a new array for dictionary usage. Might return Failure.
- static Object* Allocate(int at_least_space_for);
+ MUST_USE_RESULT static Object* Allocate(int at_least_space_for);
// Ensure enough space for n additional elements.
Object* EnsureCapacity(int n, Key key);
static inline bool IsMatch(String* key, Object* other);
static inline uint32_t Hash(String* key);
static inline uint32_t HashForObject(String* key, Object* object);
- static inline Object* AsObject(String* key);
+ MUST_USE_RESULT static inline Object* AsObject(String* key);
static const int kPrefixSize = 2;
static const int kEntrySize = 3;
static const bool kIsEnumerable = true;
static inline bool IsMatch(uint32_t key, Object* other);
static inline uint32_t Hash(uint32_t key);
static inline uint32_t HashForObject(uint32_t key, Object* object);
- static inline Object* AsObject(uint32_t key);
+ MUST_USE_RESULT static inline Object* AsObject(uint32_t key);
static const int kPrefixSize = 2;
static const int kEntrySize = 3;
static const bool kIsEnumerable = false;
// [stub cache]: contains stubs compiled for this map.
DECL_ACCESSORS(code_cache, Object)
- Object* CopyDropDescriptors();
+ MUST_USE_RESULT Object* CopyDropDescriptors();
- Object* CopyNormalized(PropertyNormalizationMode mode);
+ MUST_USE_RESULT Object* CopyNormalized(PropertyNormalizationMode mode);
// Returns a copy of the map, with all transitions dropped from the
// instance descriptors.
- Object* CopyDropTransitions();
+ MUST_USE_RESULT Object* CopyDropTransitions();
// Returns this map if it has the fast elements bit set, otherwise
// returns a copy of the map, with all transitions dropped from the
inline void ClearCodeCache();
// Update code cache.
- Object* UpdateCodeCache(String* name, Code* code);
+ MUST_USE_RESULT Object* UpdateCodeCache(String* name, Code* code);
// Returns the found code or undefined if absent.
Object* FindInCodeCache(String* name, Code::Flags flags);
inline Object* prototype();
inline Object* instance_prototype();
Object* SetInstancePrototype(Object* value);
- Object* SetPrototype(Object* value);
+ MUST_USE_RESULT Object* SetPrototype(Object* value);
// After prototype is removed, it will not be created when accessed, and
// [[Construct]] from this function will not be allowed.
return key->HashForObject(object);
}
- static Object* AsObject(HashTableKey* key) {
+ MUST_USE_RESULT static Object* AsObject(HashTableKey* key) {
return key->AsObject();
}
DECL_ACCESSORS(normal_type_cache, Object)
// Add the code object to the cache.
- Object* Update(String* name, Code* code);
+ MUST_USE_RESULT Object* Update(String* name, Code* code);
// Lookup code object in the cache. Returns code object if found and undefined
// if not.
static const int kSize = kNormalTypeCacheOffset + kPointerSize;
private:
- Object* UpdateDefaultCache(String* name, Code* code);
- Object* UpdateNormalTypeCache(String* name, Code* code);
+ MUST_USE_RESULT Object* UpdateDefaultCache(String* name, Code* code);
+ MUST_USE_RESULT Object* UpdateNormalTypeCache(String* name, Code* code);
Object* LookupDefaultCache(String* name, Code::Flags flags);
Object* LookupNormalTypeCache(String* name, Code::Flags flags);
return key->HashForObject(object);
}
- static Object* AsObject(HashTableKey* key) {
+ MUST_USE_RESULT static Object* AsObject(HashTableKey* key) {
return key->AsObject();
}
HashTableKey*> {
public:
Object* Lookup(String* name, Code::Flags flags);
- Object* Put(String* name, Code* code);
+ MUST_USE_RESULT Object* Put(String* name, Code* code);
int GetIndex(String* name, Code::Flags flags);
void RemoveByIndex(int index);
// is set to a smi. This matches the set function on FixedArray.
inline void set_length(Smi* length);
- Object* JSArrayUpdateLengthFromIndex(uint32_t index, Object* value);
+ MUST_USE_RESULT Object* JSArrayUpdateLengthFromIndex(uint32_t index,
+ Object* value);
// Initialize the array with the given capacity. The function may
// fail due to out-of-memory situations, but only if the requested
// capacity is non-zero.
- Object* Initialize(int capacity);
+ MUST_USE_RESULT Object* Initialize(int capacity);
// Set the content of the array to the content of storage.
inline void SetContent(FixedArray* storage);
for (int i = 0; i < argc; i++) {
Handle<Object> element = arguments[i];
if (!element.is_null()) {
- array->SetFastElement(i, *element);
+ Object* ok = array->SetFastElement(i, *element);
+ USE(ok); // Don't get an unused variable warning.
+ // We know this doesn't cause a GC here because we allocated the JSArray
+ // large enough.
+ ASSERT(!ok->IsFailure());
}
}
ZoneList<Expression*>* args = new ZoneList<Expression*>(2);
static StaticResource<StringInputBuffer> runtime_string_input_buffer;
-static Object* DeepCopyBoilerplate(JSObject* boilerplate) {
+MUST_USE_RESULT static Object* DeepCopyBoilerplate(JSObject* boilerplate) {
StackLimitCheck check;
if (check.HasOverflowed()) return Top::StackOverflow();
context->set(index, *initial_value);
}
} else {
- Handle<JSObject>::cast(holder)->SetElement(index, *initial_value);
+ // The holder is an arguments object.
+ Handle<JSObject> arguments(Handle<JSObject>::cast(holder));
+ SetElement(arguments, index, initial_value);
}
} else {
// Slow case: The property is not in the FixedArray part of the context.
} else {
// The holder is an arguments object.
ASSERT((attributes & READ_ONLY) == 0);
- Handle<JSObject>::cast(holder)->SetElement(index, *value);
+ Handle<JSObject> arguments(Handle<JSObject>::cast(holder));
+ SetElement(arguments, index, value);
}
return *value;
}
if (result.IsProperty() &&
(result.type() == FIELD || result.type() == NORMAL
|| result.type() == CONSTANT_FUNCTION)) {
- obj->DeleteProperty(name, JSObject::NORMAL_DELETION);
+ Object* ok = obj->DeleteProperty(name, JSObject::NORMAL_DELETION);
+ if (ok->IsFailure()) return ok;
}
return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr);
}
// Computes the right stub matching. Inserts the result in the
// cache before returning. This might compile a stub if needed.
- static Object* ComputeLoadNonexistent(String* name, JSObject* receiver);
+ MUST_USE_RESULT static Object* ComputeLoadNonexistent(String* name,
+ JSObject* receiver);
- static Object* ComputeLoadField(String* name,
- JSObject* receiver,
- JSObject* holder,
- int field_index);
+ MUST_USE_RESULT static Object* ComputeLoadField(String* name,
+ JSObject* receiver,
+ JSObject* holder,
+ int field_index);
- static Object* ComputeLoadCallback(String* name,
- JSObject* receiver,
- JSObject* holder,
- AccessorInfo* callback);
+ MUST_USE_RESULT static Object* ComputeLoadCallback(String* name,
+ JSObject* receiver,
+ JSObject* holder,
+ AccessorInfo* callback);
- static Object* ComputeLoadConstant(String* name,
- JSObject* receiver,
- JSObject* holder,
- Object* value);
+ MUST_USE_RESULT static Object* ComputeLoadConstant(String* name,
+ JSObject* receiver,
+ JSObject* holder,
+ Object* value);
- static Object* ComputeLoadInterceptor(String* name,
- JSObject* receiver,
- JSObject* holder);
+ MUST_USE_RESULT static Object* ComputeLoadInterceptor(String* name,
+ JSObject* receiver,
+ JSObject* holder);
- static Object* ComputeLoadNormal();
+ MUST_USE_RESULT static Object* ComputeLoadNormal();
- static Object* ComputeLoadGlobal(String* name,
- JSObject* receiver,
- GlobalObject* holder,
- JSGlobalPropertyCell* cell,
- bool is_dont_delete);
+ MUST_USE_RESULT static Object* ComputeLoadGlobal(String* name,
+ JSObject* receiver,
+ GlobalObject* holder,
+ JSGlobalPropertyCell* cell,
+ bool is_dont_delete);
// ---
- static Object* ComputeKeyedLoadField(String* name,
- JSObject* receiver,
- JSObject* holder,
- int field_index);
+ MUST_USE_RESULT static Object* ComputeKeyedLoadField(String* name,
+ JSObject* receiver,
+ JSObject* holder,
+ int field_index);
- static Object* ComputeKeyedLoadCallback(String* name,
- JSObject* receiver,
- JSObject* holder,
- AccessorInfo* callback);
+ MUST_USE_RESULT static Object* ComputeKeyedLoadCallback(
+ String* name,
+ JSObject* receiver,
+ JSObject* holder,
+ AccessorInfo* callback);
- static Object* ComputeKeyedLoadConstant(String* name, JSObject* receiver,
- JSObject* holder, Object* value);
+ MUST_USE_RESULT static Object* ComputeKeyedLoadConstant(String* name,
+ JSObject* receiver,
+ JSObject* holder,
+ Object* value);
- static Object* ComputeKeyedLoadInterceptor(String* name,
- JSObject* receiver,
- JSObject* holder);
+ MUST_USE_RESULT static Object* ComputeKeyedLoadInterceptor(String* name,
+ JSObject* receiver,
+ JSObject* holder);
- static Object* ComputeKeyedLoadArrayLength(String* name, JSArray* receiver);
+ MUST_USE_RESULT static Object* ComputeKeyedLoadArrayLength(String* name,
+ JSArray* receiver);
- static Object* ComputeKeyedLoadStringLength(String* name,
- String* receiver);
+ MUST_USE_RESULT static Object* ComputeKeyedLoadStringLength(String* name,
+ String* receiver);
- static Object* ComputeKeyedLoadFunctionPrototype(String* name,
- JSFunction* receiver);
+ MUST_USE_RESULT static Object* ComputeKeyedLoadFunctionPrototype(
+ String* name,
+ JSFunction* receiver);
// ---
- static Object* ComputeStoreField(String* name,
- JSObject* receiver,
- int field_index,
- Map* transition = NULL);
+ MUST_USE_RESULT static Object* ComputeStoreField(String* name,
+ JSObject* receiver,
+ int field_index,
+ Map* transition = NULL);
- static Object* ComputeStoreNormal();
+ MUST_USE_RESULT static Object* ComputeStoreNormal();
- static Object* ComputeStoreGlobal(String* name,
- GlobalObject* receiver,
- JSGlobalPropertyCell* cell);
+ MUST_USE_RESULT static Object* ComputeStoreGlobal(String* name,
+ GlobalObject* receiver,
+ JSGlobalPropertyCell* cell);
- static Object* ComputeStoreCallback(String* name,
- JSObject* receiver,
- AccessorInfo* callback);
+ MUST_USE_RESULT static Object* ComputeStoreCallback(String* name,
+ JSObject* receiver,
+ AccessorInfo* callback);
- static Object* ComputeStoreInterceptor(String* name, JSObject* receiver);
+ MUST_USE_RESULT static Object* ComputeStoreInterceptor(String* name,
+ JSObject* receiver);
// ---
- static Object* ComputeKeyedStoreField(String* name,
- JSObject* receiver,
- int field_index,
- Map* transition = NULL);
+ MUST_USE_RESULT static Object* ComputeKeyedStoreField(String* name,
+ JSObject* receiver,
+ int field_index,
+ Map* transition = NULL);
// ---
- static Object* ComputeCallField(int argc,
- InLoopFlag in_loop,
- Code::Kind,
- String* name,
- Object* object,
- JSObject* holder,
- int index);
-
- static Object* ComputeCallConstant(int argc,
- InLoopFlag in_loop,
- Code::Kind,
- String* name,
- Object* object,
- JSObject* holder,
- JSFunction* function);
-
- static Object* ComputeCallNormal(int argc,
- InLoopFlag in_loop,
- Code::Kind,
- String* name,
- JSObject* receiver);
-
- static Object* ComputeCallInterceptor(int argc,
- Code::Kind,
- String* name,
- Object* object,
- JSObject* holder);
-
- static Object* ComputeCallGlobal(int argc,
- InLoopFlag in_loop,
- Code::Kind,
- String* name,
- JSObject* receiver,
- GlobalObject* holder,
- JSGlobalPropertyCell* cell,
- JSFunction* function);
+ MUST_USE_RESULT static Object* ComputeCallField(int argc,
+ InLoopFlag in_loop,
+ Code::Kind,
+ String* name,
+ Object* object,
+ JSObject* holder,
+ int index);
+
+ MUST_USE_RESULT static Object* ComputeCallConstant(int argc,
+ InLoopFlag in_loop,
+ Code::Kind,
+ String* name,
+ Object* object,
+ JSObject* holder,
+ JSFunction* function);
+
+ MUST_USE_RESULT static Object* ComputeCallNormal(int argc,
+ InLoopFlag in_loop,
+ Code::Kind,
+ String* name,
+ JSObject* receiver);
+
+ MUST_USE_RESULT static Object* ComputeCallInterceptor(int argc,
+ Code::Kind,
+ String* name,
+ Object* object,
+ JSObject* holder);
+
+ MUST_USE_RESULT static Object* ComputeCallGlobal(int argc,
+ InLoopFlag in_loop,
+ Code::Kind,
+ String* name,
+ JSObject* receiver,
+ GlobalObject* holder,
+ JSGlobalPropertyCell* cell,
+ JSFunction* function);
// ---
- static Object* ComputeCallInitialize(int argc,
- InLoopFlag in_loop,
- Code::Kind kind);
+ MUST_USE_RESULT static Object* ComputeCallInitialize(int argc,
+ InLoopFlag in_loop,
+ Code::Kind kind);
- static Object* ComputeCallPreMonomorphic(int argc,
- InLoopFlag in_loop,
- Code::Kind kind);
+ MUST_USE_RESULT static Object* ComputeCallPreMonomorphic(int argc,
+ InLoopFlag in_loop,
+ Code::Kind kind);
- static Object* ComputeCallNormal(int argc,
- InLoopFlag in_loop,
- Code::Kind kind);
+ MUST_USE_RESULT static Object* ComputeCallNormal(int argc,
+ InLoopFlag in_loop,
+ Code::Kind kind);
- static Object* ComputeCallMegamorphic(int argc,
- InLoopFlag in_loop,
- Code::Kind kind);
+ MUST_USE_RESULT static Object* ComputeCallMegamorphic(int argc,
+ InLoopFlag in_loop,
+ Code::Kind kind);
- static Object* ComputeCallMiss(int argc, Code::Kind kind);
+ MUST_USE_RESULT static Object* ComputeCallMiss(int argc, Code::Kind kind);
// Finds the Code object stored in the Heap::non_monomorphic_cache().
- static Code* FindCallInitialize(int argc,
- InLoopFlag in_loop,
- Code::Kind kind);
+ MUST_USE_RESULT static Code* FindCallInitialize(int argc,
+ InLoopFlag in_loop,
+ Code::Kind kind);
#ifdef ENABLE_DEBUGGER_SUPPORT
- static Object* ComputeCallDebugBreak(int argc, Code::Kind kind);
+ MUST_USE_RESULT static Object* ComputeCallDebugBreak(int argc,
+ Code::Kind kind);
- static Object* ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind);
+ MUST_USE_RESULT static Object* ComputeCallDebugPrepareStepIn(int argc,
+ Code::Kind kind);
#endif
// Update cache for entry hash(name, map).
// Allocate the object.
Handle<JSObject> object = Factory::NewJSObject(function);
Handle<JSArray> array = Handle<JSArray>::cast(object);
- array->Initialize(0);
+ Object* ok = array->Initialize(0);
+ // We just initialized the VM, no heap allocation failure yet.
+ CHECK(!ok->IsFailure());
// Set array length to 0.
- array->SetElementsLength(Smi::FromInt(0));
+ ok = array->SetElementsLength(Smi::FromInt(0));
+ CHECK(!ok->IsFailure());
CHECK_EQ(Smi::FromInt(0), array->length());
CHECK(array->HasFastElements()); // Must be in fast mode.
// array[length] = name.
- array->SetElement(0, *name);
+ ok = array->SetElement(0, *name);
+ CHECK(!ok->IsFailure());
CHECK_EQ(Smi::FromInt(1), array->length());
CHECK_EQ(array->GetElement(0), *name);
// Set array length with larger than smi value.
Handle<Object> length =
Factory::NewNumberFromUint(static_cast<uint32_t>(Smi::kMaxValue) + 1);
- array->SetElementsLength(*length);
+ ok = array->SetElementsLength(*length);
+ CHECK(!ok->IsFailure());
uint32_t int_length = 0;
CHECK(length->ToArrayIndex(&int_length));
CHECK(array->HasDictionaryElements()); // Must be in slow mode.
// array[length] = name.
- array->SetElement(int_length, *name);
+ ok = array->SetElement(int_length, *name);
+ CHECK(!ok->IsFailure());
uint32_t new_int_length = 0;
CHECK(array->length()->ToArrayIndex(&new_int_length));
CHECK_EQ(static_cast<double>(int_length), new_int_length - 1);
obj->SetProperty(*first, Smi::FromInt(1), NONE);
obj->SetProperty(*second, Smi::FromInt(2), NONE);
- obj->SetElement(0, *first);
- obj->SetElement(1, *second);
+ Object* ok = obj->SetElement(0, *first);
+ CHECK(!ok->IsFailure());
+
+ ok = obj->SetElement(1, *second);
+ CHECK(!ok->IsFailure());
// Make the clone.
Handle<JSObject> clone = Copy(obj);
clone->SetProperty(*first, Smi::FromInt(2), NONE);
clone->SetProperty(*second, Smi::FromInt(1), NONE);
- clone->SetElement(0, *second);
- clone->SetElement(1, *first);
+ ok = clone->SetElement(0, *second);
+ CHECK(!ok->IsFailure());
+ ok = clone->SetElement(1, *first);
+ CHECK(!ok->IsFailure());
CHECK_EQ(obj->GetElement(1), clone->GetElement(0));
CHECK_EQ(obj->GetElement(0), clone->GetElement(1));
assertEquals(7, x);
}
-testAssignmentArgument();
+for (var i = 0; i < 10000; i++) {
+ testAssignmentArgument();
+}
assertEquals(6, x);
__defineSetter__('x', function() { throw 42; });