Some MaybeHandles related cleanups.

R=mvstanton@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20832 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2014-04-17 08:33:18 +00:00
parent 779e87b87a
commit 0c614e2b48
9 changed files with 102 additions and 112 deletions

View File

@ -3398,9 +3398,12 @@ static inline bool ObjectSetAccessor(Object* obj,
name, getter, setter, data, settings, attributes, signature);
if (info.is_null()) return false;
bool fast = Utils::OpenHandle(obj)->HasFastProperties();
i::Handle<i::Object> result =
i::JSObject::SetAccessor(Utils::OpenHandle(obj), info);
if (result.is_null() || result->IsUndefined()) return false;
i::Handle<i::Object> result;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, result,
i::JSObject::SetAccessor(Utils::OpenHandle(obj), info),
false);
if (result->IsUndefined()) return false;
if (fast) i::JSObject::TransformToFastProperties(Utils::OpenHandle(obj), 0);
return true;
}

View File

@ -576,7 +576,7 @@ Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
throw_type_error_function->shared()->set_code(*code);
throw_type_error_function->shared()->DontAdaptArguments();
JSObject::PreventExtensions(throw_type_error_function);
JSObject::PreventExtensions(throw_type_error_function).Assert();
}
return throw_type_error_function;
}

View File

@ -529,7 +529,7 @@ BUILTIN(ArrayPop) {
}
Handle<Object> element;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, element, maybe_element);
RETURN_IF_EMPTY_HANDLE(
RETURN_FAILURE_ON_EXCEPTION(
isolate,
accessor->SetLength(array, handle(Smi::FromInt(new_length), isolate)));
return *element;
@ -1231,7 +1231,7 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallHelper(
result->VerifyApiCallResultType();
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
if (!is_construct || result->IsJSObject()) return result;
}
@ -1301,7 +1301,7 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallAsFunctionOrConstructor(
}
}
// Check for exceptions and return result.
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return result;
}

View File

@ -2228,7 +2228,7 @@ Handle<JSFunction> Factory::CreateApiFunction(
// Install accumulated static accessors
for (int i = 0; i < valid_descriptors; i++) {
Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i)));
JSObject::SetAccessor(result, accessor);
JSObject::SetAccessor(result, accessor).Assert();
}
ASSERT(result->shared()->IsApiFunction());

View File

@ -117,7 +117,7 @@ class Simulator;
// of handles to the actual constants.
typedef ZoneList<Handle<Object> > ZoneObjectList;
#define RETURN_IF_SCHEDULED_EXCEPTION(isolate) \
#define RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate) \
do { \
Isolate* __isolate__ = (isolate); \
if (__isolate__->has_scheduled_exception()) { \
@ -125,15 +125,7 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
} \
} while (false)
#define RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, T) \
do { \
Isolate* __isolate__ = (isolate); \
if (__isolate__->has_scheduled_exception()) { \
__isolate__->PromoteScheduledException(); \
return Handle<T>::null(); \
} \
} while (false)
// TODO(yangguo): Remove after we completely changed to MaybeHandles.
#define RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, value) \
do { \
if ((call).is_null()) { \
@ -142,12 +134,14 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
} \
} while (false)
// TODO(yangguo): Remove after we completely changed to MaybeHandles.
#define CHECK_NOT_EMPTY_HANDLE(isolate, call) \
do { \
ASSERT(!(isolate)->has_pending_exception()); \
CHECK(!(call).is_null()); \
} while (false)
// TODO(yangguo): Remove after we completely changed to MaybeHandles.
#define RETURN_IF_EMPTY_HANDLE(isolate, call) \
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, Failure::Exception())

View File

@ -539,7 +539,7 @@ MaybeHandle<Object> JSObject::GetPropertyWithFailedAccessCheck(
// No accessible property found.
*attributes = ABSENT;
isolate->ReportFailedAccessCheck(object, v8::ACCESS_GET);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return isolate->factory()->undefined_value();
}
@ -884,7 +884,7 @@ MaybeHandle<Object> Object::GetElementWithReceiver(Isolate* isolate,
if (js_object->IsAccessCheckNeeded()) {
if (!isolate->MayIndexedAccess(js_object, index, v8::ACCESS_GET)) {
isolate->ReportFailedAccessCheck(js_object, v8::ACCESS_GET);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return isolate->factory()->undefined_value();
}
}
@ -5254,8 +5254,8 @@ Handle<Object> JSObject::DeletePropertyPostInterceptor(Handle<JSObject> object,
}
Handle<Object> JSObject::DeletePropertyWithInterceptor(Handle<JSObject> object,
Handle<Name> name) {
MaybeHandle<Object> JSObject::DeletePropertyWithInterceptor(
Handle<JSObject> object, Handle<Name> name) {
Isolate* isolate = object->GetIsolate();
// TODO(rossberg): Support symbols in the API.
@ -5271,7 +5271,7 @@ Handle<Object> JSObject::DeletePropertyWithInterceptor(Handle<JSObject> object,
isolate, interceptor->data(), *object, *object);
v8::Handle<v8::Boolean> result =
args.Call(deleter, v8::Utils::ToLocal(Handle<String>::cast(name)));
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
if (!result.IsEmpty()) {
ASSERT(result->IsBoolean());
Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
@ -5282,7 +5282,6 @@ Handle<Object> JSObject::DeletePropertyWithInterceptor(Handle<JSObject> object,
}
Handle<Object> result =
DeletePropertyPostInterceptor(object, name, NORMAL_DELETION);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
return result;
}
@ -5306,7 +5305,7 @@ MaybeHandle<Object> JSObject::DeleteElementWithInterceptor(
PropertyCallbackArguments args(
isolate, interceptor->data(), *object, *object);
v8::Handle<v8::Boolean> result = args.Call(deleter, index);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
if (!result.IsEmpty()) {
ASSERT(result->IsBoolean());
Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
@ -5330,7 +5329,7 @@ MaybeHandle<Object> JSObject::DeleteElement(Handle<JSObject> object,
if (object->IsAccessCheckNeeded() &&
!isolate->MayIndexedAccess(object, index, v8::ACCESS_DELETE)) {
isolate->ReportFailedAccessCheck(object, v8::ACCESS_DELETE);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return factory->false_value();
}
@ -5399,7 +5398,7 @@ MaybeHandle<Object> JSObject::DeleteProperty(Handle<JSObject> object,
if (object->IsAccessCheckNeeded() &&
!isolate->MayNamedAccess(object, name, v8::ACCESS_DELETE)) {
isolate->ReportFailedAccessCheck(object, v8::ACCESS_DELETE);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return isolate->factory()->false_value();
}
@ -5446,7 +5445,10 @@ MaybeHandle<Object> JSObject::DeleteProperty(Handle<JSObject> object,
if (mode == FORCE_DELETION) {
result = DeletePropertyPostInterceptor(object, name, mode);
} else {
result = DeletePropertyWithInterceptor(object, name);
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
DeletePropertyWithInterceptor(object, name),
Object);
}
} else {
// Normalize object if needed.
@ -5621,7 +5623,7 @@ bool JSObject::ReferencesObject(Object* obj) {
}
Handle<Object> JSObject::PreventExtensions(Handle<JSObject> object) {
MaybeHandle<Object> JSObject::PreventExtensions(Handle<JSObject> object) {
Isolate* isolate = object->GetIsolate();
if (!object->map()->is_extensible()) return object;
@ -5630,7 +5632,7 @@ Handle<Object> JSObject::PreventExtensions(Handle<JSObject> object) {
!isolate->MayNamedAccess(
object, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) {
isolate->ReportFailedAccessCheck(object, v8::ACCESS_KEYS);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return isolate->factory()->false_value();
}
@ -5648,8 +5650,7 @@ Handle<Object> JSObject::PreventExtensions(Handle<JSObject> object) {
isolate->factory()->NewTypeError(
"cant_prevent_ext_external_array_elements",
HandleVector(&object, 1));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
// If there are fast elements we normalize.
@ -6932,8 +6933,8 @@ bool JSObject::DefineFastAccessor(Handle<JSObject> object,
}
Handle<Object> JSObject::SetAccessor(Handle<JSObject> object,
Handle<AccessorInfo> info) {
MaybeHandle<Object> JSObject::SetAccessor(Handle<JSObject> object,
Handle<AccessorInfo> info) {
Isolate* isolate = object->GetIsolate();
Factory* factory = isolate->factory();
Handle<Name> name(Name::cast(info->name()));
@ -6942,7 +6943,7 @@ Handle<Object> JSObject::SetAccessor(Handle<JSObject> object,
if (object->IsAccessCheckNeeded() &&
!isolate->MayNamedAccess(object, name, v8::ACCESS_SET)) {
isolate->ReportFailedAccessCheck(object, v8::ACCESS_SET);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return factory->undefined_value();
}
@ -7015,9 +7016,9 @@ Handle<Object> JSObject::SetAccessor(Handle<JSObject> object,
}
Handle<Object> JSObject::GetAccessor(Handle<JSObject> object,
Handle<Name> name,
AccessorComponent component) {
MaybeHandle<Object> JSObject::GetAccessor(Handle<JSObject> object,
Handle<Name> name,
AccessorComponent component) {
Isolate* isolate = object->GetIsolate();
// Make sure that the top context does not change when doing callbacks or
@ -7028,7 +7029,7 @@ Handle<Object> JSObject::GetAccessor(Handle<JSObject> object,
if (object->IsAccessCheckNeeded() &&
!isolate->MayNamedAccess(object, name, v8::ACCESS_HAS)) {
isolate->ReportFailedAccessCheck(object, v8::ACCESS_HAS);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return isolate->factory()->undefined_value();
}
@ -13570,7 +13571,7 @@ MaybeHandle<Object> JSObject::GetElementWithInterceptor(
PropertyCallbackArguments
args(isolate, interceptor->data(), *receiver, *object);
v8::Handle<v8::Value> result = args.Call(getter, index);
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
if (!result.IsEmpty()) {
Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
result_internal->VerifyApiCallResultType();

View File

@ -2364,9 +2364,10 @@ class JSObject: public JSReceiver {
// Retrieves an AccessorPair property from the given object. Might return
// undefined if the property doesn't exist or is of a different kind.
static Handle<Object> GetAccessor(Handle<JSObject> object,
Handle<Name> name,
AccessorComponent component);
MUST_USE_RESULT static MaybeHandle<Object> GetAccessor(
Handle<JSObject> object,
Handle<Name> name,
AccessorComponent component);
// Defines an AccessorPair property on the given object.
// TODO(mstarzinger): Rename to SetAccessor() and return empty handle on
@ -2379,8 +2380,9 @@ class JSObject: public JSReceiver {
v8::AccessControl access_control = v8::DEFAULT);
// Defines an AccessorInfo property on the given object.
static Handle<Object> SetAccessor(Handle<JSObject> object,
Handle<AccessorInfo> info);
MUST_USE_RESULT static MaybeHandle<Object> SetAccessor(
Handle<JSObject> object,
Handle<AccessorInfo> info);
MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithInterceptor(
Handle<JSObject> object,
@ -2658,7 +2660,8 @@ class JSObject: public JSReceiver {
bool ReferencesObject(Object* obj);
// Disalow further properties to be added to the object.
static Handle<Object> PreventExtensions(Handle<JSObject> object);
MUST_USE_RESULT static MaybeHandle<Object> PreventExtensions(
Handle<JSObject> object);
// ES5 Object.freeze
MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object);
@ -2938,8 +2941,9 @@ class JSObject: public JSReceiver {
static Handle<Object> DeletePropertyPostInterceptor(Handle<JSObject> object,
Handle<Name> name,
DeleteMode mode);
static Handle<Object> DeletePropertyWithInterceptor(Handle<JSObject> object,
Handle<Name> name);
MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithInterceptor(
Handle<JSObject> object,
Handle<Name> name);
// Deletes the named property in a normalized object.
static Handle<Object> DeleteNormalizedProperty(Handle<JSObject> object,

View File

@ -917,9 +917,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferIsView) {
HandleScope scope(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(Object, object, 0);
return object->IsJSArrayBufferView()
? isolate->heap()->true_value()
: isolate->heap()->false_value();
return isolate->heap()->ToBoolean(object->IsJSArrayBufferView());
}
@ -1137,13 +1135,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_TypedArrayInitializeFromArrayLike) {
buffer->backing_store(),
backing_store + source_byte_offset,
byte_length);
return *isolate->factory()->true_value();
} else {
return *isolate->factory()->false_value();
return isolate->heap()->true_value();
}
}
return *isolate->factory()->false_value();
return isolate->heap()->false_value();
}
@ -1722,7 +1718,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetPrototype) {
v8::ACCESS_GET)) {
isolate->ReportFailedAccessCheck(Handle<JSObject>::cast(obj),
v8::ACCESS_GET);
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return isolate->heap()->undefined_value();
}
obj = Object::GetPrototype(isolate, obj);
@ -1752,7 +1748,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) {
!isolate->MayNamedAccess(
obj, isolate->factory()->proto_string(), v8::ACCESS_SET)) {
isolate->ReportFailedAccessCheck(obj, v8::ACCESS_SET);
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return isolate->heap()->undefined_value();
}
if (obj->map()->is_observed()) {
@ -1995,8 +1991,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_PreventExtensions) {
HandleScope scope(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
Handle<Object> result = JSObject::PreventExtensions(obj);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, JSObject::PreventExtensions(obj));
return *result;
}
@ -2220,7 +2217,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeclareGlobals) {
attr = lookup.GetAttributes();
}
// Define or redefine own property.
RETURN_IF_EMPTY_HANDLE(isolate,
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
global, name, value, static_cast<PropertyAttributes>(attr)));
} else {
@ -2326,7 +2323,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeclareContextSlot) {
}
if (object->IsJSGlobalObject()) {
// Define own property on the global object.
RETURN_IF_EMPTY_HANDLE(isolate,
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(object, name, value, mode));
} else {
RETURN_FAILURE_ON_EXCEPTION(isolate,
@ -2426,7 +2423,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_InitializeConstGlobal) {
if (!lookup.IsFound()) {
HandleScope handle_scope(isolate);
Handle<GlobalObject> global(isolate->context()->global_object());
RETURN_IF_EMPTY_HANDLE(
RETURN_FAILURE_ON_EXCEPTION(
isolate,
JSObject::SetLocalPropertyIgnoreAttributes(global, name, value,
attributes));
@ -2671,16 +2668,16 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
Handle<Object> zero(Smi::FromInt(0), isolate);
Factory* factory = isolate->factory();
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes(
regexp, factory->source_string(), source, final));
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes(
regexp, factory->global_string(), global, final));
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes(
regexp, factory->ignore_case_string(), ignoreCase, final));
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes(
regexp, factory->multiline_string(), multiline, final));
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes(
regexp, factory->last_index_string(), zero, writable));
JSObject::SetLocalPropertyIgnoreAttributes(
regexp, factory->source_string(), source, final).Check();
JSObject::SetLocalPropertyIgnoreAttributes(
regexp, factory->global_string(), global, final).Check();
JSObject::SetLocalPropertyIgnoreAttributes(
regexp, factory->ignore_case_string(), ignoreCase, final).Check();
JSObject::SetLocalPropertyIgnoreAttributes(
regexp, factory->multiline_string(), multiline, final).Check();
JSObject::SetLocalPropertyIgnoreAttributes(
regexp, factory->last_index_string(), zero, writable).Check();
return *regexp;
}
@ -4857,11 +4854,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsValidSmi) {
ASSERT(args.length() == 1);
CONVERT_NUMBER_CHECKED(int32_t, number, Int32, args[0]);
if (Smi::IsValid(number)) {
return isolate->heap()->true_value();
} else {
return isolate->heap()->false_value();
}
return isolate->heap()->ToBoolean(Smi::IsValid(number));
}
@ -5070,8 +5063,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_KeyedGetProperty) {
Handle<String> str = args.at<String>(0);
int index = args.smi_at(1);
if (index >= 0 && index < str->length()) {
Handle<Object> result = GetCharAt(str, index);
return *result;
return *GetCharAt(str, index);
}
}
@ -5113,7 +5105,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineAccessorProperty) {
bool fast = obj->HasFastProperties();
JSObject::DefineAccessor(obj, name, getter, setter, attr);
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
if (fast) JSObject::TransformToFastProperties(obj, 0);
return isolate->heap()->undefined_value();
}
@ -5221,8 +5213,7 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
Handle<Object> error =
isolate->factory()->NewTypeError("non_object_property_store",
HandleVector(args, 2));
isolate->Throw(*error);
return Handle<Object>();
return isolate->Throw<Object>(error);
}
if (object->IsJSProxy()) {
@ -5541,10 +5532,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugCallbackSupportsStepping) {
}
CONVERT_ARG_CHECKED(Object, callback, 0);
// We do not step into the callback if it's a builtin or not even a function.
if (!callback->IsJSFunction() || JSFunction::cast(callback)->IsBuiltin()) {
return isolate->heap()->false_value();
}
return isolate->heap()->true_value();
return isolate->heap()->ToBoolean(
callback->IsJSFunction() && !JSFunction::cast(callback)->IsBuiltin());
#else
return isolate->heap()->false_value();
#endif // ENABLE_DEBUGGER_SUPPORT
@ -5628,7 +5617,7 @@ static MaybeObject* HasLocalPropertyImplementation(Isolate* isolate,
Handle<JSObject>::cast(proto),
key);
}
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return isolate->heap()->false_value();
}
@ -5652,7 +5641,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_HasLocalProperty) {
ASSERT(!isolate->has_scheduled_exception());
return isolate->heap()->true_value();
} else {
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
}
Map* map = js_obj->map();
if (!key_is_array_index &&
@ -5682,7 +5671,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) {
CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
bool result = JSReceiver::HasProperty(receiver, key);
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
if (isolate->has_pending_exception()) return Failure::Exception();
return isolate->heap()->ToBoolean(result);
}
@ -5695,8 +5684,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_HasElement) {
CONVERT_SMI_ARG_CHECKED(index, 1);
bool result = JSReceiver::HasElement(receiver, index);
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
if (isolate->has_pending_exception()) return Failure::Exception();
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return isolate->heap()->ToBoolean(result);
}
@ -5710,7 +5698,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) {
PropertyAttributes att = JSReceiver::GetLocalPropertyAttribute(object, key);
if (att == ABSENT || (att & DONT_ENUM) != 0) {
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return isolate->heap()->false_value();
}
ASSERT(!isolate->has_scheduled_exception());
@ -5796,7 +5784,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLocalPropertyNames) {
!isolate->MayNamedAccess(
obj, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) {
isolate->ReportFailedAccessCheck(obj, v8::ACCESS_KEYS);
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return *isolate->factory()->NewJSArray(0);
}
obj = Handle<JSObject>(JSObject::cast(obj->GetPrototype()));
@ -5815,7 +5803,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLocalPropertyNames) {
!isolate->MayNamedAccess(
jsproto, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) {
isolate->ReportFailedAccessCheck(jsproto, v8::ACCESS_KEYS);
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return *isolate->factory()->NewJSArray(0);
}
int n;
@ -5971,7 +5959,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LocalKeys) {
!isolate->MayNamedAccess(
object, isolate->factory()->undefined_value(), v8::ACCESS_KEYS)) {
isolate->ReportFailedAccessCheck(object, v8::ACCESS_KEYS);
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return *isolate->factory()->NewJSArray(0);
}
@ -8290,7 +8278,6 @@ static MaybeObject* Runtime_NewObjectHelper(Isolate* isolate,
} else {
result = isolate->factory()->NewJSObjectWithMemento(function, site);
}
RETURN_IF_EMPTY_HANDLE(isolate, result);
isolate->counters()->constructed_objects()->Increment();
isolate->counters()->constructed_objects_runtime()->Increment();
@ -9064,8 +9051,9 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeclareModules) {
IsImmutableVariableMode(mode) ? FROZEN : SEALED;
Handle<AccessorInfo> info =
Accessors::MakeModuleExport(name, index, attr);
Handle<Object> result = JSObject::SetAccessor(module, info);
ASSERT(!(result.is_null() || result->IsUndefined()));
Handle<Object> result =
JSObject::SetAccessor(module, info).ToHandleChecked();
ASSERT(!result->IsUndefined());
USE(result);
break;
}
@ -9084,7 +9072,7 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_DeclareModules) {
}
}
JSObject::PreventExtensions(module);
JSObject::PreventExtensions(module).Assert();
}
ASSERT(!isolate->has_pending_exception());
@ -10641,9 +10629,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LookupAccessor) {
CONVERT_SMI_ARG_CHECKED(flag, 2);
AccessorComponent component = flag == 0 ? ACCESSOR_GETTER : ACCESSOR_SETTER;
if (!receiver->IsJSObject()) return isolate->heap()->undefined_value();
Handle<Object> result =
JSObject::GetAccessor(Handle<JSObject>::cast(receiver), name, component);
RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSObject::GetAccessor(Handle<JSObject>::cast(receiver), name, component));
return *result;
}
@ -12376,7 +12365,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionScopeDetails) {
Handle<JSObject> details;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, details, MaterializeScopeDetails(isolate, &it));
RETURN_IF_EMPTY_HANDLE(isolate, details);
return *details;
}
@ -13692,7 +13680,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_AvailableLocalesOf) {
continue;
}
RETURN_IF_EMPTY_HANDLE(isolate,
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
locales,
isolate->factory()->NewStringFromAscii(CStrVector(result)),
@ -13796,13 +13784,13 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLanguageTagVariants) {
Handle<JSObject> result =
isolate->factory()->NewJSObject(isolate->object_function());
RETURN_IF_EMPTY_HANDLE(isolate,
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
result,
maximized,
isolate->factory()->NewStringFromAscii(CStrVector(base_max_locale)),
NONE));
RETURN_IF_EMPTY_HANDLE(isolate,
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
result,
base,
@ -13924,7 +13912,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateDateTimeFormat) {
local_object->SetInternalField(0, reinterpret_cast<Smi*>(date_format));
RETURN_IF_EMPTY_HANDLE(isolate,
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
local_object,
isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")),
@ -14019,7 +14007,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateNumberFormat) {
local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format));
RETURN_IF_EMPTY_HANDLE(isolate,
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
local_object,
isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")),
@ -14123,7 +14111,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateCollator) {
local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator));
RETURN_IF_EMPTY_HANDLE(isolate,
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
local_object,
isolate->factory()->NewStringFromAscii(CStrVector("collator")),
@ -14223,7 +14211,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateBreakIterator) {
// Make sure that the pointer to adopted text is NULL.
local_object->SetInternalField(1, reinterpret_cast<Smi*>(NULL));
RETURN_IF_EMPTY_HANDLE(isolate,
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
local_object,
isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")),

View File

@ -499,7 +499,7 @@ RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) {
PropertyCallbackArguments
custom_args(isolate, callback->data(), receiver, holder);
custom_args.Call(fun, v8::Utils::ToLocal(str), v8::Utils::ToLocal(value));
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return *value;
}
@ -539,7 +539,7 @@ RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorOnly) {
HandleScope scope(isolate);
v8::Handle<v8::Value> r =
callback_args.Call(getter, v8::Utils::ToLocal(name));
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
if (!r.IsEmpty()) {
Handle<Object> result = v8::Utils::OpenHandle(*r);
result->VerifyApiCallResultType();