Return MaybeHandle from SetProperty.

R=ishell@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20509 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2014-04-04 12:06:11 +00:00
parent 3eb418df78
commit dd7bb01688
26 changed files with 570 additions and 531 deletions

View File

@ -190,9 +190,11 @@ MaybeObject* Accessors::ArraySetLength(Isolate* isolate,
// object does not have a 'length' property. Calling SetProperty
// causes an infinite loop.
if (!object->IsJSArray()) {
Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes(object,
isolate->factory()->length_string(), value, NONE);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSObject::SetLocalPropertyIgnoreAttributes(
object, isolate->factory()->length_string(), value, NONE));
return *result;
}
@ -591,9 +593,11 @@ MaybeObject* Accessors::FunctionSetPrototype(Isolate* isolate,
Handle<Object> value(value_raw, isolate);
if (!function->should_have_prototype()) {
// Since we hit this accessor, object will have no prototype property.
Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes(object,
isolate->factory()->prototype_string(), value, NONE);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSObject::SetLocalPropertyIgnoreAttributes(
object, isolate->factory()->prototype_string(), value, NONE));
return *result;
}

View File

@ -3049,14 +3049,13 @@ bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj = i::Runtime::SetObjectProperty(
has_pending_exception = i::Runtime::SetObjectProperty(
isolate,
self,
key_obj,
value_obj,
static_cast<PropertyAttributes>(attribs),
i::SLOPPY);
has_pending_exception = obj.is_null();
i::SLOPPY).is_null();
EXCEPTION_BAILOUT_CHECK(isolate, false);
return true;
}
@ -3093,12 +3092,11 @@ bool v8::Object::ForceSet(v8::Handle<Value> key,
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> obj = i::ForceSetProperty(
has_pending_exception = i::Runtime::ForceSetObjectProperty(
self,
key_obj,
value_obj,
static_cast<PropertyAttributes>(attribs));
has_pending_exception = obj.is_null();
static_cast<PropertyAttributes>(attribs)).is_null();
EXCEPTION_BAILOUT_CHECK(isolate, false);
return true;
}
@ -6157,7 +6155,8 @@ Local<Symbol> v8::Symbol::For(Isolate* isolate, Local<String> name) {
ASSERT(symbol->IsUndefined());
symbol = i_isolate->factory()->NewSymbol();
i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name);
i::JSObject::SetProperty(symbols, i_name, symbol, NONE, i::STRICT);
i::JSObject::SetProperty(
symbols, i_name, symbol, NONE, i::STRICT).Assert();
}
return Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol));
}
@ -6177,7 +6176,8 @@ Local<Symbol> v8::Symbol::ForApi(Isolate* isolate, Local<String> name) {
ASSERT(symbol->IsUndefined());
symbol = i_isolate->factory()->NewSymbol();
i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name);
i::JSObject::SetProperty(symbols, i_name, symbol, NONE, i::STRICT);
i::JSObject::SetProperty(
symbols, i_name, symbol, NONE, i::STRICT).Assert();
}
return Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol));
}
@ -6209,7 +6209,8 @@ Local<Private> v8::Private::ForApi(Isolate* isolate, Local<String> name) {
ASSERT(symbol->IsUndefined());
symbol = i_isolate->factory()->NewPrivateSymbol();
i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name);
i::JSObject::SetProperty(privates, i_name, symbol, NONE, i::STRICT);
i::JSObject::SetProperty(
privates, i_name, symbol, NONE, i::STRICT).Assert();
}
Local<Symbol> result = Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol));
return v8::Handle<Private>(reinterpret_cast<Private*>(*result));
@ -6964,19 +6965,23 @@ Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
ENTER_V8(isolate);
v8::EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Debug* isolate_debug = isolate->debug();
isolate_debug->Load();
i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object());
i::Handle<i::String> name = isolate->factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("MakeMirror"));
i::Handle<i::Object> fun_obj = i::Object::GetProperty(debug, name);
ASSERT(!fun_obj.is_null());
i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj);
v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
const int kArgc = 1;
v8::Handle<v8::Value> argv[kArgc] = { obj };
EXCEPTION_PREAMBLE(isolate);
v8::Local<v8::Value> result =
v8_fun->Call(Utils::ToLocal(debug), kArgc, argv);
has_pending_exception = !isolate_debug->Load();
v8::Local<v8::Value> result;
if (!has_pending_exception) {
i::Handle<i::JSObject> debug(
isolate_debug->debug_context()->global_object());
i::Handle<i::String> name = isolate->factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("MakeMirror"));
i::Handle<i::Object> fun_obj = i::Object::GetProperty(debug, name);
ASSERT(!fun_obj.is_null());
i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj);
v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
const int kArgc = 1;
v8::Handle<v8::Value> argv[kArgc] = { obj };
result = v8_fun->Call(Utils::ToLocal(debug), kArgc, argv);
has_pending_exception = result.IsEmpty();
}
EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
return scope.Escape(result);
}

View File

@ -370,9 +370,8 @@ static Handle<JSFunction> InstallFunction(Handle<JSObject> target,
} else {
attributes = DONT_ENUM;
}
CHECK_NOT_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
target, internalized_name, function, attributes));
JSObject::SetLocalPropertyIgnoreAttributes(
target, internalized_name, function, attributes).Check();
if (set_instance_class_name) {
function->shared()->set_instance_class_name(*internalized_name);
}
@ -723,10 +722,9 @@ Handle<JSGlobalProxy> Genesis::CreateNewGlobals(
Handle<JSObject> prototype =
Handle<JSObject>(
JSObject::cast(js_global_function->instance_prototype()));
CHECK_NOT_EMPTY_HANDLE(isolate(),
JSObject::SetLocalPropertyIgnoreAttributes(
prototype, factory()->constructor_string(),
isolate()->object_function(), NONE));
JSObject::SetLocalPropertyIgnoreAttributes(
prototype, factory()->constructor_string(),
isolate()->object_function(), NONE).Check();
} else {
Handle<FunctionTemplateInfo> js_global_constructor(
FunctionTemplateInfo::cast(js_global_template->constructor()));
@ -802,11 +800,11 @@ void Genesis::HookUpInnerGlobal(Handle<GlobalObject> inner_global) {
native_context()->set_security_token(*inner_global);
static const PropertyAttributes attributes =
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
ForceSetProperty(builtins_global,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("global")),
inner_global,
attributes);
Runtime::ForceSetObjectProperty(builtins_global,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("global")),
inner_global,
attributes).Assert();
// Set up the reference from the global object to the builtins object.
JSGlobalObject::cast(*inner_global)->set_builtins(*builtins_global);
TransferNamedProperties(inner_global_from_snapshot, inner_global);
@ -836,10 +834,9 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
Heap* heap = isolate->heap();
Handle<String> object_name = factory->Object_string();
CHECK_NOT_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
inner_global, object_name,
isolate->object_function(), DONT_ENUM));
JSObject::SetLocalPropertyIgnoreAttributes(
inner_global, object_name,
isolate->object_function(), DONT_ENUM).Check();
Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
@ -1045,9 +1042,8 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
cons->SetInstanceClassName(*name);
Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED);
ASSERT(json_object->IsJSObject());
CHECK_NOT_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
global, name, json_object, DONT_ENUM));
JSObject::SetLocalPropertyIgnoreAttributes(
global, name, json_object, DONT_ENUM).Check();
native_context()->set_json_object(*json_object);
}
@ -1107,16 +1103,14 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
native_context()->set_sloppy_arguments_boilerplate(*result);
// Note: length must be added as the first property and
// callee must be added as the second property.
CHECK_NOT_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
result, factory->length_string(),
factory->undefined_value(), DONT_ENUM,
Object::FORCE_TAGGED, FORCE_FIELD));
CHECK_NOT_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
result, factory->callee_string(),
factory->undefined_value(), DONT_ENUM,
Object::FORCE_TAGGED, FORCE_FIELD));
JSObject::SetLocalPropertyIgnoreAttributes(
result, factory->length_string(),
factory->undefined_value(), DONT_ENUM,
Object::FORCE_TAGGED, FORCE_FIELD).Check();
JSObject::SetLocalPropertyIgnoreAttributes(
result, factory->callee_string(),
factory->undefined_value(), DONT_ENUM,
Object::FORCE_TAGGED, FORCE_FIELD).Check();
#ifdef DEBUG
LookupResult lookup(isolate);
@ -1217,10 +1211,9 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
native_context()->set_strict_arguments_boilerplate(*result);
// Add length property only for strict mode boilerplate.
CHECK_NOT_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
result, factory->length_string(),
factory->undefined_value(), DONT_ENUM));
JSObject::SetLocalPropertyIgnoreAttributes(
result, factory->length_string(),
factory->undefined_value(), DONT_ENUM).Check();
#ifdef DEBUG
LookupResult lookup(isolate);
@ -1674,14 +1667,12 @@ bool Genesis::InstallNatives() {
Handle<String> global_string =
factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("global"));
Handle<Object> global_obj(native_context()->global_object(), isolate());
CHECK_NOT_EMPTY_HANDLE(isolate(),
JSObject::SetLocalPropertyIgnoreAttributes(
builtins, global_string, global_obj, attributes));
JSObject::SetLocalPropertyIgnoreAttributes(
builtins, global_string, global_obj, attributes).Check();
Handle<String> builtins_string =
factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("builtins"));
CHECK_NOT_EMPTY_HANDLE(isolate(),
JSObject::SetLocalPropertyIgnoreAttributes(
builtins, builtins_string, builtins, attributes));
JSObject::SetLocalPropertyIgnoreAttributes(
builtins, builtins_string, builtins, attributes).Check();
// Set up the reference from the global object to the builtins object.
JSGlobalObject::cast(native_context()->global_object())->
@ -2163,9 +2154,11 @@ bool Genesis::InstallSpecialObjects(Handle<Context> native_context) {
if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) {
Handle<String> natives =
factory->InternalizeUtf8String(FLAG_expose_natives_as);
JSObject::SetLocalPropertyIgnoreAttributes(
global, natives, Handle<JSObject>(global->builtins()), DONT_ENUM);
if (isolate->has_pending_exception()) return false;
RETURN_ON_EXCEPTION_VALUE(
isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
global, natives, Handle<JSObject>(global->builtins()), DONT_ENUM),
false);
}
Handle<Object> Error = GetProperty(global, "Error");
@ -2174,9 +2167,11 @@ bool Genesis::InstallSpecialObjects(Handle<Context> native_context) {
STATIC_ASCII_VECTOR("stackTraceLimit"));
Handle<Smi> stack_trace_limit(
Smi::FromInt(FLAG_stack_trace_limit), isolate);
JSObject::SetLocalPropertyIgnoreAttributes(
Handle<JSObject>::cast(Error), name, stack_trace_limit, NONE);
if (isolate->has_pending_exception()) return false;
RETURN_ON_EXCEPTION_VALUE(
isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
Handle<JSObject>::cast(Error), name, stack_trace_limit, NONE),
false);
}
#ifdef ENABLE_DEBUGGER_SUPPORT
@ -2196,9 +2191,11 @@ bool Genesis::InstallSpecialObjects(Handle<Context> native_context) {
factory->InternalizeUtf8String(FLAG_expose_debug_as);
Handle<Object> global_proxy(
debug->debug_context()->global_proxy(), isolate);
JSObject::SetLocalPropertyIgnoreAttributes(
global, debug_string, global_proxy, DONT_ENUM);
if (isolate->has_pending_exception()) return false;
RETURN_ON_EXCEPTION_VALUE(
isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
global, debug_string, global_proxy, DONT_ENUM),
false);
}
#endif
return true;
@ -2431,18 +2428,16 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
ASSERT(!descs->GetDetails(i).representation().IsDouble());
Handle<Object> value = Handle<Object>(from->RawFastPropertyAt(index),
isolate());
CHECK_NOT_EMPTY_HANDLE(isolate(),
JSObject::SetLocalPropertyIgnoreAttributes(
to, key, value, details.attributes()));
JSObject::SetLocalPropertyIgnoreAttributes(
to, key, value, details.attributes()).Check();
break;
}
case CONSTANT: {
HandleScope inner(isolate());
Handle<Name> key = Handle<Name>(descs->GetKey(i));
Handle<Object> constant(descs->GetConstant(i), isolate());
CHECK_NOT_EMPTY_HANDLE(isolate(),
JSObject::SetLocalPropertyIgnoreAttributes(
to, key, constant, details.attributes()));
JSObject::SetLocalPropertyIgnoreAttributes(
to, key, constant, details.attributes()).Check();
break;
}
case CALLBACKS: {
@ -2492,9 +2487,8 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
isolate());
}
PropertyDetails details = properties->DetailsAt(i);
CHECK_NOT_EMPTY_HANDLE(isolate(),
JSObject::SetLocalPropertyIgnoreAttributes(
to, key, value, details.attributes()));
JSObject::SetLocalPropertyIgnoreAttributes(
to, key, value, details.attributes()).Check();
}
}
}
@ -2651,11 +2645,11 @@ Genesis::Genesis(Isolate* isolate,
Utils::OpenHandle(*buffer)->set_should_be_freed(true);
v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems);
Handle<JSBuiltinsObject> builtins(native_context()->builtins());
ForceSetProperty(builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("rngstate")),
Utils::OpenHandle(*ta),
NONE);
Runtime::ForceSetObjectProperty(builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("rngstate")),
Utils::OpenHandle(*ta),
NONE).Assert();
// Initialize trigonometric lookup tables and constants.
const int table_num_bytes = TrigonometricLookupTable::table_num_bytes();
@ -2670,28 +2664,31 @@ Genesis::Genesis(Isolate* isolate,
v8::Local<v8::Float64Array> cos_table = v8::Float64Array::New(
cos_buffer, 0, TrigonometricLookupTable::table_size());
ForceSetProperty(builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kSinTable")),
Utils::OpenHandle(*sin_table),
NONE);
ForceSetProperty(builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kCosXIntervalTable")),
Utils::OpenHandle(*cos_table),
NONE);
ForceSetProperty(builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kSamples")),
factory()->NewHeapNumber(
TrigonometricLookupTable::samples()),
NONE);
ForceSetProperty(builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kIndexConvert")),
factory()->NewHeapNumber(
TrigonometricLookupTable::samples_over_pi_half()),
NONE);
Runtime::ForceSetObjectProperty(builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kSinTable")),
Utils::OpenHandle(*sin_table),
NONE).Assert();
Runtime::ForceSetObjectProperty(
builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kCosXIntervalTable")),
Utils::OpenHandle(*cos_table),
NONE).Assert();
Runtime::ForceSetObjectProperty(
builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kSamples")),
factory()->NewHeapNumber(
TrigonometricLookupTable::samples()),
NONE).Assert();
Runtime::ForceSetObjectProperty(
builtins,
factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("kIndexConvert")),
factory()->NewHeapNumber(
TrigonometricLookupTable::samples_over_pi_half()),
NONE).Assert();
}
result_ = native_context();

View File

@ -847,7 +847,7 @@ bool Debug::Load() {
Handle<String> key = isolate_->factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("builtins"));
Handle<GlobalObject> global = Handle<GlobalObject>(context->global_object());
RETURN_IF_EMPTY_HANDLE_VALUE(
RETURN_ON_EXCEPTION_VALUE(
isolate_,
JSReceiver::SetProperty(global,
key,

View File

@ -811,7 +811,7 @@ Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) {
JSObject::SetLocalPropertyIgnoreAttributes(prototype,
constructor_string(),
function,
DONT_ENUM);
DONT_ENUM).Assert();
}
return prototype;

View File

@ -132,10 +132,10 @@ class Factory V8_FINAL {
// Allocates and partially initializes an ASCII or TwoByte String. The
// characters of the string are uninitialized. Currently used in regexp code
// only, where they are pretenured.
MaybeHandle<SeqOneByteString> NewRawOneByteString(
MUST_USE_RESULT MaybeHandle<SeqOneByteString> NewRawOneByteString(
int length,
PretenureFlag pretenure = NOT_TENURED);
MaybeHandle<SeqTwoByteString> NewRawTwoByteString(
MUST_USE_RESULT MaybeHandle<SeqTwoByteString> NewRawTwoByteString(
int length,
PretenureFlag pretenure = NOT_TENURED);
@ -166,9 +166,9 @@ class Factory V8_FINAL {
// in the system: ASCII and two byte. Unlike other String types, it does
// not make sense to have a UTF-8 factory function for external strings,
// because we cannot change the underlying buffer.
MaybeHandle<String> NewExternalStringFromAscii(
MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromAscii(
const ExternalAsciiString::Resource* resource);
MaybeHandle<String> NewExternalStringFromTwoByte(
MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromTwoByte(
const ExternalTwoByteString::Resource* resource);
// Create a symbol.

View File

@ -158,15 +158,6 @@ Handle<String> FlattenGetString(Handle<String> string) {
}
Handle<Object> ForceSetProperty(Handle<JSObject> object,
Handle<Object> key,
Handle<Object> value,
PropertyAttributes attributes) {
return Runtime::ForceSetObjectProperty(object->GetIsolate(), object, key,
value, attributes);
}
Handle<Object> DeleteProperty(Handle<JSObject> object, Handle<Object> key) {
Isolate* isolate = object->GetIsolate();
CALL_HEAP_FUNCTION(isolate,

View File

@ -68,8 +68,11 @@ class MaybeHandle {
location_ = reinterpret_cast<T**>(maybe_handle.location_);
}
INLINE(void Assert()) { ASSERT(location_ != NULL); }
INLINE(void Check()) { CHECK(location_ != NULL); }
INLINE(Handle<T> ToHandleChecked()) {
CHECK(location_ != NULL);
Check();
return Handle<T>(location_);
}
@ -291,11 +294,6 @@ void FlattenString(Handle<String> str);
// string.
Handle<String> FlattenGetString(Handle<String> str);
Handle<Object> ForceSetProperty(Handle<JSObject> object,
Handle<Object> key,
Handle<Object> value,
PropertyAttributes attributes);
Handle<Object> DeleteProperty(Handle<JSObject> object, Handle<Object> key);
Handle<Object> ForceDeleteProperty(Handle<JSObject> object, Handle<Object> key);

View File

@ -5213,11 +5213,12 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
Handle<JSObject> boilerplate_object;
if (literals_cell->IsUndefined()) {
uninitialized = true;
Handle<Object> raw_boilerplate = Runtime::CreateArrayLiteralBoilerplate(
isolate(), literals, expr->constant_elements());
if (raw_boilerplate.is_null()) {
return Bailout(kArrayBoilerplateCreationFailed);
}
Handle<Object> raw_boilerplate;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate(), raw_boilerplate,
Runtime::CreateArrayLiteralBoilerplate(
isolate(), literals, expr->constant_elements()),
Bailout(kArrayBoilerplateCreationFailed));
boilerplate_object = Handle<JSObject>::cast(raw_boilerplate);
AllocationSiteCreationContext creation_context(isolate());

View File

@ -163,7 +163,7 @@ void SetResolvedDateSettings(Isolate* isolate,
reinterpret_cast<const uint16_t*>(pattern.getBuffer()),
pattern.length())),
NONE,
SLOPPY);
SLOPPY).Assert();
// Set time zone and calendar.
const icu::Calendar* calendar = date_format->getCalendar();
@ -173,7 +173,7 @@ void SetResolvedDateSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("calendar")),
isolate->factory()->NewStringFromAscii(CStrVector(calendar_name)),
NONE,
SLOPPY);
SLOPPY).Assert();
const icu::TimeZone& tz = calendar->getTimeZone();
icu::UnicodeString time_zone;
@ -188,7 +188,7 @@ void SetResolvedDateSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("timeZone")),
isolate->factory()->NewStringFromAscii(CStrVector("UTC")),
NONE,
SLOPPY);
SLOPPY).Assert();
} else {
JSObject::SetProperty(
resolved,
@ -199,7 +199,7 @@ void SetResolvedDateSettings(Isolate* isolate,
canonical_time_zone.getBuffer()),
canonical_time_zone.length())),
NONE,
SLOPPY);
SLOPPY).Assert();
}
}
@ -216,14 +216,14 @@ void SetResolvedDateSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("numberingSystem")),
isolate->factory()->NewStringFromAscii(CStrVector(ns)),
NONE,
SLOPPY);
SLOPPY).Assert();
} else {
JSObject::SetProperty(
resolved,
isolate->factory()->NewStringFromAscii(CStrVector("numberingSystem")),
isolate->factory()->undefined_value(),
NONE,
SLOPPY);
SLOPPY).Assert();
}
delete numbering_system;
@ -238,7 +238,7 @@ void SetResolvedDateSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
isolate->factory()->NewStringFromAscii(CStrVector(result)),
NONE,
SLOPPY);
SLOPPY).Assert();
} else {
// This would never happen, since we got the locale from ICU.
JSObject::SetProperty(
@ -246,7 +246,7 @@ void SetResolvedDateSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
isolate->factory()->NewStringFromAscii(CStrVector("und")),
NONE,
SLOPPY);
SLOPPY).Assert();
}
}
@ -389,7 +389,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
reinterpret_cast<const uint16_t*>(pattern.getBuffer()),
pattern.length())),
NONE,
SLOPPY);
SLOPPY).Assert();
// Set resolved currency code in options.currency if not empty.
icu::UnicodeString currency(number_format->getCurrency());
@ -402,7 +402,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
reinterpret_cast<const uint16_t*>(currency.getBuffer()),
currency.length())),
NONE,
SLOPPY);
SLOPPY).Assert();
}
// Ugly hack. ICU doesn't expose numbering system in any way, so we have
@ -418,14 +418,14 @@ void SetResolvedNumberSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("numberingSystem")),
isolate->factory()->NewStringFromAscii(CStrVector(ns)),
NONE,
SLOPPY);
SLOPPY).Assert();
} else {
JSObject::SetProperty(
resolved,
isolate->factory()->NewStringFromAscii(CStrVector("numberingSystem")),
isolate->factory()->undefined_value(),
NONE,
SLOPPY);
SLOPPY).Assert();
}
delete numbering_system;
@ -434,7 +434,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("useGrouping")),
isolate->factory()->ToBoolean(number_format->isGroupingUsed()),
NONE,
SLOPPY);
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
@ -443,7 +443,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
isolate->factory()->NewNumberFromInt(
number_format->getMinimumIntegerDigits()),
NONE,
SLOPPY);
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
@ -452,7 +452,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
isolate->factory()->NewNumberFromInt(
number_format->getMinimumFractionDigits()),
NONE,
SLOPPY);
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
@ -461,7 +461,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
isolate->factory()->NewNumberFromInt(
number_format->getMaximumFractionDigits()),
NONE,
SLOPPY);
SLOPPY).Assert();
Handle<String> key = isolate->factory()->NewStringFromAscii(
CStrVector("minimumSignificantDigits"));
@ -473,7 +473,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
isolate->factory()->NewNumberFromInt(
number_format->getMinimumSignificantDigits()),
NONE,
SLOPPY);
SLOPPY).Assert();
}
key = isolate->factory()->NewStringFromAscii(
@ -486,7 +486,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
isolate->factory()->NewNumberFromInt(
number_format->getMaximumSignificantDigits()),
NONE,
SLOPPY);
SLOPPY).Assert();
}
// Set the locale
@ -500,7 +500,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
isolate->factory()->NewStringFromAscii(CStrVector(result)),
NONE,
SLOPPY);
SLOPPY).Assert();
} else {
// This would never happen, since we got the locale from ICU.
JSObject::SetProperty(
@ -508,7 +508,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
isolate->factory()->NewStringFromAscii(CStrVector("und")),
NONE,
SLOPPY);
SLOPPY).Assert();
}
}
@ -589,7 +589,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->ToBoolean(
collator->getAttribute(UCOL_NUMERIC_COLLATION, status) == UCOL_ON),
NONE,
SLOPPY);
SLOPPY).Assert();
switch (collator->getAttribute(UCOL_CASE_FIRST, status)) {
case UCOL_LOWER_FIRST:
@ -598,7 +598,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("caseFirst")),
isolate->factory()->NewStringFromAscii(CStrVector("lower")),
NONE,
SLOPPY);
SLOPPY).Assert();
break;
case UCOL_UPPER_FIRST:
JSObject::SetProperty(
@ -606,7 +606,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("caseFirst")),
isolate->factory()->NewStringFromAscii(CStrVector("upper")),
NONE,
SLOPPY);
SLOPPY).Assert();
break;
default:
JSObject::SetProperty(
@ -614,7 +614,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("caseFirst")),
isolate->factory()->NewStringFromAscii(CStrVector("false")),
NONE,
SLOPPY);
SLOPPY).Assert();
}
switch (collator->getAttribute(UCOL_STRENGTH, status)) {
@ -624,7 +624,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("strength")),
isolate->factory()->NewStringFromAscii(CStrVector("primary")),
NONE,
SLOPPY);
SLOPPY).Assert();
// case level: true + s1 -> case, s1 -> base.
if (UCOL_ON == collator->getAttribute(UCOL_CASE_LEVEL, status)) {
@ -633,14 +633,14 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
isolate->factory()->NewStringFromAscii(CStrVector("case")),
NONE,
SLOPPY);
SLOPPY).Assert();
} else {
JSObject::SetProperty(
resolved,
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
isolate->factory()->NewStringFromAscii(CStrVector("base")),
NONE,
SLOPPY);
SLOPPY).Assert();
}
break;
}
@ -650,13 +650,13 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("strength")),
isolate->factory()->NewStringFromAscii(CStrVector("secondary")),
NONE,
SLOPPY);
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
isolate->factory()->NewStringFromAscii(CStrVector("accent")),
NONE,
SLOPPY);
SLOPPY).Assert();
break;
case UCOL_TERTIARY:
JSObject::SetProperty(
@ -664,13 +664,13 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("strength")),
isolate->factory()->NewStringFromAscii(CStrVector("tertiary")),
NONE,
SLOPPY);
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
isolate->factory()->NewStringFromAscii(CStrVector("variant")),
NONE,
SLOPPY);
SLOPPY).Assert();
break;
case UCOL_QUATERNARY:
// We shouldn't get quaternary and identical from ICU, but if we do
@ -680,13 +680,13 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("strength")),
isolate->factory()->NewStringFromAscii(CStrVector("quaternary")),
NONE,
SLOPPY);
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
isolate->factory()->NewStringFromAscii(CStrVector("variant")),
NONE,
SLOPPY);
SLOPPY).Assert();
break;
default:
JSObject::SetProperty(
@ -694,13 +694,13 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("strength")),
isolate->factory()->NewStringFromAscii(CStrVector("identical")),
NONE,
SLOPPY);
SLOPPY).Assert();
JSObject::SetProperty(
resolved,
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
isolate->factory()->NewStringFromAscii(CStrVector("variant")),
NONE,
SLOPPY);
SLOPPY).Assert();
}
JSObject::SetProperty(
@ -709,7 +709,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->ToBoolean(collator->getAttribute(
UCOL_ALTERNATE_HANDLING, status) == UCOL_SHIFTED),
NONE,
SLOPPY);
SLOPPY).Assert();
// Set the locale
char result[ULOC_FULLNAME_CAPACITY];
@ -722,7 +722,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
isolate->factory()->NewStringFromAscii(CStrVector(result)),
NONE,
SLOPPY);
SLOPPY).Assert();
} else {
// This would never happen, since we got the locale from ICU.
JSObject::SetProperty(
@ -730,7 +730,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
isolate->factory()->NewStringFromAscii(CStrVector("und")),
NONE,
SLOPPY);
SLOPPY).Assert();
}
}
@ -785,7 +785,7 @@ void SetResolvedBreakIteratorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
isolate->factory()->NewStringFromAscii(CStrVector(result)),
NONE,
SLOPPY);
SLOPPY).Assert();
} else {
// This would never happen, since we got the locale from ICU.
JSObject::SetProperty(
@ -793,7 +793,7 @@ void SetResolvedBreakIteratorSettings(Isolate* isolate,
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
isolate->factory()->NewStringFromAscii(CStrVector("und")),
NONE,
SLOPPY);
SLOPPY).Assert();
}
}

View File

@ -1197,9 +1197,11 @@ MaybeObject* StoreIC::Store(Handle<Object> object,
Handle<Object> value,
JSReceiver::StoreFromKeyed store_mode) {
if (MigrateDeprecated(object) || object->IsJSProxy()) {
Handle<Object> result = JSReceiver::SetProperty(
Handle<JSReceiver>::cast(object), name, value, NONE, strict_mode());
RETURN_IF_EMPTY_HANDLE(isolate(), result);
Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate(), result,
JSReceiver::SetProperty(receiver, name, value, NONE, strict_mode()));
return *result;
}
@ -1232,9 +1234,11 @@ MaybeObject* StoreIC::Store(Handle<Object> object,
// Observed objects are always modified through the runtime.
if (receiver->map()->is_observed()) {
Handle<Object> result = JSReceiver::SetProperty(
receiver, name, value, NONE, strict_mode(), store_mode);
RETURN_IF_EMPTY_HANDLE(isolate(), result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate(), result,
JSReceiver::SetProperty(
receiver, name, value, NONE, strict_mode(), store_mode));
return *result;
}
@ -1263,9 +1267,11 @@ MaybeObject* StoreIC::Store(Handle<Object> object,
}
// Set the property.
Handle<Object> result = JSReceiver::SetProperty(
receiver, name, value, NONE, strict_mode(), store_mode);
RETURN_IF_EMPTY_HANDLE(isolate(), result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate(), result,
JSReceiver::SetProperty(
receiver, name, value, NONE, strict_mode(), store_mode));
return *result;
}
@ -1661,12 +1667,11 @@ MaybeObject* KeyedStoreIC::Store(Handle<Object> object,
Handle<Object> key,
Handle<Object> value) {
if (MigrateDeprecated(object)) {
Handle<Object> result = Runtime::SetObjectProperty(isolate(), object,
key,
value,
NONE,
strict_mode());
RETURN_IF_EMPTY_HANDLE(isolate(), result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate(), result,
Runtime::SetObjectProperty(
isolate(), object, key, value, NONE, strict_mode()));
return *result;
}
@ -1734,11 +1739,11 @@ MaybeObject* KeyedStoreIC::Store(Handle<Object> object,
}
if (maybe_object) return maybe_object;
Handle<Object> result = Runtime::SetObjectProperty(isolate(), object, key,
value,
NONE,
strict_mode());
RETURN_IF_EMPTY_HANDLE(isolate(), result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate(), result,
Runtime::SetObjectProperty(
isolate(), object, key, value, NONE, strict_mode()));
return *result;
}
@ -1910,11 +1915,11 @@ RUNTIME_FUNCTION(MaybeObject*, StoreIC_Slow) {
Handle<Object> key = args.at<Object>(1);
Handle<Object> value = args.at<Object>(2);
StrictMode strict_mode = ic.strict_mode();
Handle<Object> result = Runtime::SetObjectProperty(isolate, object, key,
value,
NONE,
strict_mode);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Runtime::SetObjectProperty(
isolate, object, key, value, NONE, strict_mode));
return *result;
}
@ -1927,11 +1932,11 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Slow) {
Handle<Object> key = args.at<Object>(1);
Handle<Object> value = args.at<Object>(2);
StrictMode strict_mode = ic.strict_mode();
Handle<Object> result = Runtime::SetObjectProperty(isolate, object, key,
value,
NONE,
strict_mode);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Runtime::SetObjectProperty(
isolate, object, key, value, NONE, strict_mode));
return *result;
}
@ -1949,11 +1954,11 @@ RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss) {
JSObject::TransitionElementsKind(Handle<JSObject>::cast(object),
map->elements_kind());
}
Handle<Object> result = Runtime::SetObjectProperty(isolate, object, key,
value,
NONE,
strict_mode);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Runtime::SetObjectProperty(
isolate, object, key, value, NONE, strict_mode));
return *result;
}

View File

@ -573,41 +573,31 @@ Handle<JSArray> Isolate::CaptureCurrentStackTrace(
// tag.
column_offset += script->column_offset()->value();
}
CHECK_NOT_EMPTY_HANDLE(
this,
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, column_key,
Handle<Smi>(Smi::FromInt(column_offset + 1), this), NONE));
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, column_key,
Handle<Smi>(Smi::FromInt(column_offset + 1), this), NONE).Check();
}
CHECK_NOT_EMPTY_HANDLE(
this,
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, line_key,
Handle<Smi>(Smi::FromInt(line_number + 1), this), NONE));
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, line_key,
Handle<Smi>(Smi::FromInt(line_number + 1), this), NONE).Check();
}
if (options & StackTrace::kScriptId) {
Handle<Smi> script_id(script->id(), this);
CHECK_NOT_EMPTY_HANDLE(this,
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, script_id_key, script_id,
NONE));
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, script_id_key, script_id, NONE).Check();
}
if (options & StackTrace::kScriptName) {
Handle<Object> script_name(script->name(), this);
CHECK_NOT_EMPTY_HANDLE(this,
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, script_name_key, script_name,
NONE));
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, script_name_key, script_name, NONE).Check();
}
if (options & StackTrace::kScriptNameOrSourceURL) {
Handle<Object> result = GetScriptNameOrSourceURL(script);
CHECK_NOT_EMPTY_HANDLE(this,
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, script_name_or_source_url_key,
result, NONE));
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, script_name_or_source_url_key, result, NONE).Check();
}
if (options & StackTrace::kFunctionName) {
@ -615,27 +605,23 @@ Handle<JSArray> Isolate::CaptureCurrentStackTrace(
if (!fun_name->BooleanValue()) {
fun_name = Handle<Object>(fun->shared()->inferred_name(), this);
}
CHECK_NOT_EMPTY_HANDLE(this,
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, function_key, fun_name, NONE));
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, function_key, fun_name, NONE).Check();
}
if (options & StackTrace::kIsEval) {
Handle<Object> is_eval =
script->compilation_type() == Script::COMPILATION_TYPE_EVAL ?
factory()->true_value() : factory()->false_value();
CHECK_NOT_EMPTY_HANDLE(this,
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, eval_key, is_eval, NONE));
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, eval_key, is_eval, NONE).Check();
}
if (options & StackTrace::kIsConstructor) {
Handle<Object> is_constructor = (frames[i].is_constructor()) ?
factory()->true_value() : factory()->false_value();
CHECK_NOT_EMPTY_HANDLE(this,
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, constructor_key,
is_constructor, NONE));
JSObject::SetLocalPropertyIgnoreAttributes(
stack_frame, constructor_key, is_constructor, NONE).Check();
}
FixedArray::cast(stack_trace->elements())->set(frames_seen, *stack_frame);
@ -2310,7 +2296,7 @@ Handle<JSObject> Isolate::GetSymbolRegistry() {
Handle<String> name = factory()->InternalizeUtf8String(nested[i]);
Handle<JSObject> obj = factory()->NewJSObjectFromMap(map);
JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8);
JSObject::SetProperty(registry, name, obj, NONE, STRICT);
JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert();
}
}
return Handle<JSObject>::cast(factory()->symbol_registry());

View File

@ -177,7 +177,7 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T) \
ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, MaybeHandle<T>())
#define RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value) \
#define RETURN_ON_EXCEPTION_VALUE(isolate, call, value) \
do { \
if ((call).is_null()) { \
ASSERT((isolate)->has_pending_exception()); \
@ -186,11 +186,10 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
} while (false)
#define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \
RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, Failure::Exception())
RETURN_ON_EXCEPTION_VALUE(isolate, call, Failure::Exception())
#define RETURN_ON_EXCEPTION(isolate, call, T) \
RETURN_ON_EXCEPTION_VALUE( \
isolate, dst, call, MaybeHandle<T>::Exception())
RETURN_ON_EXCEPTION_VALUE(isolate, call, MaybeHandle<T>())
#define FOR_EACH_ISOLATE_ADDRESS_NAME(C) \

View File

@ -43,7 +43,7 @@ namespace internal {
template <bool seq_ascii>
class JsonParser BASE_EMBEDDED {
public:
static MaybeHandle<Object> Parse(Handle<String> source) {
MUST_USE_RESULT static MaybeHandle<Object> Parse(Handle<String> source) {
return JsonParser(source).ParseJson();
}
@ -442,7 +442,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
}
JSObject::SetLocalPropertyIgnoreAttributes(
json_object, key, value, NONE);
json_object, key, value, NONE).Assert();
} while (MatchSkipWhiteSpace(','));
if (c0_ != '}') {
return ReportUnexpectedCharacter();

View File

@ -956,11 +956,11 @@ JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
Handle<Smi> end_pos(Smi::FromInt(message_location.end_pos()), isolate);
Handle<JSValue> script_obj = GetScriptWrapper(message_location.script());
JSReceiver::SetProperty(
rethrow_exception, start_pos_key, start_pos, NONE, SLOPPY);
rethrow_exception, start_pos_key, start_pos, NONE, SLOPPY).Assert();
JSReceiver::SetProperty(
rethrow_exception, end_pos_key, end_pos, NONE, SLOPPY);
rethrow_exception, end_pos_key, end_pos, NONE, SLOPPY).Assert();
JSReceiver::SetProperty(
rethrow_exception, script_obj_key, script_obj, NONE, SLOPPY);
rethrow_exception, script_obj_key, script_obj, NONE, SLOPPY).Assert();
}
}

View File

@ -2119,16 +2119,17 @@ void JSObject::AddSlowProperty(Handle<JSObject> object,
}
Handle<Object> JSObject::AddProperty(Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
JSReceiver::StoreFromKeyed store_mode,
ExtensibilityCheck extensibility_check,
ValueType value_type,
StoreMode mode,
TransitionFlag transition_flag) {
MaybeHandle<Object> JSObject::AddProperty(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
JSReceiver::StoreFromKeyed store_mode,
ExtensibilityCheck extensibility_check,
ValueType value_type,
StoreMode mode,
TransitionFlag transition_flag) {
ASSERT(!object->IsJSGlobalProxy());
Isolate* isolate = object->GetIsolate();
@ -2145,8 +2146,7 @@ Handle<Object> JSObject::AddProperty(Handle<JSObject> object,
Handle<Object> args[1] = { name };
Handle<Object> error = isolate->factory()->NewTypeError(
"object_not_extensible", HandleVector(args, ARRAY_SIZE(args)));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
}
@ -2206,14 +2206,15 @@ void JSObject::EnqueueChangeRecord(Handle<JSObject> object,
}
Handle<Object> JSObject::SetPropertyPostInterceptor(
MaybeHandle<Object> JSObject::SetPropertyPostInterceptor(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode) {
// Check local property, ignore interceptor.
LookupResult result(object->GetIsolate());
Isolate* isolate = object->GetIsolate();
LookupResult result(isolate);
object->LocalLookupRealNamedProperty(*name, &result);
if (!result.IsFound()) {
object->map()->LookupTransition(*object, *name, &result);
@ -2225,8 +2226,12 @@ Handle<Object> JSObject::SetPropertyPostInterceptor(
strict_mode, MAY_BE_STORE_FROM_KEYED);
}
bool done = false;
Handle<Object> result_object = SetPropertyViaPrototypes(
object, name, value, attributes, strict_mode, &done);
Handle<Object> result_object;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result_object,
SetPropertyViaPrototypes(
object, name, value, attributes, strict_mode, &done),
Object);
if (done) return result_object;
// Add a new real property.
return AddProperty(object, name, value, attributes, strict_mode);
@ -2837,7 +2842,7 @@ Handle<Map> Map::CurrentMapForDeprecatedInternal(Handle<Map> map) {
}
Handle<Object> JSObject::SetPropertyWithInterceptor(
MaybeHandle<Object> JSObject::SetPropertyWithInterceptor(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
@ -2860,22 +2865,20 @@ Handle<Object> JSObject::SetPropertyWithInterceptor(
v8::Handle<v8::Value> result = args.Call(setter,
v8::Utils::ToLocal(name_string),
v8::Utils::ToLocal(value_unhole));
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
if (!result.IsEmpty()) return value;
}
Handle<Object> result =
SetPropertyPostInterceptor(object, name, value, attributes, strict_mode);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
return result;
return SetPropertyPostInterceptor(
object, name, value, attributes, strict_mode);
}
Handle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode) {
MaybeHandle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode) {
LookupResult result(object->GetIsolate());
object->LocalLookup(*name, &result, true);
if (!result.IsFound()) {
@ -2886,12 +2889,12 @@ Handle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object,
}
Handle<Object> JSObject::SetPropertyWithCallback(Handle<JSObject> object,
Handle<Object> structure,
Handle<Name> name,
Handle<Object> value,
Handle<JSObject> holder,
StrictMode strict_mode) {
MaybeHandle<Object> JSObject::SetPropertyWithCallback(Handle<JSObject> object,
Handle<Object> structure,
Handle<Name> name,
Handle<Object> value,
Handle<JSObject> holder,
StrictMode strict_mode) {
Isolate* isolate = object->GetIsolate();
// We should never get here to initialize a const with the hole
@ -2910,7 +2913,7 @@ Handle<Object> JSObject::SetPropertyWithCallback(Handle<JSObject> object,
isolate, *object, *value, callback->data),
break,
return Handle<Object>());
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return value;
}
@ -2923,8 +2926,7 @@ Handle<Object> JSObject::SetPropertyWithCallback(Handle<JSObject> object,
isolate->factory()->NewTypeError("incompatible_method_receiver",
HandleVector(args,
ARRAY_SIZE(args)));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
// TODO(rossberg): Support symbols in the API.
if (name->IsSymbol()) return value;
@ -2939,7 +2941,7 @@ Handle<Object> JSObject::SetPropertyWithCallback(Handle<JSObject> object,
args.Call(call_fun,
v8::Utils::ToLocal(key),
v8::Utils::ToLocal(value));
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return value;
}
@ -2955,8 +2957,7 @@ Handle<Object> JSObject::SetPropertyWithCallback(Handle<JSObject> object,
Handle<Object> error =
isolate->factory()->NewTypeError("no_setter_in_callback",
HandleVector(args, 2));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
}
@ -2966,7 +2967,7 @@ Handle<Object> JSObject::SetPropertyWithCallback(Handle<JSObject> object,
}
UNREACHABLE();
return Handle<Object>();
return MaybeHandle<Object>();
}
@ -3037,12 +3038,13 @@ Handle<Object> JSObject::SetElementWithCallbackSetterInPrototypes(
}
Handle<Object> JSObject::SetPropertyViaPrototypes(Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
bool* done) {
MaybeHandle<Object> JSObject::SetPropertyViaPrototypes(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
bool* done) {
Isolate* isolate = object->GetIsolate();
*done = false;
@ -3087,8 +3089,7 @@ Handle<Object> JSObject::SetPropertyViaPrototypes(Handle<JSObject> object,
Handle<Object> args[] = { name, object };
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);
}
return isolate->factory()->the_hole_value();
}
@ -3457,7 +3458,7 @@ void JSObject::LookupRealNamedPropertyInPrototypes(Name* name,
// We only need to deal with CALLBACKS and INTERCEPTORS
Handle<Object> JSObject::SetPropertyWithFailedAccessCheck(
MaybeHandle<Object> JSObject::SetPropertyWithFailedAccessCheck(
Handle<JSObject> object,
LookupResult* result,
Handle<Name> name,
@ -3520,18 +3521,18 @@ Handle<Object> JSObject::SetPropertyWithFailedAccessCheck(
Isolate* isolate = object->GetIsolate();
isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_SET);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return value;
}
Handle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object,
LookupResult* result,
Handle<Name> key,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode) {
MaybeHandle<Object> JSReceiver::SetProperty(Handle<JSReceiver> object,
LookupResult* result,
Handle<Name> key,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode) {
if (result->IsHandler()) {
return JSProxy::SetPropertyWithHandler(handle(result->proxy()),
object, key, value, attributes, strict_mode);
@ -3886,7 +3887,7 @@ Handle<Object> JSObject::TryMigrateInstance(Handle<JSObject> object) {
}
Handle<Object> JSObject::SetPropertyUsingTransition(
MaybeHandle<Object> JSObject::SetPropertyUsingTransition(
Handle<JSObject> object,
LookupResult* lookup,
Handle<Name> name,
@ -4012,13 +4013,14 @@ static void SetPropertyToFieldWithAttributes(LookupResult* lookup,
}
Handle<Object> JSObject::SetPropertyForResult(Handle<JSObject> object,
LookupResult* lookup,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode) {
MaybeHandle<Object> JSObject::SetPropertyForResult(
Handle<JSObject> object,
LookupResult* lookup,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode) {
Isolate* isolate = object->GetIsolate();
// Make sure that the top context does not change when doing callbacks or
@ -4054,8 +4056,12 @@ Handle<Object> JSObject::SetPropertyForResult(Handle<JSObject> object,
if (!lookup->IsProperty() && !object->IsJSContextExtensionObject()) {
bool done = false;
Handle<Object> result_object = SetPropertyViaPrototypes(
object, name, value, attributes, strict_mode, &done);
Handle<Object> result_object;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result_object,
SetPropertyViaPrototypes(
object, name, value, attributes, strict_mode, &done),
Object);
if (done) return result_object;
}
@ -4070,8 +4076,7 @@ Handle<Object> JSObject::SetPropertyForResult(Handle<JSObject> object,
Handle<Object> args[] = { name, object };
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);
} else {
return value;
}
@ -4087,10 +4092,10 @@ Handle<Object> JSObject::SetPropertyForResult(Handle<JSObject> object,
// This is a real property that is not read-only, or it is a
// transition or null descriptor and there are no setters in the prototypes.
Handle<Object> result = value;
MaybeHandle<Object> maybe_result = value;
if (lookup->IsTransition()) {
result = SetPropertyUsingTransition(handle(lookup->holder()), lookup,
name, value, attributes);
maybe_result = SetPropertyUsingTransition(handle(lookup->holder()), lookup,
name, value, attributes);
} else {
switch (lookup->type()) {
case NORMAL:
@ -4110,7 +4115,7 @@ Handle<Object> JSObject::SetPropertyForResult(Handle<JSObject> object,
handle(lookup->holder()), strict_mode);
}
case INTERCEPTOR:
result = SetPropertyWithInterceptor(
maybe_result = SetPropertyWithInterceptor(
handle(lookup->holder()), name, value, attributes, strict_mode);
break;
case HANDLER:
@ -4119,7 +4124,8 @@ Handle<Object> JSObject::SetPropertyForResult(Handle<JSObject> object,
}
}
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>());
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(isolate, result, maybe_result, Object);
if (is_observed) {
if (lookup->IsTransition()) {
@ -4150,7 +4156,7 @@ Handle<Object> JSObject::SetPropertyForResult(Handle<JSObject> object,
// Note that this method cannot be used to set the prototype of a function
// because ConvertDescriptorToField() which is called in "case CALLBACKS:"
// doesn't handle function prototypes correctly.
Handle<Object> JSObject::SetLocalPropertyIgnoreAttributes(
MaybeHandle<Object> JSObject::SetLocalPropertyIgnoreAttributes(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
@ -4215,9 +4221,12 @@ Handle<Object> JSObject::SetLocalPropertyIgnoreAttributes(
// Check of IsReadOnly removed from here in clone.
if (lookup.IsTransition()) {
Handle<Object> result = SetPropertyUsingTransition(
handle(lookup.holder()), &lookup, name, value, attributes);
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>());
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
SetPropertyUsingTransition(
handle(lookup.holder()), &lookup, name, value, attributes),
Object);
} else {
switch (lookup.type()) {
case NORMAL:
@ -5012,7 +5021,7 @@ Handle<ObjectHashTable> JSObject::GetOrCreateHiddenPropertiesHashtable(
DONT_ENUM,
OPTIMAL_REPRESENTATION,
ALLOW_AS_CONSTANT,
OMIT_EXTENSIBILITY_CHECK);
OMIT_EXTENSIBILITY_CHECK).Assert();
return hashtable;
}
@ -5051,7 +5060,7 @@ Handle<Object> JSObject::SetHiddenPropertiesHashTable(Handle<JSObject> object,
DONT_ENUM,
OPTIMAL_REPRESENTATION,
ALLOW_AS_CONSTANT,
OMIT_EXTENSIBILITY_CHECK);
OMIT_EXTENSIBILITY_CHECK).Assert();
return object;
}
@ -5790,8 +5799,8 @@ Handle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>());
if (copying) {
// Creating object copy for literals. No strict mode needed.
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetProperty(
copy, key_string, result, NONE, SLOPPY));
JSObject::SetProperty(
copy, key_string, result, NONE, SLOPPY).Assert();
}
}
}
@ -11436,7 +11445,7 @@ Handle<Object> JSArray::SetElementsLength(Handle<JSArray> array,
SetProperty(deleted, isolate->factory()->length_string(),
isolate->factory()->NewNumberFromUint(delete_count),
NONE, SLOPPY);
NONE, SLOPPY).Assert();
}
EnqueueSpliceRecord(array, index, deleted, add_count);

View File

@ -2039,13 +2039,13 @@ class JSReceiver: public HeapObject {
static inline JSReceiver* cast(Object* obj);
// Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5.
static Handle<Object> SetProperty(Handle<JSReceiver> object,
Handle<Name> key,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_mode =
MAY_BE_STORE_FROM_KEYED);
MUST_USE_RESULT static MaybeHandle<Object> SetProperty(
Handle<JSReceiver> object,
Handle<Name> key,
Handle<Object> value,
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,
@ -2130,13 +2130,14 @@ class JSReceiver: public HeapObject {
Handle<Name> name,
bool continue_search);
static Handle<Object> SetProperty(Handle<JSReceiver> receiver,
LookupResult* result,
Handle<Name> key,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_from_keyed);
MUST_USE_RESULT static MaybeHandle<Object> SetProperty(
Handle<JSReceiver> receiver,
LookupResult* result,
Handle<Name> key,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
StoreFromKeyed store_from_keyed);
DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver);
};
@ -2252,7 +2253,7 @@ class JSObject: public JSReceiver {
Handle<Object> structure,
Handle<Name> name);
static Handle<Object> SetPropertyWithCallback(
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithCallback(
Handle<JSObject> object,
Handle<Object> structure,
Handle<Name> name,
@ -2260,14 +2261,14 @@ class JSObject: public JSReceiver {
Handle<JSObject> holder,
StrictMode strict_mode);
static Handle<Object> SetPropertyWithInterceptor(
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode);
static Handle<Object> SetPropertyForResult(
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyForResult(
Handle<JSObject> object,
LookupResult* result,
Handle<Name> name,
@ -2276,7 +2277,7 @@ class JSObject: public JSReceiver {
StrictMode strict_mode,
StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
static Handle<Object> SetLocalPropertyIgnoreAttributes(
MUST_USE_RESULT static MaybeHandle<Object> SetLocalPropertyIgnoreAttributes(
Handle<JSObject> object,
Handle<Name> key,
Handle<Object> value,
@ -2640,7 +2641,7 @@ class JSObject: public JSReceiver {
static Handle<Object> PreventExtensions(Handle<JSObject> object);
// ES5 Object.freeze
static MaybeHandle<Object> Freeze(Handle<JSObject> object);
MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object);
// Called the first time an object is observed with ES7 Object.observe.
static void SetObserved(Handle<JSObject> object);
@ -2842,26 +2843,26 @@ class JSObject: public JSReceiver {
// has a setter, invoke it and set '*done' to true. If it is found and is
// read-only, reject and set '*done' to true. Otherwise, set '*done' to
// false. Can throw and return an empty handle with '*done==true'.
static Handle<Object> SetPropertyViaPrototypes(
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyViaPrototypes(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
bool* done);
static Handle<Object> SetPropertyPostInterceptor(
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyPostInterceptor(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode);
static Handle<Object> SetPropertyUsingTransition(
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyUsingTransition(
Handle<JSObject> object,
LookupResult* lookup,
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes);
static Handle<Object> SetPropertyWithFailedAccessCheck(
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck(
Handle<JSObject> object,
LookupResult* result,
Handle<Name> name,
@ -2870,7 +2871,7 @@ class JSObject: public JSReceiver {
StrictMode strict_mode);
// Add a property to an object.
static Handle<Object> AddProperty(
MUST_USE_RESULT static MaybeHandle<Object> AddProperty(
Handle<JSObject> object,
Handle<Name> name,
Handle<Object> value,

View File

@ -213,13 +213,13 @@ static Handle<Map> ComputeObjectLiteralMap(
}
static Handle<Object> CreateLiteralBoilerplate(
MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate(
Isolate* isolate,
Handle<FixedArray> literals,
Handle<FixedArray> constant_properties);
static Handle<Object> CreateObjectLiteralBoilerplate(
MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
Isolate* isolate,
Handle<FixedArray> literals,
Handle<FixedArray> constant_properties,
@ -274,27 +274,29 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
// The value contains the constant_properties of a
// simple object or array literal.
Handle<FixedArray> array = Handle<FixedArray>::cast(value);
value = CreateLiteralBoilerplate(isolate, literals, array);
if (value.is_null()) return value;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, value,
CreateLiteralBoilerplate(isolate, literals, array),
Object);
}
Handle<Object> result;
MaybeHandle<Object> maybe_result;
uint32_t element_index = 0;
StoreMode mode = value->IsJSObject() ? FORCE_FIELD : ALLOW_AS_CONSTANT;
if (key->IsInternalizedString()) {
if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) {
// Array index as string (uint32).
result = JSObject::SetOwnElement(
maybe_result = JSObject::SetOwnElement(
boilerplate, element_index, value, SLOPPY);
} else {
Handle<String> name(String::cast(*key));
ASSERT(!name->AsArrayIndex(&element_index));
result = JSObject::SetLocalPropertyIgnoreAttributes(
maybe_result = JSObject::SetLocalPropertyIgnoreAttributes(
boilerplate, name, value, NONE,
Object::OPTIMAL_REPRESENTATION, mode);
}
} else if (key->ToArrayIndex(&element_index)) {
// Array index (uint32).
result = JSObject::SetOwnElement(
maybe_result = JSObject::SetOwnElement(
boilerplate, element_index, value, SLOPPY);
} else {
// Non-uint32 number.
@ -305,7 +307,7 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
const char* str = DoubleToCString(num, buffer);
Handle<String> name =
isolate->factory()->NewStringFromAscii(CStrVector(str));
result = JSObject::SetLocalPropertyIgnoreAttributes(
maybe_result = JSObject::SetLocalPropertyIgnoreAttributes(
boilerplate, name, value, NONE,
Object::OPTIMAL_REPRESENTATION, mode);
}
@ -313,7 +315,7 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
// exception, the exception is converted to an empty handle in
// the handle based operations. In that case, we need to
// convert back to an exception.
if (result.is_null()) return result;
RETURN_ON_EXCEPTION(isolate, maybe_result, Object);
}
// Transform to fast properties if necessary. For object literals with
@ -347,7 +349,7 @@ MaybeObject* TransitionElements(Handle<Object> object,
static const int kSmiLiteralMinimumLength = 1024;
Handle<Object> Runtime::CreateArrayLiteralBoilerplate(
MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate(
Isolate* isolate,
Handle<FixedArray> literals,
Handle<FixedArray> elements) {
@ -406,9 +408,11 @@ Handle<Object> Runtime::CreateArrayLiteralBoilerplate(
// The value contains the constant_properties of a
// simple object or array literal.
Handle<FixedArray> fa(FixedArray::cast(fixed_array_values->get(i)));
Handle<Object> result =
CreateLiteralBoilerplate(isolate, literals, fa);
if (result.is_null()) return result;
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
CreateLiteralBoilerplate(isolate, literals, fa),
Object);
fixed_array_values_copy->set(i, *result);
}
}
@ -437,7 +441,7 @@ Handle<Object> Runtime::CreateArrayLiteralBoilerplate(
}
static Handle<Object> CreateLiteralBoilerplate(
MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate(
Isolate* isolate,
Handle<FixedArray> literals,
Handle<FixedArray> array) {
@ -461,7 +465,7 @@ static Handle<Object> CreateLiteralBoilerplate(
isolate, literals, elements);
default:
UNREACHABLE();
return Handle<Object>::null();
return MaybeHandle<Object>();
}
}
@ -481,13 +485,15 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateObjectLiteral) {
Handle<AllocationSite> site;
Handle<JSObject> boilerplate;
if (*literal_site == isolate->heap()->undefined_value()) {
Handle<Object> raw_boilerplate = CreateObjectLiteralBoilerplate(
isolate,
literals,
constant_properties,
should_have_fast_elements,
has_function_literal);
RETURN_IF_EMPTY_HANDLE(isolate, raw_boilerplate);
Handle<Object> raw_boilerplate;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, raw_boilerplate,
CreateObjectLiteralBoilerplate(
isolate,
literals,
constant_properties,
should_have_fast_elements,
has_function_literal));
boilerplate = Handle<JSObject>::cast(raw_boilerplate);
AllocationSiteCreationContext creation_context(isolate);
@ -513,7 +519,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateObjectLiteral) {
}
static Handle<AllocationSite> GetLiteralAllocationSite(
MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite(
Isolate* isolate,
Handle<FixedArray> literals,
int literals_index,
@ -523,9 +529,11 @@ static Handle<AllocationSite> GetLiteralAllocationSite(
Handle<AllocationSite> site;
if (*literal_site == isolate->heap()->undefined_value()) {
ASSERT(*elements != isolate->heap()->empty_fixed_array());
Handle<Object> boilerplate =
Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements);
if (boilerplate.is_null()) return Handle<AllocationSite>::null();
Handle<Object> boilerplate;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, boilerplate,
Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements),
AllocationSite);
AllocationSiteCreationContext creation_context(isolate);
site = creation_context.EnterNewScope();
@ -549,9 +557,10 @@ static MaybeObject* CreateArrayLiteralImpl(Isolate* isolate,
int literals_index,
Handle<FixedArray> elements,
int flags) {
Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals,
literals_index, elements);
RETURN_IF_EMPTY_HANDLE(isolate, site);
Handle<AllocationSite> site;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, site,
GetLiteralAllocationSite(isolate, literals, literals_index, elements));
bool enable_mementos = (flags & ArrayLiteral::kDisableMementos) == 0;
Handle<JSObject> boilerplate(JSObject::cast(site->transition_info()));
@ -632,7 +641,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateGlobalPrivateSymbol) {
ASSERT(symbol->IsUndefined());
symbol = isolate->factory()->NewPrivateSymbol();
Handle<Symbol>::cast(symbol)->set_name(*name);
JSObject::SetProperty(privates, name, symbol, NONE, STRICT);
JSObject::SetProperty(privates, name, symbol, NONE, STRICT).Assert();
}
return *symbol;
}
@ -2207,7 +2216,8 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeclareGlobals) {
global, name, value, static_cast<PropertyAttributes>(attr)));
} else {
// Do a [[Put]] on the existing (own) property.
RETURN_IF_EMPTY_HANDLE(isolate,
RETURN_FAILURE_ON_EXCEPTION(
isolate,
JSObject::SetProperty(
global, name, value, static_cast<PropertyAttributes>(attr),
strict_mode));
@ -2263,7 +2273,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeclareContextSlot) {
// Slow case: The property is in the context extension object of a
// function context or the global object of a native context.
Handle<JSObject> object = Handle<JSObject>::cast(holder);
RETURN_IF_EMPTY_HANDLE(
RETURN_FAILURE_ON_EXCEPTION(
isolate,
JSReceiver::SetProperty(object, name, initial_value, mode, SLOPPY));
}
@ -2310,7 +2320,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeclareContextSlot) {
RETURN_IF_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(object, name, value, mode));
} else {
RETURN_IF_EMPTY_HANDLE(isolate,
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSReceiver::SetProperty(object, name, value, mode, SLOPPY));
}
}
@ -2355,9 +2365,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
// Found an interceptor that's not read only.
if (assign) {
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
Handle<Object> result = JSObject::SetPropertyForResult(
holder, &lookup, name, value, attributes, strict_mode);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSObject::SetPropertyForResult(
holder, &lookup, name, value, attributes, strict_mode));
return *result;
} else {
return isolate->heap()->undefined_value();
@ -2368,9 +2380,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
if (assign) {
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
Handle<GlobalObject> global(isolate->context()->global_object());
Handle<Object> result = JSReceiver::SetProperty(
global, name, value, attributes, strict_mode);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSReceiver::SetProperty(global, name, value, attributes, strict_mode));
return *result;
}
return isolate->heap()->undefined_value();
@ -2421,7 +2434,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_InitializeConstGlobal) {
// property through an interceptor and only do it if it's
// uninitialized, e.g. the hole. Nirk...
// Passing sloppy mode because the property is writable.
RETURN_IF_EMPTY_HANDLE(
RETURN_FAILURE_ON_EXCEPTION(
isolate,
JSReceiver::SetProperty(global, name, value, attributes, SLOPPY));
return *value;
@ -2491,7 +2504,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_InitializeConstContextSlot) {
Handle<JSObject> global = Handle<JSObject>(
isolate->context()->global_object());
// Strict mode not needed (const disallowed in strict mode).
RETURN_IF_EMPTY_HANDLE(
RETURN_FAILURE_ON_EXCEPTION(
isolate,
JSReceiver::SetProperty(global, name, value, NONE, SLOPPY));
return *value;
@ -2542,7 +2555,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_InitializeConstContextSlot) {
// read-only property.
if ((attributes & READ_ONLY) == 0) {
// Strict mode not needed (const disallowed in strict mode).
RETURN_IF_EMPTY_HANDLE(
RETURN_FAILURE_ON_EXCEPTION(
isolate,
JSReceiver::SetProperty(object, name, value, attributes, SLOPPY));
}
@ -2704,7 +2717,7 @@ static Handle<JSFunction> InstallBuiltin(Isolate* isolate,
code,
false);
optimized->shared()->DontAdaptArguments();
JSReceiver::SetProperty(holder, key, optimized, NONE, STRICT);
JSReceiver::SetProperty(holder, key, optimized, NONE, STRICT).Assert();
return optimized;
}
@ -5165,14 +5178,15 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) {
// TODO(mstarzinger): So far this only works if property attributes don't
// change, this should be fixed once we cleanup the underlying code.
if (callback->IsForeign() && lookup.GetAttributes() == attr) {
Handle<Object> result_object =
Handle<Object> result_object;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result_object,
JSObject::SetPropertyWithCallback(js_object,
callback,
name,
obj_value,
handle(lookup.holder()),
STRICT);
RETURN_IF_EMPTY_HANDLE(isolate, result_object);
STRICT));
return *result_object;
}
}
@ -5194,17 +5208,18 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) {
JSObject::NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0);
// Use IgnoreAttributes version since a readonly property may be
// overridden and SetProperty does not allow this.
Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes(
js_object, name, obj_value, attr);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSObject::SetLocalPropertyIgnoreAttributes(
js_object, name, obj_value, attr));
return *result;
}
Handle<Object> result = Runtime::ForceSetObjectProperty(isolate, js_object,
name,
obj_value,
attr);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Runtime::ForceSetObjectProperty(js_object, name, obj_value, attr));
return *result;
}
@ -5239,12 +5254,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDataProperty) {
}
Handle<Object> Runtime::SetObjectProperty(Isolate* isolate,
Handle<Object> object,
Handle<Object> key,
Handle<Object> value,
PropertyAttributes attr,
StrictMode strict_mode) {
MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
Handle<Object> object,
Handle<Object> key,
Handle<Object> value,
PropertyAttributes attr,
StrictMode strict_mode) {
SetPropertyMode set_mode = attr == NONE ? SET_PROPERTY : DEFINE_PROPERTY;
if (object->IsUndefined() || object->IsNull()) {
@ -5343,11 +5358,11 @@ Handle<Object> Runtime::SetObjectProperty(Isolate* isolate,
}
Handle<Object> Runtime::ForceSetObjectProperty(Isolate* isolate,
Handle<JSObject> js_object,
Handle<Object> key,
Handle<Object> value,
PropertyAttributes attr) {
MaybeHandle<Object> Runtime::ForceSetObjectProperty(Handle<JSObject> js_object,
Handle<Object> key,
Handle<Object> value,
PropertyAttributes attr) {
Isolate* isolate = js_object->GetIsolate();
// Check if the given key is an array index.
uint32_t index;
if (key->ToArrayIndex(&index)) {
@ -5472,11 +5487,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) {
strict_mode = strict_mode_arg;
}
Handle<Object> result = Runtime::SetObjectProperty(isolate, object, key,
value,
attributes,
strict_mode);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Runtime::SetObjectProperty(
isolate, object, key, value, attributes, strict_mode));
return *result;
}
@ -5635,9 +5650,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) {
(unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
attributes = static_cast<PropertyAttributes>(unchecked_value);
}
Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes(
object, name, value, attributes);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSObject::SetLocalPropertyIgnoreAttributes(
object, name, value, attributes));
return *result;
}
@ -8237,7 +8254,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionBindArguments) {
Handle<Object> new_length(args.at<Object>(3));
PropertyAttributes attr =
static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY);
ForceSetProperty(bound_function, length_string, new_length, attr);
Runtime::ForceSetObjectProperty(
bound_function, length_string, new_length, attr).Assert();
return *bound_function;
}
@ -9172,7 +9190,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeclareModules) {
case MODULE: {
Object* referenced_context = Context::cast(host_context)->get(index);
Handle<JSModule> value(Context::cast(referenced_context)->module());
JSReceiver::SetProperty(module, name, value, FROZEN, STRICT);
JSReceiver::SetProperty(module, name, value, FROZEN, STRICT).Assert();
break;
}
case INTERNAL:
@ -9459,7 +9477,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_StoreContextSlot) {
// Set the property if it's not read only or doesn't yet exist.
if ((attributes & READ_ONLY) == 0 ||
(JSReceiver::GetLocalPropertyAttribute(object, name) == ABSENT)) {
RETURN_IF_EMPTY_HANDLE(
RETURN_FAILURE_ON_EXCEPTION(
isolate,
JSReceiver::SetProperty(object, name, value, NONE, strict_mode));
} else if (strict_mode == STRICT && (attributes & READ_ONLY) != 0) {
@ -11444,7 +11462,8 @@ static bool ParameterIsShadowedByContextLocal(Handle<ScopeInfo> info,
// Create a plain JSObject which materializes the local scope for the specified
// frame.
static Handle<JSObject> MaterializeStackLocalsWithFrameInspector(
MUST_USE_RESULT
static MaybeHandle<JSObject> MaterializeStackLocalsWithFrameInspector(
Isolate* isolate,
Handle<JSObject> target,
Handle<JSFunction> function,
@ -11465,10 +11484,10 @@ static Handle<JSObject> MaterializeStackLocalsWithFrameInspector(
ASSERT(!value->IsTheHole());
Handle<String> name(scope_info->ParameterName(i));
RETURN_IF_EMPTY_HANDLE_VALUE(
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(isolate, target, name, value, NONE, SLOPPY),
Handle<JSObject>());
JSObject);
}
// Second fill all stack locals.
@ -11477,10 +11496,10 @@ static Handle<JSObject> MaterializeStackLocalsWithFrameInspector(
Handle<Object> value(frame_inspector->GetExpression(i), isolate);
if (value->IsTheHole()) continue;
RETURN_IF_EMPTY_HANDLE_VALUE(
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(isolate, target, name, value, NONE, SLOPPY),
Handle<JSObject>());
JSObject);
}
return target;
@ -11525,10 +11544,11 @@ static void UpdateStackLocalsFromMaterializedObject(Isolate* isolate,
}
static Handle<JSObject> MaterializeLocalContext(Isolate* isolate,
Handle<JSObject> target,
Handle<JSFunction> function,
JavaScriptFrame* frame) {
MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeLocalContext(
Isolate* isolate,
Handle<JSObject> target,
Handle<JSFunction> function,
JavaScriptFrame* frame) {
HandleScope scope(isolate);
Handle<SharedFunctionInfo> shared(function->shared());
Handle<ScopeInfo> scope_info(shared->scope_info());
@ -11540,7 +11560,7 @@ static Handle<JSObject> MaterializeLocalContext(Isolate* isolate,
Handle<Context> function_context(frame_context->declaration_context());
if (!ScopeInfo::CopyContextLocalsToScopeObject(
scope_info, function_context, target)) {
return Handle<JSObject>();
return MaybeHandle<JSObject>();
}
// Finally copy any properties from the function context extension.
@ -11558,7 +11578,7 @@ static Handle<JSObject> MaterializeLocalContext(Isolate* isolate,
// Names of variables introduced by eval are strings.
ASSERT(keys->get(i)->IsString());
Handle<String> key(String::cast(keys->get(i)));
RETURN_IF_EMPTY_HANDLE_VALUE(
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(isolate,
target,
@ -11566,7 +11586,7 @@ static Handle<JSObject> MaterializeLocalContext(Isolate* isolate,
Object::GetPropertyOrElement(ext, key),
NONE,
SLOPPY),
Handle<JSObject>());
JSObject);
}
}
}
@ -11575,7 +11595,7 @@ static Handle<JSObject> MaterializeLocalContext(Isolate* isolate,
}
static Handle<JSObject> MaterializeLocalScope(
MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeLocalScope(
Isolate* isolate,
JavaScriptFrame* frame,
int inlined_jsframe_index) {
@ -11584,9 +11604,11 @@ static Handle<JSObject> MaterializeLocalScope(
Handle<JSObject> local_scope =
isolate->factory()->NewJSObject(isolate->object_function());
local_scope = MaterializeStackLocalsWithFrameInspector(
isolate, local_scope, function, &frame_inspector);
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, local_scope, Handle<JSObject>());
ASSIGN_RETURN_ON_EXCEPTION(
isolate, local_scope,
MaterializeStackLocalsWithFrameInspector(
isolate, local_scope, function, &frame_inspector),
JSObject);
return MaterializeLocalContext(isolate, local_scope, function, frame);
}
@ -11666,7 +11688,7 @@ static bool SetLocalVariableValue(Isolate* isolate,
// We don't expect this to do anything except replacing
// property value.
Runtime::SetObjectProperty(isolate, ext, variable_name, new_value,
NONE, SLOPPY);
NONE, SLOPPY).Assert();
return true;
}
}
@ -11679,8 +11701,9 @@ static bool SetLocalVariableValue(Isolate* isolate,
// Create a plain JSObject which materializes the closure content for the
// context.
static Handle<JSObject> MaterializeClosure(Isolate* isolate,
Handle<Context> context) {
MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeClosure(
Isolate* isolate,
Handle<Context> context) {
ASSERT(context->IsFunctionContext());
Handle<SharedFunctionInfo> shared(context->closure()->shared());
@ -11694,7 +11717,7 @@ static Handle<JSObject> MaterializeClosure(Isolate* isolate,
// Fill all context locals to the context extension.
if (!ScopeInfo::CopyContextLocalsToScopeObject(
scope_info, context, closure_scope)) {
return Handle<JSObject>();
return MaybeHandle<JSObject>();
}
// Finally copy any properties from the function context extension. This will
@ -11710,12 +11733,12 @@ static Handle<JSObject> MaterializeClosure(Isolate* isolate,
// Names of variables introduced by eval are strings.
ASSERT(keys->get(i)->IsString());
Handle<String> key(String::cast(keys->get(i)));
RETURN_IF_EMPTY_HANDLE_VALUE(
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(isolate, closure_scope, key,
Object::GetPropertyOrElement(ext, key),
NONE, SLOPPY),
Handle<JSObject>());
JSObject);
}
}
@ -11746,7 +11769,7 @@ static bool SetClosureVariableValue(Isolate* isolate,
if (JSReceiver::HasProperty(ext, variable_name)) {
// We don't expect this to do anything except replacing property value.
Runtime::SetObjectProperty(isolate, ext, variable_name, new_value,
NONE, SLOPPY);
NONE, SLOPPY).Assert();
return true;
}
}
@ -11757,19 +11780,20 @@ static bool SetClosureVariableValue(Isolate* isolate,
// Create a plain JSObject which materializes the scope for the specified
// catch context.
static Handle<JSObject> MaterializeCatchScope(Isolate* isolate,
Handle<Context> context) {
MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeCatchScope(
Isolate* isolate,
Handle<Context> context) {
ASSERT(context->IsCatchContext());
Handle<String> name(String::cast(context->extension()));
Handle<Object> thrown_object(context->get(Context::THROWN_OBJECT_INDEX),
isolate);
Handle<JSObject> catch_scope =
isolate->factory()->NewJSObject(isolate->object_function());
RETURN_IF_EMPTY_HANDLE_VALUE(
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(isolate, catch_scope, name, thrown_object,
NONE, SLOPPY),
Handle<JSObject>());
JSObject);
return catch_scope;
}
@ -11790,7 +11814,7 @@ static bool SetCatchVariableValue(Isolate* isolate,
// Create a plain JSObject which materializes the block scope for the specified
// block context.
static Handle<JSObject> MaterializeBlockScope(
MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeBlockScope(
Isolate* isolate,
Handle<Context> context) {
ASSERT(context->IsBlockContext());
@ -11804,7 +11828,7 @@ static Handle<JSObject> MaterializeBlockScope(
// Fill all context locals.
if (!ScopeInfo::CopyContextLocalsToScopeObject(
scope_info, context, block_scope)) {
return Handle<JSObject>();
return MaybeHandle<JSObject>();
}
return block_scope;
@ -11813,7 +11837,7 @@ static Handle<JSObject> MaterializeBlockScope(
// Create a plain JSObject which materializes the module scope for the specified
// module context.
static Handle<JSObject> MaterializeModuleScope(
MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeModuleScope(
Isolate* isolate,
Handle<Context> context) {
ASSERT(context->IsModuleContext());
@ -11827,7 +11851,7 @@ static Handle<JSObject> MaterializeModuleScope(
// Fill all context locals.
if (!ScopeInfo::CopyContextLocalsToScopeObject(
scope_info, context, module_scope)) {
return Handle<JSObject>();
return MaybeHandle<JSObject>();
}
return module_scope;
@ -12037,7 +12061,7 @@ class ScopeIterator {
}
// Return the JavaScript object with the content of the current scope.
Handle<JSObject> ScopeObject() {
MaybeHandle<JSObject> ScopeObject() {
ASSERT(!failed_);
switch (Type()) {
case ScopeIterator::ScopeTypeGlobal:
@ -12314,7 +12338,8 @@ static const int kScopeDetailsObjectIndex = 1;
static const int kScopeDetailsSize = 2;
static Handle<JSObject> MaterializeScopeDetails(Isolate* isolate,
MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeScopeDetails(
Isolate* isolate,
ScopeIterator* it) {
// Calculate the size of the result.
int details_size = kScopeDetailsSize;
@ -12322,8 +12347,9 @@ static Handle<JSObject> MaterializeScopeDetails(Isolate* isolate,
// Fill in scope details.
details->set(kScopeDetailsTypeIndex, Smi::FromInt(it->Type()));
Handle<JSObject> scope_object = it->ScopeObject();
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, scope_object, Handle<JSObject>());
Handle<JSObject> scope_object;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, scope_object, it->ScopeObject(), JSObject);
details->set(kScopeDetailsObjectIndex, *scope_object);
return isolate->factory()->NewJSArrayWithElements(details);
@ -12367,8 +12393,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetScopeDetails) {
if (it.Done()) {
return isolate->heap()->undefined_value();
}
Handle<JSObject> details = MaterializeScopeDetails(isolate, &it);
RETURN_IF_EMPTY_HANDLE(isolate, details);
Handle<JSObject> details;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, details, MaterializeScopeDetails(isolate, &it));
return *details;
}
@ -12409,8 +12436,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetAllScopesDetails) {
List<Handle<JSObject> > result(4);
ScopeIterator it(isolate, frame, inlined_jsframe_index, ignore_nested_scopes);
for (; !it.Done(); it.Next()) {
Handle<JSObject> details = MaterializeScopeDetails(isolate, &it);
RETURN_IF_EMPTY_HANDLE(isolate, details);
Handle<JSObject> details;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, details, MaterializeScopeDetails(isolate, &it));
result.Add(details);
}
@ -12457,7 +12485,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionScopeDetails) {
return isolate->heap()->undefined_value();
}
Handle<JSObject> details = MaterializeScopeDetails(isolate, &it);
Handle<JSObject> details;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, details, MaterializeScopeDetails(isolate, &it));
RETURN_IF_EMPTY_HANDLE(isolate, details);
return *details;
}
@ -12837,7 +12867,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) {
// Helper function to find or create the arguments object for
// Runtime_DebugEvaluate.
static Handle<JSObject> MaterializeArgumentsObject(
MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeArgumentsObject(
Isolate* isolate,
Handle<JSObject> target,
Handle<JSFunction> function) {
@ -12852,11 +12882,12 @@ static Handle<JSObject> MaterializeArgumentsObject(
// FunctionGetArguments can't throw an exception.
Handle<JSObject> arguments = Handle<JSObject>::cast(
Accessors::FunctionGetArguments(function));
Runtime::SetObjectProperty(isolate, target,
isolate->factory()->arguments_string(),
arguments,
::NONE,
SLOPPY);
Handle<String> arguments_str = isolate->factory()->arguments_string();
RETURN_ON_EXCEPTION(
isolate,
Runtime::SetObjectProperty(
isolate, target, arguments_str, arguments, ::NONE, SLOPPY),
JSObject);
return target;
}
@ -12946,12 +12977,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
Handle<JSObject> materialized =
isolate->factory()->NewJSObject(isolate->object_function());
materialized = MaterializeStackLocalsWithFrameInspector(
isolate, materialized, function, &frame_inspector);
RETURN_IF_EMPTY_HANDLE(isolate, materialized);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, materialized,
MaterializeStackLocalsWithFrameInspector(
isolate, materialized, function, &frame_inspector));
materialized = MaterializeArgumentsObject(isolate, materialized, function);
RETURN_IF_EMPTY_HANDLE(isolate, materialized);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, materialized,
MaterializeArgumentsObject(isolate, materialized, function));
// Add the materialized object in a with-scope to shadow the stack locals.
context = isolate->factory()->NewWithContext(function, context, materialized);

View File

@ -827,7 +827,7 @@ class Runtime : public AllStatic {
Handle<Object> object,
uint32_t index);
static Handle<Object> SetObjectProperty(
MUST_USE_RESULT static MaybeHandle<Object> SetObjectProperty(
Isolate* isolate,
Handle<Object> object,
Handle<Object> key,
@ -835,8 +835,7 @@ class Runtime : public AllStatic {
PropertyAttributes attr,
StrictMode strict_mode);
static Handle<Object> ForceSetObjectProperty(
Isolate* isolate,
MUST_USE_RESULT static MaybeHandle<Object> ForceSetObjectProperty(
Handle<JSObject> object,
Handle<Object> key,
Handle<Object> value,
@ -899,7 +898,7 @@ class Runtime : public AllStatic {
static void OutOfMemory();
// Used in runtime.cc and hydrogen's VisitArrayLiteral.
static Handle<Object> CreateArrayLiteralBoilerplate(
MUST_USE_RESULT static MaybeHandle<Object> CreateArrayLiteralBoilerplate(
Isolate* isolate,
Handle<FixedArray> literals,
Handle<FixedArray> elements);

View File

@ -372,14 +372,16 @@ bool ScopeInfo::CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info,
int end = start + local_count;
for (int i = start; i < end; ++i) {
int context_index = Context::MIN_CONTEXT_SLOTS + i - start;
Handle<Object> result = Runtime::SetObjectProperty(
RETURN_ON_EXCEPTION_VALUE(
isolate,
scope_object,
Handle<String>(String::cast(scope_info->get(i))),
Handle<Object>(context->get(context_index), isolate),
::NONE,
SLOPPY);
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, false);
Runtime::SetObjectProperty(
isolate,
scope_object,
Handle<String>(String::cast(scope_info->get(i))),
Handle<Object>(context->get(context_index), isolate),
::NONE,
SLOPPY),
false);
}
return true;
}

View File

@ -656,9 +656,11 @@ RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty) {
Handle<Object> value = args.at<Object>(2);
ASSERT(receiver->HasNamedInterceptor());
PropertyAttributes attr = NONE;
Handle<Object> result = JSObject::SetPropertyWithInterceptor(
receiver, name, value, attr, ic.strict_mode());
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSObject::SetPropertyWithInterceptor(
receiver, name, value, attr, ic.strict_mode()));
return *result;
}

View File

@ -61,13 +61,14 @@ Vector<const uc16> GetCharVector(Handle<String> string) {
class URIUnescape : public AllStatic {
public:
template<typename Char>
static MaybeHandle<String> Unescape(Isolate* isolate, Handle<String> source);
MUST_USE_RESULT static MaybeHandle<String> Unescape(Isolate* isolate,
Handle<String> source);
private:
static const signed char kHexValue['g'];
template<typename Char>
static MaybeHandle<String> UnescapeSlow(
MUST_USE_RESULT static MaybeHandle<String> UnescapeSlow(
Isolate* isolate, Handle<String> string, int start_index);
static INLINE(int TwoDigitHex(uint16_t character1, uint16_t character2));
@ -202,7 +203,8 @@ int URIUnescape::UnescapeChar(Vector<const Char> vector,
class URIEscape : public AllStatic {
public:
template<typename Char>
static MaybeHandle<String> Escape(Isolate* isolate, Handle<String> string);
MUST_USE_RESULT static MaybeHandle<String> Escape(Isolate* isolate,
Handle<String> string);
private:
static const char kHexChars[17];

View File

@ -51,7 +51,7 @@ static void SetGlobalProperty(const char* name, Object* value) {
isolate->factory()->InternalizeUtf8String(name);
Handle<JSObject> global(isolate->context()->global_object());
Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE,
SLOPPY);
SLOPPY).Check();
}

View File

@ -114,7 +114,7 @@ class DebugLocalContext {
v8::internal::Runtime::SetObjectProperty(isolate, global, debug_string,
Handle<Object>(debug->debug_context()->global_proxy(), isolate),
DONT_ENUM,
::v8::internal::SLOPPY);
::v8::internal::SLOPPY).Check();
}
private:

View File

@ -285,11 +285,13 @@ TEST(GarbageCollection) {
Handle<Map> initial_map =
factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
function->set_initial_map(*initial_map);
JSReceiver::SetProperty(global, name, function, NONE, SLOPPY);
JSReceiver::SetProperty(global, name, function, NONE, SLOPPY).Check();
// Allocate an object. Unrooted after leaving the scope.
Handle<JSObject> obj = factory->NewJSObject(function);
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY);
JSReceiver::SetProperty(obj, prop_namex, twenty_four, NONE, SLOPPY);
JSReceiver::SetProperty(
obj, prop_name, twenty_three, NONE, SLOPPY).Check();
JSReceiver::SetProperty(
obj, prop_namex, twenty_four, NONE, SLOPPY).Check();
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
CHECK_EQ(Smi::FromInt(24), obj->GetProperty(*prop_namex));
@ -309,8 +311,9 @@ TEST(GarbageCollection) {
HandleScope inner_scope(isolate);
// Allocate another object, make it reachable from global.
Handle<JSObject> obj = factory->NewJSObject(function);
JSReceiver::SetProperty(global, obj_name, obj, NONE, SLOPPY);
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY);
JSReceiver::SetProperty(global, obj_name, obj, NONE, SLOPPY).Check();
JSReceiver::SetProperty(
obj, prop_name, twenty_three, NONE, SLOPPY).Check();
}
// After gc, it should survive.
@ -645,10 +648,11 @@ TEST(FunctionAllocation) {
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
Handle<JSObject> obj = factory->NewJSObject(function);
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY);
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY).Check();
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
// Check that we can add properties to function objects.
JSReceiver::SetProperty(function, prop_name, twenty_four, NONE, SLOPPY);
JSReceiver::SetProperty(
function, prop_name, twenty_four, NONE, SLOPPY).Check();
CHECK_EQ(Smi::FromInt(24), function->GetProperty(*prop_name));
}
@ -675,7 +679,7 @@ TEST(ObjectProperties) {
CHECK(!JSReceiver::HasLocalProperty(obj, first));
// add first
JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY);
JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check();
CHECK(JSReceiver::HasLocalProperty(obj, first));
// delete first
@ -683,8 +687,8 @@ TEST(ObjectProperties) {
CHECK(!JSReceiver::HasLocalProperty(obj, first));
// add first and then second
JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY);
JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY);
JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check();
JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY).Check();
CHECK(JSReceiver::HasLocalProperty(obj, first));
CHECK(JSReceiver::HasLocalProperty(obj, second));
@ -696,8 +700,8 @@ TEST(ObjectProperties) {
CHECK(!JSReceiver::HasLocalProperty(obj, second));
// add first and then second
JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY);
JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY);
JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check();
JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY).Check();
CHECK(JSReceiver::HasLocalProperty(obj, first));
CHECK(JSReceiver::HasLocalProperty(obj, second));
@ -711,14 +715,14 @@ TEST(ObjectProperties) {
// check string and internalized string match
const char* string1 = "fisk";
Handle<String> s1 = factory->NewStringFromAscii(CStrVector(string1));
JSReceiver::SetProperty(obj, s1, one, NONE, SLOPPY);
JSReceiver::SetProperty(obj, s1, one, NONE, SLOPPY).Check();
Handle<String> s1_string = factory->InternalizeUtf8String(string1);
CHECK(JSReceiver::HasLocalProperty(obj, s1_string));
// check internalized string and string match
const char* string2 = "fugl";
Handle<String> s2_string = factory->InternalizeUtf8String(string2);
JSReceiver::SetProperty(obj, s2_string, one, NONE, SLOPPY);
JSReceiver::SetProperty(obj, s2_string, one, NONE, SLOPPY).Check();
Handle<String> s2 = factory->NewStringFromAscii(CStrVector(string2));
CHECK(JSReceiver::HasLocalProperty(obj, s2));
}
@ -742,7 +746,7 @@ TEST(JSObjectMaps) {
// Set a propery
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY);
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY).Check();
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
// Check the map has changed
@ -817,8 +821,8 @@ TEST(JSObjectCopy) {
Handle<Smi> one(Smi::FromInt(1), isolate);
Handle<Smi> two(Smi::FromInt(2), isolate);
JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY);
JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY);
JSReceiver::SetProperty(obj, first, one, NONE, SLOPPY).Check();
JSReceiver::SetProperty(obj, second, two, NONE, SLOPPY).Check();
JSReceiver::SetElement(obj, 0, first, NONE, SLOPPY);
JSReceiver::SetElement(obj, 1, second, NONE, SLOPPY);
@ -836,8 +840,8 @@ TEST(JSObjectCopy) {
CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second));
// Flip the values.
JSReceiver::SetProperty(clone, first, two, NONE, SLOPPY);
JSReceiver::SetProperty(clone, second, one, NONE, SLOPPY);
JSReceiver::SetProperty(clone, first, two, NONE, SLOPPY).Check();
JSReceiver::SetProperty(clone, second, one, NONE, SLOPPY).Check();
JSReceiver::SetElement(clone, 0, second, NONE, SLOPPY);
JSReceiver::SetElement(clone, 1, first, NONE, SLOPPY);

View File

@ -170,7 +170,7 @@ TEST(MarkCompactCollector) {
JSObject::kHeaderSize)->ToObjectChecked());
function->set_initial_map(initial_map);
JSReceiver::SetProperty(
global, handle(func_name), handle(function), NONE, SLOPPY);
global, handle(func_name), handle(function), NONE, SLOPPY).Check();
JSObject* obj = JSObject::cast(
heap->AllocateJSObject(function)->ToObjectChecked());
@ -187,12 +187,13 @@ TEST(MarkCompactCollector) {
obj = JSObject::cast(heap->AllocateJSObject(function)->ToObjectChecked());
String* obj_name =
String::cast(heap->InternalizeUtf8String("theObject")->ToObjectChecked());
JSReceiver::SetProperty(global, handle(obj_name), handle(obj), NONE, SLOPPY);
JSReceiver::SetProperty(
global, handle(obj_name), handle(obj), NONE, SLOPPY).Check();
String* prop_name =
String::cast(heap->InternalizeUtf8String("theSlot")->ToObjectChecked());
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
JSReceiver::SetProperty(
handle(obj), handle(prop_name), twenty_three, NONE, SLOPPY);
handle(obj), handle(prop_name), twenty_three, NONE, SLOPPY).Check();
heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 5");