Return MaybeHandle from SetElement and DeleteElement.

R=ishell@chromium.org

Review URL: https://codereview.chromium.org/227573002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20560 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2014-04-08 07:04:13 +00:00
parent 4fcc06685f
commit 9ed8c39cac
16 changed files with 305 additions and 300 deletions

View File

@ -3069,13 +3069,8 @@ bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) {
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj = i::JSObject::SetElement(
self,
index,
value_obj,
NONE,
i::SLOPPY);
has_pending_exception = obj.is_null();
has_pending_exception = i::JSObject::SetElement(
self, index, value_obj, NONE, i::SLOPPY).is_null();
EXCEPTION_BAILOUT_CHECK(isolate, false);
return true;
}
@ -3125,8 +3120,9 @@ bool v8::Object::ForceDelete(v8::Handle<Value> key) {
}
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj = i::ForceDeleteProperty(self, key_obj);
has_pending_exception = obj.is_null();
i::Handle<i::Object> obj;
has_pending_exception = !i::Runtime::DeleteObjectProperty(
isolate, self, key_obj, i::JSReceiver::FORCE_DELETION).ToHandle(&obj);
EXCEPTION_BAILOUT_CHECK(isolate, false);
return obj->IsTrue();
}
@ -3358,8 +3354,9 @@ bool v8::Object::Delete(v8::Handle<Value> key) {
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj = i::DeleteProperty(self, key_obj);
has_pending_exception = obj.is_null();
i::Handle<i::Object> obj;
has_pending_exception = !i::Runtime::DeleteObjectProperty(
isolate, self, key_obj, i::JSReceiver::NORMAL_DELETION).ToHandle(&obj);
EXCEPTION_BAILOUT_CHECK(isolate, false);
return obj->IsTrue();
}
@ -3377,8 +3374,9 @@ bool v8::Object::Has(v8::Handle<Value> key) {
i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj = i::HasProperty(self, key_obj);
has_pending_exception = obj.is_null();
i::Handle<i::Object> obj;
has_pending_exception = !i::Runtime::HasObjectProperty(
isolate, self, key_obj).ToHandle(&obj);
EXCEPTION_BAILOUT_CHECK(isolate, false);
return obj->IsTrue();
}
@ -3396,7 +3394,13 @@ bool v8::Object::Delete(uint32_t index) {
ENTER_V8(isolate);
HandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
return i::JSReceiver::DeleteElement(self, index)->IsTrue();
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj;
has_pending_exception =
!i::JSReceiver::DeleteElement(self, index).ToHandle(&obj);
EXCEPTION_BAILOUT_CHECK(isolate, false);
return obj->IsTrue();
}

View File

@ -378,9 +378,9 @@ void ArrayLiteral::BuildConstantElements(Isolate* isolate) {
} else if (boilerplate_value->IsUninitialized()) {
is_simple = false;
JSObject::SetOwnElement(
array, i, handle(Smi::FromInt(0), isolate), SLOPPY);
array, i, handle(Smi::FromInt(0), isolate), SLOPPY).Assert();
} else {
JSObject::SetOwnElement(array, i, boilerplate_value, SLOPPY);
JSObject::SetOwnElement(array, i, boilerplate_value, SLOPPY).Assert();
}
}

View File

@ -144,32 +144,6 @@ Handle<String> FlattenGetString(Handle<String> string) {
}
Handle<Object> DeleteProperty(Handle<JSObject> object, Handle<Object> key) {
Isolate* isolate = object->GetIsolate();
CALL_HEAP_FUNCTION(isolate,
Runtime::DeleteObjectProperty(
isolate, object, key, JSReceiver::NORMAL_DELETION),
Object);
}
Handle<Object> ForceDeleteProperty(Handle<JSObject> object,
Handle<Object> key) {
Isolate* isolate = object->GetIsolate();
CALL_HEAP_FUNCTION(isolate,
Runtime::DeleteObjectProperty(
isolate, object, key, JSReceiver::FORCE_DELETION),
Object);
}
Handle<Object> HasProperty(Handle<JSReceiver> obj, Handle<Object> key) {
Isolate* isolate = obj->GetIsolate();
CALL_HEAP_FUNCTION(isolate,
Runtime::HasObjectProperty(isolate, obj, key), Object);
}
Handle<Object> GetProperty(Handle<JSReceiver> obj,
const char* name) {
Isolate* isolate = obj->GetIsolate();

View File

@ -294,12 +294,6 @@ void FlattenString(Handle<String> str);
// string.
Handle<String> FlattenGetString(Handle<String> str);
Handle<Object> DeleteProperty(Handle<JSObject> object, Handle<Object> key);
Handle<Object> ForceDeleteProperty(Handle<JSObject> object, Handle<Object> key);
Handle<Object> HasProperty(Handle<JSReceiver> obj, Handle<Object> key);
Handle<Object> GetProperty(Handle<JSReceiver> obj, const char* name);
// Get the JS object corresponding to the given script; create it

View File

@ -1226,9 +1226,10 @@ MaybeObject* StoreIC::Store(Handle<Object> object,
// Check if the given name is an array index.
uint32_t index;
if (name->AsArrayIndex(&index)) {
Handle<Object> result =
JSObject::SetElement(receiver, index, value, NONE, strict_mode());
RETURN_IF_EMPTY_HANDLE(isolate(), result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate(), result,
JSObject::SetElement(receiver, index, value, NONE, strict_mode()));
return *value;
}

View File

@ -359,7 +359,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
Handle<Object> value = ParseJsonValue();
if (value.is_null()) return ReportUnexpectedCharacter();
JSObject::SetOwnElement(json_object, index, value, SLOPPY);
JSObject::SetOwnElement(json_object, index, value, SLOPPY).Assert();
continue;
}
// Not an index, fallback to the slow path.

View File

@ -55,10 +55,7 @@ void SetElementSloppy(Handle<JSObject> object,
// Ignore return value from SetElement. It can only be a failure if there
// are element setters causing exceptions and the debugger context has none
// of these.
Handle<Object> no_failure =
JSObject::SetElement(object, index, value, NONE, SLOPPY);
ASSERT(!no_failure.is_null());
USE(no_failure);
JSObject::SetElement(object, index, value, NONE, SLOPPY).Assert();
}

View File

@ -208,10 +208,7 @@ class JSArrayBasedStruct {
protected:
void SetField(int field_position, Handle<Object> value) {
Handle<Object> no_failure =
JSObject::SetElement(array_, field_position, value, NONE, SLOPPY);
ASSERT(!no_failure.is_null());
USE(no_failure);
JSObject::SetElement(array_, field_position, value, NONE, SLOPPY).Assert();
}
void SetSmiValueField(int field_position, int value) {

View File

@ -478,10 +478,14 @@ MaybeObject* JSProxy::GetPropertyWithHandler(Object* receiver_raw,
if (name->IsSymbol()) return isolate->heap()->undefined_value();
Handle<Object> args[] = { receiver, name };
Handle<Object> result = CallTrap(
"get", isolate->derived_get_trap(), ARRAY_SIZE(args), args);
if (isolate->has_pending_exception()) return Failure::Exception();
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
CallTrap(handle(this),
"get",
isolate->derived_get_trap(),
ARRAY_SIZE(args),
args));
return *result;
}
@ -510,11 +514,11 @@ MaybeObject* JSProxy::GetElementWithHandler(Object* receiver,
}
Handle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy,
Handle<JSReceiver> receiver,
uint32_t index,
Handle<Object> value,
StrictMode strict_mode) {
MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy,
Handle<JSReceiver> receiver,
uint32_t index,
Handle<Object> value,
StrictMode strict_mode) {
Isolate* isolate = proxy->GetIsolate();
Handle<String> name = isolate->factory()->Uint32ToString(index);
return SetPropertyWithHandler(
@ -3002,7 +3006,7 @@ Handle<Object> JSReceiver::SetPropertyWithDefinedSetter(
}
Handle<Object> JSObject::SetElementWithCallbackSetterInPrototypes(
MaybeHandle<Object> JSObject::SetElementWithCallbackSetterInPrototypes(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
@ -3555,34 +3559,47 @@ bool JSProxy::HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name) {
if (name->IsSymbol()) return false;
Handle<Object> args[] = { name };
Handle<Object> result = proxy->CallTrap(
"has", isolate->derived_has_trap(), ARRAY_SIZE(args), args);
if (isolate->has_pending_exception()) return false;
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, result,
CallTrap(proxy,
"has",
isolate->derived_has_trap(),
ARRAY_SIZE(args),
args),
false);
return result->BooleanValue();
}
Handle<Object> JSProxy::SetPropertyWithHandler(Handle<JSProxy> proxy,
Handle<JSReceiver> receiver,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode) {
MaybeHandle<Object> JSProxy::SetPropertyWithHandler(
Handle<JSProxy> proxy,
Handle<JSReceiver> receiver,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode) {
Isolate* isolate = proxy->GetIsolate();
// TODO(rossberg): adjust once there is a story for symbols vs proxies.
if (name->IsSymbol()) return value;
Handle<Object> args[] = { receiver, name, value };
proxy->CallTrap("set", isolate->derived_set_trap(), ARRAY_SIZE(args), args);
if (isolate->has_pending_exception()) return Handle<Object>();
RETURN_ON_EXCEPTION(
isolate,
CallTrap(proxy,
"set",
isolate->derived_set_trap(),
ARRAY_SIZE(args),
args),
Object);
return value;
}
Handle<Object> JSProxy::SetPropertyViaPrototypesWithHandler(
MaybeHandle<Object> JSProxy::SetPropertyViaPrototypesWithHandler(
Handle<JSProxy> proxy,
Handle<JSReceiver> receiver,
Handle<Name> name,
@ -3601,9 +3618,15 @@ Handle<Object> JSProxy::SetPropertyViaPrototypesWithHandler(
*done = true; // except where redefined...
Handle<Object> args[] = { name };
Handle<Object> result = proxy->CallTrap(
"getPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args);
if (isolate->has_pending_exception()) return Handle<Object>();
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
CallTrap(proxy,
"getPropertyDescriptor",
Handle<Object>(),
ARRAY_SIZE(args),
args),
Object);
if (result->IsUndefined()) {
*done = false;
@ -3616,7 +3639,7 @@ Handle<Object> JSProxy::SetPropertyViaPrototypesWithHandler(
Handle<Object> desc = Execution::Call(
isolate, isolate->to_complete_property_descriptor(), result,
ARRAY_SIZE(argv), argv, &has_pending_exception);
if (has_pending_exception) return Handle<Object>();
if (has_pending_exception) return MaybeHandle<Object>();
// [[GetProperty]] requires to check that all properties are configurable.
Handle<String> configurable_name =
@ -3632,8 +3655,7 @@ Handle<Object> JSProxy::SetPropertyViaPrototypesWithHandler(
Handle<Object> args[] = { handler, trap, name };
Handle<Object> error = isolate->factory()->NewTypeError(
"proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args)));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
ASSERT(configurable->IsTrue());
@ -3657,8 +3679,7 @@ Handle<Object> JSProxy::SetPropertyViaPrototypesWithHandler(
Handle<Object> args[] = { name, receiver };
Handle<Object> error = isolate->factory()->NewTypeError(
"strict_read_only_property", HandleVector(args, ARRAY_SIZE(args)));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
// We have an AccessorDescriptor.
@ -3676,12 +3697,11 @@ Handle<Object> JSProxy::SetPropertyViaPrototypesWithHandler(
Handle<Object> args2[] = { name, proxy };
Handle<Object> error = isolate->factory()->NewTypeError(
"no_setter_in_callback", HandleVector(args2, ARRAY_SIZE(args2)));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
Handle<Object> JSProxy::DeletePropertyWithHandler(
MaybeHandle<Object> JSProxy::DeletePropertyWithHandler(
Handle<JSProxy> proxy, Handle<Name> name, DeleteMode mode) {
Isolate* isolate = proxy->GetIsolate();
@ -3689,9 +3709,15 @@ Handle<Object> JSProxy::DeletePropertyWithHandler(
if (name->IsSymbol()) return isolate->factory()->false_value();
Handle<Object> args[] = { name };
Handle<Object> result = proxy->CallTrap(
"delete", Handle<Object>(), ARRAY_SIZE(args), args);
if (isolate->has_pending_exception()) return Handle<Object>();
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
CallTrap(proxy,
"delete",
Handle<Object>(),
ARRAY_SIZE(args),
args),
Object);
bool result_bool = result->BooleanValue();
if (mode == STRICT_DELETION && !result_bool) {
@ -3701,14 +3727,13 @@ Handle<Object> JSProxy::DeletePropertyWithHandler(
Handle<Object> args[] = { handler, trap_name };
Handle<Object> error = isolate->factory()->NewTypeError(
"handler_failed", HandleVector(args, ARRAY_SIZE(args)));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
return isolate->factory()->ToBoolean(result_bool);
}
Handle<Object> JSProxy::DeleteElementWithHandler(
MaybeHandle<Object> JSProxy::DeleteElementWithHandler(
Handle<JSProxy> proxy, uint32_t index, DeleteMode mode) {
Isolate* isolate = proxy->GetIsolate();
Handle<String> name = isolate->factory()->Uint32ToString(index);
@ -3727,9 +3752,15 @@ PropertyAttributes JSProxy::GetPropertyAttributeWithHandler(
if (name->IsSymbol()) return ABSENT;
Handle<Object> args[] = { name };
Handle<Object> result = proxy->CallTrap(
"getPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args);
if (isolate->has_pending_exception()) return NONE;
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, result,
proxy->CallTrap(proxy,
"getPropertyDescriptor",
Handle<Object>(),
ARRAY_SIZE(args),
args),
NONE);
if (result->IsUndefined()) return ABSENT;
@ -3768,7 +3799,7 @@ PropertyAttributes JSProxy::GetPropertyAttributeWithHandler(
Handle<Object> args[] = { handler, trap, name };
Handle<Object> error = isolate->factory()->NewTypeError(
"proxy_prop_not_configurable", HandleVector(args, ARRAY_SIZE(args)));
isolate->Throw(*error);
isolate->Throw<Object>(error);
return NONE;
}
@ -3812,24 +3843,24 @@ void JSProxy::Fix(Handle<JSProxy> proxy) {
}
MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name,
Handle<Object> derived,
int argc,
Handle<Object> argv[]) {
Isolate* isolate = GetIsolate();
Handle<Object> handler(this->handler(), isolate);
MaybeHandle<Object> JSProxy::CallTrap(Handle<JSProxy> proxy,
const char* name,
Handle<Object> derived,
int argc,
Handle<Object> argv[]) {
Isolate* isolate = proxy->GetIsolate();
Handle<Object> handler(proxy->handler(), isolate);
Handle<String> trap_name = isolate->factory()->InternalizeUtf8String(name);
Handle<Object> trap = Object::GetPropertyOrElement(handler, trap_name);
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, trap, Handle<Object>());
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, trap, MaybeHandle<Object>());
if (trap->IsUndefined()) {
if (derived.is_null()) {
Handle<Object> args[] = { handler, trap_name };
Handle<Object> error = isolate->factory()->NewTypeError(
"handler_trap_missing", HandleVector(args, ARRAY_SIZE(args)));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
trap = Handle<Object>(derived);
}
@ -5293,9 +5324,9 @@ Handle<Object> JSObject::DeleteProperty(Handle<JSObject> object,
}
Handle<Object> JSReceiver::DeleteElement(Handle<JSReceiver> object,
uint32_t index,
DeleteMode mode) {
MaybeHandle<Object> JSReceiver::DeleteElement(Handle<JSReceiver> object,
uint32_t index,
DeleteMode mode) {
if (object->IsJSProxy()) {
return JSProxy::DeleteElementWithHandler(
Handle<JSProxy>::cast(object), index, mode);
@ -5304,9 +5335,9 @@ Handle<Object> JSReceiver::DeleteElement(Handle<JSReceiver> object,
}
Handle<Object> JSReceiver::DeleteProperty(Handle<JSReceiver> object,
Handle<Name> name,
DeleteMode mode) {
MaybeHandle<Object> JSReceiver::DeleteProperty(Handle<JSReceiver> object,
Handle<Name> name,
DeleteMode mode) {
if (object->IsJSProxy()) {
return JSProxy::DeletePropertyWithHandler(
Handle<JSProxy>::cast(object), name, mode);
@ -11450,8 +11481,8 @@ Handle<Object> JSArray::SetElementsLength(Handle<JSArray> array,
// Skip deletions where the property was an accessor, leaving holes
// in the array of old values.
if (old_values[i]->IsTheHole()) continue;
JSObject::SetElement(deleted, indices[i] - index, old_values[i], NONE,
SLOPPY);
JSObject::SetElement(
deleted, indices[i] - index, old_values[i], NONE, SLOPPY).Assert();
}
SetProperty(deleted, isolate->factory()->length_string(),
@ -11895,7 +11926,7 @@ MaybeHandle<AccessorPair> JSObject::GetLocalElementAccessorPair(
}
Handle<Object> JSObject::SetElementWithInterceptor(
MaybeHandle<Object> JSObject::SetElementWithInterceptor(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
@ -11919,7 +11950,7 @@ Handle<Object> JSObject::SetElementWithInterceptor(
*object);
v8::Handle<v8::Value> result =
args.Call(setter, index, v8::Utils::ToLocal(value));
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
if (!result.IsEmpty()) return value;
}
@ -12072,11 +12103,11 @@ bool JSObject::HasDictionaryArgumentsElements() {
// Adding n elements in fast case is O(n*n).
// Note: revisit design to have dual undefined values to capture absent
// elements.
Handle<Object> JSObject::SetFastElement(Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
StrictMode strict_mode,
bool check_prototype) {
MaybeHandle<Object> JSObject::SetFastElement(Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
StrictMode strict_mode,
bool check_prototype) {
ASSERT(object->HasFastSmiOrObjectElements() ||
object->HasFastArgumentsElements());
@ -12103,7 +12134,7 @@ Handle<Object> JSObject::SetFastElement(Handle<JSObject> object,
if (check_prototype &&
(index >= capacity || backing_store->get(index)->IsTheHole())) {
bool found;
Handle<Object> result = SetElementWithCallbackSetterInPrototypes(
MaybeHandle<Object> result = SetElementWithCallbackSetterInPrototypes(
object, index, value, &found, strict_mode);
if (found) return result;
}
@ -12200,13 +12231,14 @@ Handle<Object> JSObject::SetFastElement(Handle<JSObject> object,
}
Handle<Object> JSObject::SetDictionaryElement(Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
bool check_prototype,
SetPropertyMode set_mode) {
MaybeHandle<Object> JSObject::SetDictionaryElement(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
bool check_prototype,
SetPropertyMode set_mode) {
ASSERT(object->HasDictionaryElements() ||
object->HasDictionaryArgumentsElements());
Isolate* isolate = object->GetIsolate();
@ -12244,8 +12276,7 @@ Handle<Object> JSObject::SetDictionaryElement(Handle<JSObject> object,
Handle<Object> error =
isolate->factory()->NewTypeError("strict_read_only_property",
HandleVector(args, 2));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
}
// Elements of the arguments object in slow mode might be slow aliases.
@ -12266,8 +12297,8 @@ Handle<Object> JSObject::SetDictionaryElement(Handle<JSObject> object,
// Can cause GC!
if (check_prototype) {
bool found;
Handle<Object> result = SetElementWithCallbackSetterInPrototypes(object,
index, value, &found, strict_mode);
MaybeHandle<Object> result = SetElementWithCallbackSetterInPrototypes(
object, index, value, &found, strict_mode);
if (found) return result;
}
@ -12283,8 +12314,7 @@ Handle<Object> JSObject::SetDictionaryElement(Handle<JSObject> object,
Handle<Object> error =
isolate->factory()->NewTypeError("object_not_extensible",
HandleVector(args, 1));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
}
@ -12343,7 +12373,7 @@ Handle<Object> JSObject::SetDictionaryElement(Handle<JSObject> object,
return value;
}
Handle<Object> JSObject::SetFastDoubleElement(
MaybeHandle<Object> JSObject::SetFastDoubleElement(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
@ -12360,8 +12390,8 @@ Handle<Object> JSObject::SetFastDoubleElement(
(index >= elms_length ||
Handle<FixedDoubleArray>::cast(base_elms)->is_the_hole(index))) {
bool found;
Handle<Object> result = SetElementWithCallbackSetterInPrototypes(object,
index, value, &found, strict_mode);
MaybeHandle<Object> result = SetElementWithCallbackSetterInPrototypes(
object, index, value, &found, strict_mode);
if (found) return result;
}
@ -12380,10 +12410,11 @@ Handle<Object> JSObject::SetFastDoubleElement(
if (!value->IsNumber()) {
SetFastElementsCapacityAndLength(object, elms_length, length,
kDontAllowSmiElements);
Handle<Object> result = SetFastElement(object, index, value, strict_mode,
check_prototype);
RETURN_IF_EMPTY_HANDLE_VALUE(object->GetIsolate(), result,
Handle<Object>());
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
object->GetIsolate(), result,
SetFastElement(object, index, value, strict_mode, check_prototype),
Object);
JSObject::ValidateElements(object);
return result;
}
@ -12441,11 +12472,11 @@ Handle<Object> JSObject::SetFastDoubleElement(
}
Handle<Object> JSReceiver::SetElement(Handle<JSReceiver> object,
uint32_t index,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode) {
MaybeHandle<Object> JSReceiver::SetElement(Handle<JSReceiver> object,
uint32_t index,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode) {
if (object->IsJSProxy()) {
return JSProxy::SetElementWithHandler(
Handle<JSProxy>::cast(object), object, index, value, strict_mode);
@ -12455,22 +12486,22 @@ Handle<Object> JSReceiver::SetElement(Handle<JSReceiver> object,
}
Handle<Object> JSObject::SetOwnElement(Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
StrictMode strict_mode) {
MaybeHandle<Object> JSObject::SetOwnElement(Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
StrictMode strict_mode) {
ASSERT(!object->HasExternalArrayElements());
return JSObject::SetElement(object, index, value, NONE, strict_mode, false);
}
Handle<Object> JSObject::SetElement(Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
bool check_prototype,
SetPropertyMode set_mode) {
MaybeHandle<Object> JSObject::SetElement(Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
bool check_prototype,
SetPropertyMode set_mode) {
Isolate* isolate = object->GetIsolate();
if (object->HasExternalArrayElements() ||
@ -12479,7 +12510,7 @@ Handle<Object> JSObject::SetElement(Handle<JSObject> object,
bool has_exception;
Handle<Object> number =
Execution::ToNumber(isolate, value, &has_exception);
if (has_exception) return Handle<Object>();
if (has_exception) return MaybeHandle<Object>();
value = number;
}
}
@ -12488,7 +12519,7 @@ Handle<Object> JSObject::SetElement(Handle<JSObject> object,
if (object->IsAccessCheckNeeded()) {
if (!isolate->MayIndexedAccessWrapper(object, index, v8::ACCESS_SET)) {
isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_SET);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return value;
}
}
@ -12511,8 +12542,7 @@ Handle<Object> JSObject::SetElement(Handle<JSObject> object,
Handle<Object> args[] = { object, number };
Handle<Object> error = isolate->factory()->NewTypeError(
"redef_external_array_element", HandleVector(args, ARRAY_SIZE(args)));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
// Normalize the elements to enable attributes on the property.
@ -12524,13 +12554,10 @@ Handle<Object> JSObject::SetElement(Handle<JSObject> object,
if (!object->map()->is_observed()) {
return object->HasIndexedInterceptor()
? SetElementWithInterceptor(object, index, value, attributes, strict_mode,
check_prototype,
set_mode)
? SetElementWithInterceptor(object, index, value, attributes,
strict_mode, check_prototype, set_mode)
: SetElementWithoutInterceptor(object, index, value, attributes,
strict_mode,
check_prototype,
set_mode);
strict_mode, check_prototype, set_mode);
}
PropertyAttributes old_attributes =
@ -12550,15 +12577,17 @@ Handle<Object> JSObject::SetElement(Handle<JSObject> object,
}
// Check for lookup interceptor
Handle<Object> result = object->HasIndexedInterceptor()
? SetElementWithInterceptor(object, index, value, attributes, strict_mode,
check_prototype,
set_mode)
: SetElementWithoutInterceptor(object, index, value, attributes,
strict_mode,
check_prototype,
set_mode);
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>());
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
object->HasIndexedInterceptor()
? SetElementWithInterceptor(
object, index, value, attributes,
strict_mode, check_prototype, set_mode)
: SetElementWithoutInterceptor(
object, index, value, attributes,
strict_mode, check_prototype, set_mode),
Object);
Handle<String> name = isolate->factory()->Uint32ToString(index);
PropertyAttributes new_attributes = GetLocalElementAttribute(object, index);
@ -12602,7 +12631,7 @@ Handle<Object> JSObject::SetElement(Handle<JSObject> object,
}
Handle<Object> JSObject::SetElementWithoutInterceptor(
MaybeHandle<Object> JSObject::SetElementWithoutInterceptor(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,

View File

@ -2051,11 +2051,12 @@ class JSReceiver: public HeapObject {
PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
static Handle<Object> SetElement(Handle<JSReceiver> object,
uint32_t index,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode);
MUST_USE_RESULT static MaybeHandle<Object> SetElement(
Handle<JSReceiver> object,
uint32_t index,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode);
// Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6.
static inline bool HasProperty(Handle<JSReceiver> object, Handle<Name> name);
@ -2064,12 +2065,14 @@ class JSReceiver: public HeapObject {
static inline bool HasLocalElement(Handle<JSReceiver> object, uint32_t index);
// Implementation of [[Delete]], ECMA-262 5th edition, section 8.12.7.
static Handle<Object> DeleteProperty(Handle<JSReceiver> object,
Handle<Name> name,
DeleteMode mode = NORMAL_DELETION);
static Handle<Object> DeleteElement(Handle<JSReceiver> object,
uint32_t index,
DeleteMode mode = NORMAL_DELETION);
MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty(
Handle<JSReceiver> object,
Handle<Name> name,
DeleteMode mode = NORMAL_DELETION);
MUST_USE_RESULT static MaybeHandle<Object> DeleteElement(
Handle<JSReceiver> object,
uint32_t index,
DeleteMode mode = NORMAL_DELETION);
// Tests for the fast common case for property enumeration.
bool IsSimpleEnum();
@ -2476,18 +2479,21 @@ class JSObject: public JSReceiver {
Handle<JSObject> object,
uint32_t index);
static Handle<Object> SetFastElement(Handle<JSObject> object, uint32_t index,
Handle<Object> value,
StrictMode strict_mode,
bool check_prototype);
MUST_USE_RESULT static MaybeHandle<Object> SetFastElement(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
StrictMode strict_mode,
bool check_prototype);
static Handle<Object> SetOwnElement(Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
StrictMode strict_mode);
MUST_USE_RESULT static MaybeHandle<Object> SetOwnElement(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
StrictMode strict_mode);
// Empty handle is returned if the element cannot be set to the given value.
static Handle<Object> SetElement(
MUST_USE_RESULT static MaybeHandle<Object> SetElement(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
@ -2812,7 +2818,7 @@ class JSObject: public JSReceiver {
Handle<Object> value,
Handle<JSObject> holder,
StrictMode strict_mode);
static Handle<Object> SetElementWithInterceptor(
MUST_USE_RESULT static MaybeHandle<Object> SetElementWithInterceptor(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
@ -2820,7 +2826,7 @@ class JSObject: public JSReceiver {
StrictMode strict_mode,
bool check_prototype,
SetPropertyMode set_mode);
static Handle<Object> SetElementWithoutInterceptor(
MUST_USE_RESULT static MaybeHandle<Object> SetElementWithoutInterceptor(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
@ -2828,13 +2834,14 @@ class JSObject: public JSReceiver {
StrictMode strict_mode,
bool check_prototype,
SetPropertyMode set_mode);
static Handle<Object> SetElementWithCallbackSetterInPrototypes(
MUST_USE_RESULT
static MaybeHandle<Object> SetElementWithCallbackSetterInPrototypes(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
bool* found,
StrictMode strict_mode);
static Handle<Object> SetDictionaryElement(
MUST_USE_RESULT static MaybeHandle<Object> SetDictionaryElement(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
@ -2842,7 +2849,7 @@ class JSObject: public JSReceiver {
StrictMode strict_mode,
bool check_prototype,
SetPropertyMode set_mode = SET_PROPERTY);
static Handle<Object> SetFastDoubleElement(
MUST_USE_RESULT static MaybeHandle<Object> SetFastDoubleElement(
Handle<JSObject> object,
uint32_t index,
Handle<Object> value,
@ -9806,7 +9813,8 @@ class JSProxy: public JSReceiver {
// If it defines an accessor property without a setter, or a data property
// that is read-only, throw. In all these cases set '*done' to true,
// otherwise set it to false.
static Handle<Object> SetPropertyViaPrototypesWithHandler(
MUST_USE_RESULT
static MaybeHandle<Object> SetPropertyViaPrototypesWithHandler(
Handle<JSProxy> proxy,
Handle<JSReceiver> receiver,
Handle<Name> name,
@ -9832,10 +9840,12 @@ class JSProxy: public JSReceiver {
// Invoke a trap by name. If the trap does not exist on this's handler,
// but derived_trap is non-NULL, invoke that instead. May cause GC.
Handle<Object> CallTrap(const char* name,
Handle<Object> derived_trap,
int argc,
Handle<Object> args[]);
MUST_USE_RESULT static MaybeHandle<Object> CallTrap(
Handle<JSProxy> proxy,
const char* name,
Handle<Object> derived_trap,
int argc,
Handle<Object> args[]);
// Dispatched behavior.
DECLARE_PRINTER(JSProxy)
@ -9860,27 +9870,31 @@ class JSProxy: public JSReceiver {
private:
friend class JSReceiver;
static Handle<Object> SetPropertyWithHandler(Handle<JSProxy> proxy,
Handle<JSReceiver> receiver,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode);
static Handle<Object> SetElementWithHandler(Handle<JSProxy> proxy,
Handle<JSReceiver> receiver,
uint32_t index,
Handle<Object> value,
StrictMode strict_mode);
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler(
Handle<JSProxy> proxy,
Handle<JSReceiver> receiver,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode);
MUST_USE_RESULT static MaybeHandle<Object> SetElementWithHandler(
Handle<JSProxy> proxy,
Handle<JSReceiver> receiver,
uint32_t index,
Handle<Object> value,
StrictMode strict_mode);
static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name);
static bool HasElementWithHandler(Handle<JSProxy> proxy, uint32_t index);
static Handle<Object> DeletePropertyWithHandler(Handle<JSProxy> proxy,
Handle<Name> name,
DeleteMode mode);
static Handle<Object> DeleteElementWithHandler(Handle<JSProxy> proxy,
uint32_t index,
DeleteMode mode);
MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithHandler(
Handle<JSProxy> proxy,
Handle<Name> name,
DeleteMode mode);
MUST_USE_RESULT static MaybeHandle<Object> DeleteElementWithHandler(
Handle<JSProxy> proxy,
uint32_t index,
DeleteMode mode);
MUST_USE_RESULT Object* GetIdentityHash();

View File

@ -4924,22 +4924,20 @@ static Handle<Name> ToName(Isolate* isolate, Handle<Object> key) {
}
MaybeObject* Runtime::HasObjectProperty(Isolate* isolate,
Handle<JSReceiver> object,
Handle<Object> key) {
HandleScope scope(isolate);
MaybeHandle<Object> Runtime::HasObjectProperty(Isolate* isolate,
Handle<JSReceiver> object,
Handle<Object> key) {
// Check if the given key is an array index.
uint32_t index;
if (key->ToArrayIndex(&index)) {
return isolate->heap()->ToBoolean(JSReceiver::HasElement(object, index));
return isolate->factory()->ToBoolean(JSReceiver::HasElement(object, index));
}
// Convert the key to a name - possibly by calling back into JavaScript.
Handle<Name> name = ToName(isolate, key);
RETURN_IF_EMPTY_HANDLE(isolate, name);
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, name, MaybeHandle<Object>());
return isolate->heap()->ToBoolean(JSReceiver::HasProperty(object, name));
return isolate->factory()->ToBoolean(JSReceiver::HasProperty(object, name));
}
@ -5252,7 +5250,7 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
bool has_pending_exception = false;
Handle<Object> name_object = key->IsSymbol()
? key : Execution::ToString(isolate, key, &has_pending_exception);
if (has_pending_exception) return Handle<Object>(); // exception
if (has_pending_exception) return MaybeHandle<Object>(); // exception
Handle<Name> name = Handle<Name>::cast(name_object);
return JSReceiver::SetProperty(Handle<JSProxy>::cast(object), name, value,
attr,
@ -5285,15 +5283,15 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
bool has_exception;
Handle<Object> number =
Execution::ToNumber(isolate, value, &has_exception);
if (has_exception) return Handle<Object>(); // exception
if (has_exception) return MaybeHandle<Object>(); // exception
value = number;
}
}
Handle<Object> result = JSObject::SetElement(js_object, index, value, attr,
strict_mode,
true,
set_mode);
MaybeHandle<Object> result = JSObject::SetElement(
js_object, index, value, attr, strict_mode, true, set_mode);
JSObject::ValidateElements(js_object);
return result.is_null() ? result : value;
}
@ -5305,13 +5303,12 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
bool has_exception;
Handle<Object> number =
Execution::ToNumber(isolate, value, &has_exception);
if (has_exception) return Handle<Object>(); // exception
if (has_exception) return MaybeHandle<Object>(); // exception
value = number;
}
}
return JSObject::SetElement(js_object, index, value, attr, strict_mode,
true,
set_mode);
return JSObject::SetElement(js_object, index, value, attr,
strict_mode, true, set_mode);
} else {
if (name->IsString()) Handle<String>::cast(name)->TryFlatten();
return JSReceiver::SetProperty(js_object, name, value, attr, strict_mode);
@ -5322,13 +5319,12 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
bool has_pending_exception = false;
Handle<Object> converted =
Execution::ToString(isolate, key, &has_pending_exception);
if (has_pending_exception) return Handle<Object>(); // exception
if (has_pending_exception) return MaybeHandle<Object>(); // exception
Handle<String> name = Handle<String>::cast(converted);
if (name->AsArrayIndex(&index)) {
return JSObject::SetElement(js_object, index, value, attr, strict_mode,
true,
set_mode);
return JSObject::SetElement(js_object, index, value, attr,
strict_mode, true, set_mode);
} else {
return JSReceiver::SetProperty(js_object, name, value, attr, strict_mode);
}
@ -5354,17 +5350,15 @@ MaybeHandle<Object> Runtime::ForceSetObjectProperty(Handle<JSObject> js_object,
return value;
}
return JSObject::SetElement(js_object, index, value, attr, SLOPPY,
false,
DEFINE_PROPERTY);
return JSObject::SetElement(js_object, index, value, attr,
SLOPPY, false, DEFINE_PROPERTY);
}
if (key->IsName()) {
Handle<Name> name = Handle<Name>::cast(key);
if (name->AsArrayIndex(&index)) {
return JSObject::SetElement(js_object, index, value, attr, SLOPPY,
false,
DEFINE_PROPERTY);
return JSObject::SetElement(js_object, index, value, attr,
SLOPPY, false, DEFINE_PROPERTY);
} else {
if (name->IsString()) Handle<String>::cast(name)->TryFlatten();
return JSObject::SetLocalPropertyIgnoreAttributes(js_object, name,
@ -5376,13 +5370,12 @@ MaybeHandle<Object> Runtime::ForceSetObjectProperty(Handle<JSObject> js_object,
bool has_pending_exception = false;
Handle<Object> converted =
Execution::ToString(isolate, key, &has_pending_exception);
if (has_pending_exception) return Handle<Object>(); // exception
if (has_pending_exception) return MaybeHandle<Object>(); // exception
Handle<String> name = Handle<String>::cast(converted);
if (name->AsArrayIndex(&index)) {
return JSObject::SetElement(js_object, index, value, attr, SLOPPY,
false,
DEFINE_PROPERTY);
return JSObject::SetElement(js_object, index, value, attr,
SLOPPY, false, DEFINE_PROPERTY);
} else {
return JSObject::SetLocalPropertyIgnoreAttributes(js_object, name, value,
attr);
@ -5390,12 +5383,10 @@ MaybeHandle<Object> Runtime::ForceSetObjectProperty(Handle<JSObject> js_object,
}
MaybeObject* Runtime::DeleteObjectProperty(Isolate* isolate,
Handle<JSReceiver> receiver,
Handle<Object> key,
JSReceiver::DeleteMode mode) {
HandleScope scope(isolate);
MaybeHandle<Object> Runtime::DeleteObjectProperty(Isolate* isolate,
Handle<JSReceiver> receiver,
Handle<Object> key,
JSReceiver::DeleteMode mode) {
// Check if the given key is an array index.
uint32_t index;
if (key->ToArrayIndex(&index)) {
@ -5406,12 +5397,10 @@ MaybeObject* Runtime::DeleteObjectProperty(Isolate* isolate,
// underlying string does nothing with the deletion, we can ignore
// such deletions.
if (receiver->IsStringObjectWithCharacterAt(index)) {
return isolate->heap()->true_value();
return isolate->factory()->true_value();
}
Handle<Object> result = JSReceiver::DeleteElement(receiver, index, mode);
RETURN_IF_EMPTY_HANDLE(isolate, result);
return *result;
return JSReceiver::DeleteElement(receiver, index, mode);
}
Handle<Name> name;
@ -5422,14 +5411,12 @@ MaybeObject* Runtime::DeleteObjectProperty(Isolate* isolate,
bool has_pending_exception = false;
Handle<Object> converted = Execution::ToString(
isolate, key, &has_pending_exception);
if (has_pending_exception) return Failure::Exception();
if (has_pending_exception) return MaybeHandle<Object>();
name = Handle<String>::cast(converted);
}
if (name->IsString()) Handle<String>::cast(name)->TryFlatten();
Handle<Object> result = JSReceiver::DeleteProperty(receiver, name, mode);
RETURN_IF_EMPTY_HANDLE(isolate, result);
return *result;
return JSReceiver::DeleteProperty(receiver, name, mode);
}
@ -5644,8 +5631,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteProperty) {
CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 2);
JSReceiver::DeleteMode delete_mode = strict_mode == STRICT
? JSReceiver::STRICT_DELETION : JSReceiver::NORMAL_DELETION;
Handle<Object> result = JSReceiver::DeleteProperty(object, key, delete_mode);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSReceiver::DeleteProperty(object, key, delete_mode));
return *result;
}
@ -9218,8 +9207,10 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeleteContextSlot) {
// the global object, or the subject of a with. Try to delete it
// (respecting DONT_DELETE).
Handle<JSObject> object = Handle<JSObject>::cast(holder);
Handle<Object> result = JSReceiver::DeleteProperty(object, name);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSReceiver::DeleteProperty(object, name));
return *result;
}
@ -9934,10 +9925,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) {
}
// Strict not needed. Used for cycle detection in Array join implementation.
RETURN_IF_EMPTY_HANDLE(isolate, JSObject::SetFastElement(array, length,
element,
SLOPPY,
true));
RETURN_FAILURE_ON_EXCEPTION(
isolate,
JSObject::SetFastElement(array, length, element, SLOPPY, true));
return isolate->heap()->true_value();
}
@ -12293,9 +12283,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) {
if (accept) {
if (break_location_iterator.IsStepInLocation(isolate)) {
Smi* position_value = Smi::FromInt(break_location_iterator.position());
JSObject::SetElement(array, len,
Handle<Object>(position_value, isolate),
NONE, SLOPPY);
RETURN_FAILURE_ON_EXCEPTION(
isolate,
JSObject::SetElement(array, len,
Handle<Object>(position_value, isolate),
NONE, SLOPPY));
len++;
}
}

View File

@ -841,13 +841,13 @@ class Runtime : public AllStatic {
Handle<Object> value,
PropertyAttributes attr);
MUST_USE_RESULT static MaybeObject* DeleteObjectProperty(
MUST_USE_RESULT static MaybeHandle<Object> DeleteObjectProperty(
Isolate* isolate,
Handle<JSReceiver> object,
Handle<Object> key,
JSReceiver::DeleteMode mode);
MUST_USE_RESULT static MaybeObject* HasObjectProperty(
MUST_USE_RESULT static MaybeHandle<Object> HasObjectProperty(
Isolate* isolate,
Handle<JSReceiver> object,
Handle<Object> key);

View File

@ -1114,7 +1114,7 @@ bool Scope::ResolveVariable(CompilationInfo* info,
Isolate* isolate = info->isolate();
Factory* factory = isolate->factory();
Handle<JSArray> array = factory->NewJSArray(1);
USE(JSObject::SetElement(array, 0, var->name(), NONE, STRICT));
JSObject::SetElement(array, 0, var->name(), NONE, STRICT).Assert();
Handle<Object> result =
factory->NewSyntaxError("module_type_error", array);
isolate->Throw(*result, &location);

View File

@ -15728,17 +15728,20 @@ THREADED_TEST(PixelArray) {
i::Handle<i::Smi> value(i::Smi::FromInt(2),
reinterpret_cast<i::Isolate*>(context->GetIsolate()));
i::Handle<i::Object> no_failure;
no_failure = i::JSObject::SetElement(jsobj, 1, value, NONE, i::SLOPPY);
no_failure = i::JSObject::SetElement(
jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
ASSERT(!no_failure.is_null());
i::USE(no_failure);
CheckElementValue(isolate, 2, jsobj, 1);
*value.location() = i::Smi::FromInt(256);
no_failure = i::JSObject::SetElement(jsobj, 1, value, NONE, i::SLOPPY);
no_failure = i::JSObject::SetElement(
jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
ASSERT(!no_failure.is_null());
i::USE(no_failure);
CheckElementValue(isolate, 255, jsobj, 1);
*value.location() = i::Smi::FromInt(-1);
no_failure = i::JSObject::SetElement(jsobj, 1, value, NONE, i::SLOPPY);
no_failure = i::JSObject::SetElement(
jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
ASSERT(!no_failure.is_null());
i::USE(no_failure);
CheckElementValue(isolate, 0, jsobj, 1);

View File

@ -683,7 +683,7 @@ TEST(ObjectProperties) {
CHECK(JSReceiver::HasLocalProperty(obj, first));
// delete first
JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION).Check();
CHECK(!JSReceiver::HasLocalProperty(obj, first));
// add first and then second
@ -693,9 +693,9 @@ TEST(ObjectProperties) {
CHECK(JSReceiver::HasLocalProperty(obj, second));
// delete first and then second
JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION).Check();
CHECK(JSReceiver::HasLocalProperty(obj, second));
JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION);
JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION).Check();
CHECK(!JSReceiver::HasLocalProperty(obj, first));
CHECK(!JSReceiver::HasLocalProperty(obj, second));
@ -706,9 +706,9 @@ TEST(ObjectProperties) {
CHECK(JSReceiver::HasLocalProperty(obj, second));
// delete second and then first
JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION);
JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION).Check();
CHECK(JSReceiver::HasLocalProperty(obj, first));
JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION).Check();
CHECK(!JSReceiver::HasLocalProperty(obj, first));
CHECK(!JSReceiver::HasLocalProperty(obj, second));

View File

@ -1251,7 +1251,7 @@ i::Handle<i::String> FormatMessage(i::ScriptDataImpl* data) {
i::JSArray::SetElement(
args_array, i, v8::Utils::OpenHandle(*v8::String::NewFromUtf8(
CcTest::isolate(), args[i])),
NONE, i::SLOPPY);
NONE, i::SLOPPY).Check();
}
i::Handle<i::JSObject> builtins(isolate->js_builtins_object());
i::Handle<i::Object> format_fun =