Switch to RETURN_IF_EMPTY_HANDLE for empty handle checks.

This makes sure that every place where we assume an empty handle is
indicating a pending exception gets asserted accordingly.

R=machenbach@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15509 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 328191d0
...@@ -467,7 +467,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) { ...@@ -467,7 +467,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) {
constant_properties, constant_properties,
should_have_fast_elements, should_have_fast_elements,
has_function_literal); has_function_literal);
if (boilerplate.is_null()) return Failure::Exception(); RETURN_IF_EMPTY_HANDLE(isolate, boilerplate);
// Update the functions literal and return the boilerplate. // Update the functions literal and return the boilerplate.
literals->set(literals_index, *boilerplate); literals->set(literals_index, *boilerplate);
} }
...@@ -493,7 +493,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) { ...@@ -493,7 +493,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) {
constant_properties, constant_properties,
should_have_fast_elements, should_have_fast_elements,
has_function_literal); has_function_literal);
if (boilerplate.is_null()) return Failure::Exception(); RETURN_IF_EMPTY_HANDLE(isolate, boilerplate);
// Update the functions literal and return the boilerplate. // Update the functions literal and return the boilerplate.
literals->set(literals_index, *boilerplate); literals->set(literals_index, *boilerplate);
} }
...@@ -514,7 +514,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { ...@@ -514,7 +514,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) {
ASSERT(*elements != isolate->heap()->empty_fixed_array()); ASSERT(*elements != isolate->heap()->empty_fixed_array());
boilerplate = boilerplate =
Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements);
if (boilerplate.is_null()) return Failure::Exception(); RETURN_IF_EMPTY_HANDLE(isolate, boilerplate);
// Update the functions literal and return the boilerplate. // Update the functions literal and return the boilerplate.
literals->set(literals_index, *boilerplate); literals->set(literals_index, *boilerplate);
} }
...@@ -535,7 +535,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { ...@@ -535,7 +535,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) {
ASSERT(*elements != isolate->heap()->empty_fixed_array()); ASSERT(*elements != isolate->heap()->empty_fixed_array());
boilerplate = boilerplate =
Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements);
if (boilerplate.is_null()) return Failure::Exception(); RETURN_IF_EMPTY_HANDLE(isolate, boilerplate);
// Update the functions literal and return the boilerplate. // Update the functions literal and return the boilerplate.
literals->set(literals_index, *boilerplate); literals->set(literals_index, *boilerplate);
} }
...@@ -1460,7 +1460,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { ...@@ -1460,7 +1460,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) {
GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate);
Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); Handle<Object> result = JSObject::SetPrototype(obj, prototype, true);
if (result.is_null()) return Failure::Exception(); RETURN_IF_EMPTY_HANDLE(isolate, result);
Handle<Object> new_value( Handle<Object> new_value(
GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate);
...@@ -1472,7 +1472,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { ...@@ -1472,7 +1472,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) {
return *result; return *result;
} }
Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); Handle<Object> result = JSObject::SetPrototype(obj, prototype, true);
if (result.is_null()) return Failure::Exception(); RETURN_IF_EMPTY_HANDLE(isolate, result);
return *result; return *result;
} }
...@@ -1635,7 +1635,7 @@ static MaybeObject* GetOwnProperty(Isolate* isolate, ...@@ -1635,7 +1635,7 @@ static MaybeObject* GetOwnProperty(Isolate* isolate,
elms->set(WRITABLE_INDEX, heap->ToBoolean((attrs & READ_ONLY) == 0)); elms->set(WRITABLE_INDEX, heap->ToBoolean((attrs & READ_ONLY) == 0));
// GetProperty does access check. // GetProperty does access check.
Handle<Object> value = GetProperty(isolate, obj, name); Handle<Object> value = GetProperty(isolate, obj, name);
if (value.is_null()) return Failure::Exception(); RETURN_IF_EMPTY_HANDLE(isolate, value);
elms->set(VALUE_INDEX, *value); elms->set(VALUE_INDEX, *value);
} else { } else {
// Access checks are performed for both accessors separately. // Access checks are performed for both accessors separately.
...@@ -1700,7 +1700,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) { ...@@ -1700,7 +1700,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpCompile) {
CONVERT_ARG_HANDLE_CHECKED(String, flags, 2); CONVERT_ARG_HANDLE_CHECKED(String, flags, 2);
Handle<Object> result = Handle<Object> result =
RegExpImpl::Compile(re, pattern, flags); RegExpImpl::Compile(re, pattern, flags);
if (result.is_null()) return Failure::Exception(); RETURN_IF_EMPTY_HANDLE(isolate, result);
return *result; return *result;
} }
...@@ -2250,7 +2250,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExec) { ...@@ -2250,7 +2250,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExec) {
subject, subject,
index, index,
last_match_info); last_match_info);
if (result.is_null()) return Failure::Exception(); RETURN_IF_EMPTY_HANDLE(isolate, result);
return *result; return *result;
} }
...@@ -9377,7 +9377,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileString) { ...@@ -9377,7 +9377,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileString) {
? ONLY_SINGLE_FUNCTION_LITERAL : NO_PARSE_RESTRICTION; ? ONLY_SINGLE_FUNCTION_LITERAL : NO_PARSE_RESTRICTION;
Handle<SharedFunctionInfo> shared = Compiler::CompileEval( Handle<SharedFunctionInfo> shared = Compiler::CompileEval(
source, context, true, CLASSIC_MODE, restriction, RelocInfo::kNoPosition); source, context, true, CLASSIC_MODE, restriction, RelocInfo::kNoPosition);
if (shared.is_null()) return Failure::Exception(); RETURN_IF_EMPTY_HANDLE(isolate, shared);
Handle<JSFunction> fun = Handle<JSFunction> fun =
isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, isolate->factory()->NewFunctionFromSharedFunctionInfo(shared,
context, context,
...@@ -9414,7 +9414,8 @@ static ObjectPair CompileGlobalEval(Isolate* isolate, ...@@ -9414,7 +9414,8 @@ static ObjectPair CompileGlobalEval(Isolate* isolate,
language_mode, language_mode,
NO_PARSE_RESTRICTION, NO_PARSE_RESTRICTION,
scope_position); scope_position);
if (shared.is_null()) return MakePair(Failure::Exception(), NULL); RETURN_IF_EMPTY_HANDLE_VALUE(isolate, shared,
MakePair(Failure::Exception(), NULL));
Handle<JSFunction> compiled = Handle<JSFunction> compiled =
isolate->factory()->NewFunctionFromSharedFunctionInfo( isolate->factory()->NewFunctionFromSharedFunctionInfo(
shared, context, NOT_TENURED); shared, context, NOT_TENURED);
...@@ -12414,7 +12415,7 @@ static MaybeObject* DebugEvaluate(Isolate* isolate, ...@@ -12414,7 +12415,7 @@ static MaybeObject* DebugEvaluate(Isolate* isolate,
CLASSIC_MODE, CLASSIC_MODE,
NO_PARSE_RESTRICTION, NO_PARSE_RESTRICTION,
RelocInfo::kNoPosition); RelocInfo::kNoPosition);
if (shared.is_null()) return Failure::Exception(); RETURN_IF_EMPTY_HANDLE(isolate, shared);
Handle<JSFunction> eval_fun = Handle<JSFunction> eval_fun =
isolate->factory()->NewFunctionFromSharedFunctionInfo( isolate->factory()->NewFunctionFromSharedFunctionInfo(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment