Reduce boilerplace for common pattern to return MaybeHandle.
R=franzih@chromium.org Review-Url: https://codereview.chromium.org/2006673002 Cr-Commit-Position: refs/heads/master@{#36470}
This commit is contained in:
parent
9ffedb50d5
commit
47af330df7
118
src/builtins.cc
118
src/builtins.cc
@ -328,15 +328,9 @@ MUST_USE_RESULT static Object* CallJsIntrinsic(
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
argv[i] = args.at<Object>(i + 1);
|
||||
}
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
Execution::Call(isolate,
|
||||
function,
|
||||
args.receiver(),
|
||||
argc,
|
||||
argv.start()));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
Execution::Call(isolate, function, args.receiver(), argc, argv.start()));
|
||||
}
|
||||
|
||||
|
||||
@ -1702,11 +1696,8 @@ BUILTIN(ObjectDefineProperties) {
|
||||
Handle<Object> target = args.at<Object>(1);
|
||||
Handle<Object> properties = args.at<Object>(2);
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
JSReceiver::DefineProperties(isolate, target, properties));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, JSReceiver::DefineProperties(isolate, target, properties));
|
||||
}
|
||||
|
||||
// ES6 section 19.1.2.4 Object.defineProperty
|
||||
@ -1868,11 +1859,8 @@ BUILTIN(ObjectGetPrototypeOf) {
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, receiver, Object::ToObject(isolate, object));
|
||||
|
||||
Handle<Object> prototype;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, prototype, JSReceiver::GetPrototype(isolate, receiver));
|
||||
|
||||
return *prototype;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
JSReceiver::GetPrototype(isolate, receiver));
|
||||
}
|
||||
|
||||
|
||||
@ -2111,7 +2099,7 @@ BUILTIN(GlobalEncodeURI) {
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, uri, Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
|
||||
|
||||
return Uri::EncodeUri(isolate, uri);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Uri::EncodeUri(isolate, uri));
|
||||
}
|
||||
|
||||
// ES6 section 18.2.6.5 encodeURIComponenet (uriComponent)
|
||||
@ -2122,7 +2110,8 @@ BUILTIN(GlobalEncodeURIComponent) {
|
||||
isolate, uriComponent,
|
||||
Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
|
||||
|
||||
return Uri::EncodeUriComponent(isolate, uriComponent);
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
Uri::EncodeUriComponent(isolate, uriComponent));
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -2185,11 +2174,9 @@ BUILTIN(GlobalEval) {
|
||||
isolate, function,
|
||||
CompileString(handle(target->native_context(), isolate),
|
||||
Handle<String>::cast(x), NO_PARSE_RESTRICTION));
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
Execution::Call(isolate, function, target_global_proxy, 0, nullptr));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -2609,12 +2596,9 @@ BUILTIN(ReflectGet) {
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
|
||||
Object::ToName(isolate, key));
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Object::GetPropertyOrElement(
|
||||
receiver, name, Handle<JSReceiver>::cast(target)));
|
||||
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Object::GetPropertyOrElement(receiver, name,
|
||||
Handle<JSReceiver>::cast(target)));
|
||||
}
|
||||
|
||||
|
||||
@ -2657,11 +2641,9 @@ BUILTIN(ReflectGetPrototypeOf) {
|
||||
isolate->factory()->NewStringFromAsciiChecked(
|
||||
"Reflect.getPrototypeOf")));
|
||||
}
|
||||
Handle<Object> prototype;
|
||||
Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(target);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, prototype, JSReceiver::GetPrototype(isolate, receiver));
|
||||
return *prototype;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
JSReceiver::GetPrototype(isolate, receiver));
|
||||
}
|
||||
|
||||
|
||||
@ -3180,11 +3162,8 @@ BUILTIN(DateConstructor) {
|
||||
double const time_val = JSDate::CurrentTimeValue(isolate);
|
||||
char buffer[128];
|
||||
ToDateString(time_val, ArrayVector(buffer), isolate->date_cache());
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
|
||||
}
|
||||
|
||||
|
||||
@ -3266,10 +3245,7 @@ BUILTIN(DateConstructor_ConstructStub) {
|
||||
time_val = std::numeric_limits<double>::quiet_NaN();
|
||||
}
|
||||
}
|
||||
Handle<JSDate> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
JSDate::New(target, new_target, time_val));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, JSDate::New(target, new_target, time_val));
|
||||
}
|
||||
|
||||
|
||||
@ -3764,11 +3740,8 @@ BUILTIN(DatePrototypeToDateString) {
|
||||
char buffer[128];
|
||||
ToDateString(date->value()->Number(), ArrayVector(buffer),
|
||||
isolate->date_cache(), kDateOnly);
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
|
||||
}
|
||||
|
||||
|
||||
@ -3807,11 +3780,8 @@ BUILTIN(DatePrototypeToString) {
|
||||
char buffer[128];
|
||||
ToDateString(date->value()->Number(), ArrayVector(buffer),
|
||||
isolate->date_cache());
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
|
||||
}
|
||||
|
||||
|
||||
@ -3822,11 +3792,8 @@ BUILTIN(DatePrototypeToTimeString) {
|
||||
char buffer[128];
|
||||
ToDateString(date->value()->Number(), ArrayVector(buffer),
|
||||
isolate->date_cache(), kTimeOnly);
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, isolate->factory()->NewStringFromUtf8(CStrVector(buffer)));
|
||||
}
|
||||
|
||||
|
||||
@ -3864,10 +3831,7 @@ BUILTIN(DatePrototypeToPrimitive) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CHECK_RECEIVER(JSReceiver, receiver, "Date.prototype [ @@toPrimitive ]");
|
||||
Handle<Object> hint = args.at<Object>(1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
JSDate::ToPrimitive(receiver, hint));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, JSDate::ToPrimitive(receiver, hint));
|
||||
}
|
||||
|
||||
|
||||
@ -4249,18 +4213,14 @@ BUILTIN(FunctionPrototypeToString) {
|
||||
// ES6 section 25.2.1.1 GeneratorFunction (p1, p2, ... , pn, body)
|
||||
BUILTIN(GeneratorFunctionConstructor) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSFunction> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, CreateDynamicFunction(isolate, args, "function*"));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
CreateDynamicFunction(isolate, args, "function*"));
|
||||
}
|
||||
|
||||
BUILTIN(AsyncFunctionConstructor) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSFunction> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, CreateDynamicFunction(isolate, args, "async function"));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, CreateDynamicFunction(isolate, args, "async function"));
|
||||
}
|
||||
|
||||
// ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case.
|
||||
@ -4290,10 +4250,8 @@ BUILTIN(SymbolConstructor_ConstructStub) {
|
||||
BUILTIN(ObjectProtoToString) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> object = args.at<Object>(0);
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Object::ObjectProtoToString(isolate, object));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
Object::ObjectProtoToString(isolate, object));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -4626,10 +4584,7 @@ BUILTIN(ProxyConstructor_ConstructStub) {
|
||||
DCHECK(isolate->proxy_function()->IsConstructor());
|
||||
Handle<Object> target = args.atOrUndefined(isolate, 1);
|
||||
Handle<Object> handler = args.atOrUndefined(isolate, 2);
|
||||
Handle<JSProxy> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
JSProxy::New(isolate, target, handler));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, JSProxy::New(isolate, target, handler));
|
||||
}
|
||||
|
||||
|
||||
@ -4747,10 +4702,7 @@ MUST_USE_RESULT MaybeHandle<Object> HandleApiCallHelper(
|
||||
|
||||
BUILTIN(HandleApiCall) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
HandleApiCallHelper(isolate, args));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, HandleApiCallHelper(isolate, args));
|
||||
}
|
||||
|
||||
|
||||
|
79
src/ic/ic.cc
79
src/ic/ic.cc
@ -2259,7 +2259,6 @@ RUNTIME_FUNCTION(Runtime_LoadIC_Miss) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Name> key = args.at<Name>(1);
|
||||
Handle<Object> result;
|
||||
|
||||
DCHECK(args.length() == 4);
|
||||
Handle<Smi> slot = args.at<Smi>(2);
|
||||
@ -2272,16 +2271,15 @@ RUNTIME_FUNCTION(Runtime_LoadIC_Miss) {
|
||||
LoadICNexus nexus(vector, vector_slot);
|
||||
LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
|
||||
} else {
|
||||
DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
|
||||
vector->GetKind(vector_slot));
|
||||
KeyedLoadICNexus nexus(vector, vector_slot);
|
||||
KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
|
||||
}
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -2292,7 +2290,6 @@ RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Object> key = args.at<Object>(1);
|
||||
Handle<Object> result;
|
||||
|
||||
DCHECK(args.length() == 4);
|
||||
Handle<Smi> slot = args.at<Smi>(2);
|
||||
@ -2301,8 +2298,7 @@ RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) {
|
||||
KeyedLoadICNexus nexus(vector, vector_slot);
|
||||
KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
|
||||
}
|
||||
|
||||
|
||||
@ -2312,7 +2308,6 @@ RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Object> key = args.at<Object>(1);
|
||||
Handle<Object> result;
|
||||
|
||||
DCHECK(args.length() == 4);
|
||||
Handle<Smi> slot = args.at<Smi>(2);
|
||||
@ -2321,9 +2316,7 @@ RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) {
|
||||
KeyedLoadICNexus nexus(vector, vector_slot);
|
||||
KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
|
||||
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
|
||||
}
|
||||
|
||||
|
||||
@ -2335,7 +2328,6 @@ RUNTIME_FUNCTION(Runtime_StoreIC_Miss) {
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Name> key = args.at<Name>(1);
|
||||
Handle<Object> value = args.at<Object>(2);
|
||||
Handle<Object> result;
|
||||
|
||||
DCHECK(args.length() == 5 || args.length() == 6);
|
||||
Handle<Smi> slot = args.at<Smi>(3);
|
||||
@ -2345,18 +2337,15 @@ RUNTIME_FUNCTION(Runtime_StoreIC_Miss) {
|
||||
StoreICNexus nexus(vector, vector_slot);
|
||||
StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
ic.Store(receiver, key, value));
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
|
||||
} else {
|
||||
DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC,
|
||||
vector->GetKind(vector_slot));
|
||||
KeyedStoreICNexus nexus(vector, vector_slot);
|
||||
KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
ic.Store(receiver, key, value));
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
|
||||
}
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -2367,7 +2356,6 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Name> key = args.at<Name>(1);
|
||||
Handle<Object> value = args.at<Object>(2);
|
||||
Handle<Object> result;
|
||||
|
||||
int length = args.length();
|
||||
DCHECK(length == 5 || length == 6);
|
||||
@ -2397,18 +2385,15 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
|
||||
StoreICNexus nexus(vector, vector_slot);
|
||||
StoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
ic.Store(receiver, key, value));
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
|
||||
} else {
|
||||
DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC,
|
||||
vector->GetKind(vector_slot));
|
||||
KeyedStoreICNexus nexus(vector, vector_slot);
|
||||
KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
ic.Store(receiver, key, value));
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
|
||||
}
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -2420,7 +2405,6 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) {
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Object> key = args.at<Object>(1);
|
||||
Handle<Object> value = args.at<Object>(2);
|
||||
Handle<Object> result;
|
||||
|
||||
DCHECK(args.length() == 5);
|
||||
Handle<Smi> slot = args.at<Smi>(3);
|
||||
@ -2429,9 +2413,7 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) {
|
||||
KeyedStoreICNexus nexus(vector, vector_slot);
|
||||
KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
ic.Store(receiver, key, value));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
|
||||
}
|
||||
|
||||
|
||||
@ -2442,7 +2424,6 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) {
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Object> key = args.at<Object>(1);
|
||||
Handle<Object> value = args.at<Object>(2);
|
||||
Handle<Object> result;
|
||||
|
||||
DCHECK(args.length() == 5);
|
||||
Handle<Smi> slot = args.at<Smi>(3);
|
||||
@ -2451,9 +2432,7 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) {
|
||||
KeyedStoreICNexus nexus(vector, vector_slot);
|
||||
KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
ic.Store(receiver, key, value));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
|
||||
}
|
||||
|
||||
|
||||
@ -2467,11 +2446,9 @@ RUNTIME_FUNCTION(Runtime_StoreIC_Slow) {
|
||||
StoreICNexus nexus(isolate);
|
||||
StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
|
||||
language_mode = ic.language_mode();
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(isolate, object, key, value, language_mode));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -2485,11 +2462,9 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) {
|
||||
KeyedStoreICNexus nexus(isolate);
|
||||
KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
|
||||
language_mode = ic.language_mode();
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(isolate, object, key, value, language_mode));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -2512,11 +2487,9 @@ RUNTIME_FUNCTION(Runtime_ElementsTransitionAndStoreIC_Miss) {
|
||||
JSObject::TransitionElementsKind(Handle<JSObject>::cast(object),
|
||||
map->elements_kind());
|
||||
}
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(isolate, object, key, value, language_mode));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -2645,11 +2618,8 @@ RUNTIME_FUNCTION(Runtime_BinaryOpIC_Miss) {
|
||||
Handle<Object> left = args.at<Object>(BinaryOpICStub::kLeft);
|
||||
Handle<Object> right = args.at<Object>(BinaryOpICStub::kRight);
|
||||
BinaryOpIC ic(isolate);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
ic.Transition(Handle<AllocationSite>::null(), left, right));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, ic.Transition(Handle<AllocationSite>::null(), left, right));
|
||||
}
|
||||
|
||||
|
||||
@ -2664,10 +2634,8 @@ RUNTIME_FUNCTION(Runtime_BinaryOpIC_MissWithAllocationSite) {
|
||||
Handle<Object> right =
|
||||
args.at<Object>(BinaryOpWithAllocationSiteStub::kRight);
|
||||
BinaryOpIC ic(isolate);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, ic.Transition(allocation_site, left, right));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
ic.Transition(allocation_site, left, right));
|
||||
}
|
||||
|
||||
Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op) {
|
||||
@ -2965,7 +2933,6 @@ RUNTIME_FUNCTION(Runtime_LoadIC_MissFromStubFailure) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Object> receiver = args.at<Object>(0);
|
||||
Handle<Name> key = args.at<Name>(1);
|
||||
Handle<Object> result;
|
||||
|
||||
DCHECK(args.length() == 4);
|
||||
Handle<Smi> slot = args.at<Smi>(2);
|
||||
@ -2978,17 +2945,15 @@ RUNTIME_FUNCTION(Runtime_LoadIC_MissFromStubFailure) {
|
||||
LoadICNexus nexus(vector, vector_slot);
|
||||
LoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
|
||||
} else {
|
||||
DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
|
||||
vector->GetKind(vector_slot));
|
||||
KeyedLoadICNexus nexus(vector, vector_slot);
|
||||
KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
|
||||
ic.UpdateState(receiver, key);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
|
||||
}
|
||||
|
||||
return *result;
|
||||
}
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -124,6 +124,17 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
|
||||
#define RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, T) \
|
||||
RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, MaybeHandle<T>())
|
||||
|
||||
#define RETURN_RESULT_OR_FAILURE(isolate, call) \
|
||||
do { \
|
||||
Handle<Object> __result__; \
|
||||
Isolate* __isolate__ = (isolate); \
|
||||
if (!(call).ToHandle(&__result__)) { \
|
||||
DCHECK(__isolate__->has_pending_exception()); \
|
||||
return __isolate__->heap()->exception(); \
|
||||
} \
|
||||
return *__result__; \
|
||||
} while (false)
|
||||
|
||||
#define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value) \
|
||||
do { \
|
||||
if (!(call).ToHandle(&dst)) { \
|
||||
@ -132,21 +143,26 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \
|
||||
ASSIGN_RETURN_ON_EXCEPTION_VALUE( \
|
||||
isolate, dst, call, isolate->heap()->exception())
|
||||
#define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \
|
||||
do { \
|
||||
Isolate* __isolate__ = (isolate); \
|
||||
ASSIGN_RETURN_ON_EXCEPTION_VALUE(__isolate__, dst, call, \
|
||||
__isolate__->heap()->exception()); \
|
||||
} while (false)
|
||||
|
||||
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T) \
|
||||
ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, MaybeHandle<T>())
|
||||
|
||||
#define THROW_NEW_ERROR(isolate, call, T) \
|
||||
do { \
|
||||
return isolate->Throw<T>(isolate->factory()->call); \
|
||||
#define THROW_NEW_ERROR(isolate, call, T) \
|
||||
do { \
|
||||
Isolate* __isolate__ = (isolate); \
|
||||
return __isolate__->Throw<T>(__isolate__->factory()->call); \
|
||||
} while (false)
|
||||
|
||||
#define THROW_NEW_ERROR_RETURN_FAILURE(isolate, call) \
|
||||
do { \
|
||||
return isolate->Throw(*isolate->factory()->call); \
|
||||
#define THROW_NEW_ERROR_RETURN_FAILURE(isolate, call) \
|
||||
do { \
|
||||
Isolate* __isolate__ = (isolate); \
|
||||
return __isolate__->Throw(*__isolate__->factory()->call); \
|
||||
} while (false)
|
||||
|
||||
#define RETURN_ON_EXCEPTION_VALUE(isolate, call, value) \
|
||||
@ -157,8 +173,12 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \
|
||||
RETURN_ON_EXCEPTION_VALUE(isolate, call, isolate->heap()->exception())
|
||||
#define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \
|
||||
do { \
|
||||
Isolate* __isolate__ = (isolate); \
|
||||
RETURN_ON_EXCEPTION_VALUE(__isolate__, call, \
|
||||
__isolate__->heap()->exception()); \
|
||||
} while (false);
|
||||
|
||||
#define RETURN_ON_EXCEPTION(isolate, call, T) \
|
||||
RETURN_ON_EXCEPTION_VALUE(isolate, call, MaybeHandle<T>())
|
||||
|
@ -504,11 +504,8 @@ RUNTIME_FUNCTION(Runtime_ArraySpeciesConstructor) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK(args.length() == 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0);
|
||||
Handle<Object> constructor;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, constructor,
|
||||
Object::ArraySpeciesConstructor(isolate, original_array));
|
||||
return *constructor;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Object::ArraySpeciesConstructor(isolate, original_array));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -186,11 +186,9 @@ RUNTIME_FUNCTION(Runtime_DefineClass) {
|
||||
CONVERT_SMI_ARG_CHECKED(start_position, 2);
|
||||
CONVERT_SMI_ARG_CHECKED(end_position, 3);
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, DefineClass(isolate, super_class, constructor,
|
||||
start_position, end_position));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, DefineClass(isolate, super_class, constructor, start_position,
|
||||
end_position));
|
||||
}
|
||||
|
||||
|
||||
@ -247,10 +245,8 @@ RUNTIME_FUNCTION(Runtime_LoadFromSuper) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, name, 2);
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, LoadFromSuper(isolate, receiver, home_object, name));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
LoadFromSuper(isolate, receiver, home_object, name));
|
||||
}
|
||||
|
||||
|
||||
@ -262,13 +258,10 @@ RUNTIME_FUNCTION(Runtime_LoadKeyedFromSuper) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 2);
|
||||
|
||||
uint32_t index = 0;
|
||||
Handle<Object> result;
|
||||
|
||||
if (key->ToArrayIndex(&index)) {
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
LoadElementFromSuper(isolate, receiver, home_object, index));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, LoadElementFromSuper(isolate, receiver, home_object, index));
|
||||
}
|
||||
|
||||
Handle<Name> name;
|
||||
@ -276,14 +269,11 @@ RUNTIME_FUNCTION(Runtime_LoadKeyedFromSuper) {
|
||||
Object::ToName(isolate, key));
|
||||
// TODO(verwaest): Unify using LookupIterator.
|
||||
if (name->AsArrayIndex(&index)) {
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
LoadElementFromSuper(isolate, receiver, home_object, index));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, LoadElementFromSuper(isolate, receiver, home_object, index));
|
||||
}
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, LoadFromSuper(isolate, receiver, home_object, name));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
LoadFromSuper(isolate, receiver, home_object, name));
|
||||
}
|
||||
|
||||
|
||||
|
@ -313,10 +313,8 @@ RUNTIME_FUNCTION(Runtime_DebugGetInternalProperties) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK(args.length() == 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0);
|
||||
Handle<JSArray> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Runtime::GetInternalProperties(isolate, obj));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
Runtime::GetInternalProperties(isolate, obj));
|
||||
}
|
||||
|
||||
|
||||
@ -764,10 +762,7 @@ RUNTIME_FUNCTION(Runtime_GetScopeDetails) {
|
||||
if (it.Done()) {
|
||||
return isolate->heap()->undefined_value();
|
||||
}
|
||||
Handle<JSObject> details;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, details,
|
||||
it.MaterializeScopeDetails());
|
||||
return *details;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, it.MaterializeScopeDetails());
|
||||
}
|
||||
|
||||
|
||||
@ -856,10 +851,7 @@ RUNTIME_FUNCTION(Runtime_GetFunctionScopeDetails) {
|
||||
return isolate->heap()->undefined_value();
|
||||
}
|
||||
|
||||
Handle<JSObject> details;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, details,
|
||||
it.MaterializeScopeDetails());
|
||||
return *details;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, it.MaterializeScopeDetails());
|
||||
}
|
||||
|
||||
|
||||
@ -1141,12 +1133,9 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluate) {
|
||||
|
||||
StackFrame::Id id = DebugFrameHelper::UnwrapFrameId(wrapped_id);
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
DebugEvaluate::Local(isolate, id, inlined_jsframe_index, source,
|
||||
disable_break, context_extension));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, DebugEvaluate::Local(isolate, id, inlined_jsframe_index, source,
|
||||
disable_break, context_extension));
|
||||
}
|
||||
|
||||
|
||||
@ -1163,11 +1152,9 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluateGlobal) {
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, context_extension, 3);
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
DebugEvaluate::Global(isolate, source, disable_break, context_extension));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -1313,12 +1300,9 @@ RUNTIME_FUNCTION(Runtime_DebugGetPrototype) {
|
||||
HandleScope shs(isolate);
|
||||
DCHECK(args.length() == 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
|
||||
Handle<Object> prototype;
|
||||
// TODO(1543): Come up with a solution for clients to handle potential errors
|
||||
// thrown by an intermediate proxy.
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, prototype,
|
||||
JSReceiver::GetPrototype(isolate, obj));
|
||||
return *prototype;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, JSReceiver::GetPrototype(isolate, obj));
|
||||
}
|
||||
|
||||
|
||||
@ -1359,15 +1343,13 @@ RUNTIME_FUNCTION(Runtime_FunctionGetDebugName) {
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
|
||||
|
||||
Handle<Object> name;
|
||||
if (function->IsJSBoundFunction()) {
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, name, JSBoundFunction::GetName(
|
||||
isolate, Handle<JSBoundFunction>::cast(function)));
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, JSBoundFunction::GetName(
|
||||
isolate, Handle<JSBoundFunction>::cast(function)));
|
||||
} else {
|
||||
name = JSFunction::GetDebugName(Handle<JSFunction>::cast(function));
|
||||
return *JSFunction::GetDebugName(Handle<JSFunction>::cast(function));
|
||||
}
|
||||
return *name;
|
||||
}
|
||||
|
||||
|
||||
@ -1423,12 +1405,9 @@ RUNTIME_FUNCTION(Runtime_ExecuteInDebugContext) {
|
||||
return isolate->heap()->exception();
|
||||
}
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
Execution::Call(isolate, function, handle(function->global_proxy()), 0,
|
||||
NULL));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Execution::Call(isolate, function,
|
||||
handle(function->global_proxy()), 0, NULL));
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,9 +107,7 @@ RUNTIME_FUNCTION(Runtime_ForInEnumerate) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
|
||||
Handle<HeapObject> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Enumerate(receiver));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Enumerate(receiver));
|
||||
}
|
||||
|
||||
|
||||
@ -159,9 +157,7 @@ RUNTIME_FUNCTION(Runtime_ForInFilter) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Filter(receiver, key));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Filter(receiver, key));
|
||||
}
|
||||
|
||||
|
||||
@ -177,9 +173,7 @@ RUNTIME_FUNCTION(Runtime_ForInNext) {
|
||||
if (receiver->map() == *cache_type) {
|
||||
return *key;
|
||||
}
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Filter(receiver, key));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Filter(receiver, key));
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,15 +21,13 @@ RUNTIME_FUNCTION(Runtime_FunctionGetName) {
|
||||
DCHECK(args.length() == 1);
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
|
||||
Handle<Object> result;
|
||||
if (function->IsJSBoundFunction()) {
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, JSBoundFunction::GetName(
|
||||
isolate, Handle<JSBoundFunction>::cast(function)));
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, JSBoundFunction::GetName(
|
||||
isolate, Handle<JSBoundFunction>::cast(function)));
|
||||
} else {
|
||||
result = JSFunction::GetName(isolate, Handle<JSFunction>::cast(function));
|
||||
return *JSFunction::GetName(isolate, Handle<JSFunction>::cast(function));
|
||||
}
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -276,11 +274,8 @@ RUNTIME_FUNCTION(Runtime_Call) {
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
argv[i] = args.at<Object>(2 + i);
|
||||
}
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
Execution::Call(isolate, target, receiver, argc, argv.start()));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Execution::Call(isolate, target, receiver, argc, argv.start()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -382,13 +382,10 @@ RUNTIME_FUNCTION(Runtime_InternalDateFormat) {
|
||||
icu::UnicodeString result;
|
||||
date_format->format(value->Number(), result);
|
||||
|
||||
Handle<String> result_str;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result_str,
|
||||
isolate->factory()->NewStringFromTwoByte(Vector<const uint16_t>(
|
||||
reinterpret_cast<const uint16_t*>(result.getBuffer()),
|
||||
result.length())));
|
||||
return *result_str;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, isolate->factory()->NewStringFromTwoByte(Vector<const uint16_t>(
|
||||
reinterpret_cast<const uint16_t*>(result.getBuffer()),
|
||||
result.length())));
|
||||
}
|
||||
|
||||
|
||||
@ -410,12 +407,9 @@ RUNTIME_FUNCTION(Runtime_InternalDateParse) {
|
||||
UDate date = date_format->parse(u_date, status);
|
||||
if (U_FAILURE(status)) return isolate->heap()->undefined_value();
|
||||
|
||||
Handle<JSDate> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
JSDate::New(isolate->date_function(), isolate->date_function(),
|
||||
static_cast<double>(date)));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, JSDate::New(isolate->date_function(), isolate->date_function(),
|
||||
static_cast<double>(date)));
|
||||
}
|
||||
|
||||
|
||||
@ -476,13 +470,10 @@ RUNTIME_FUNCTION(Runtime_InternalNumberFormat) {
|
||||
icu::UnicodeString result;
|
||||
number_format->format(value->Number(), result);
|
||||
|
||||
Handle<String> result_str;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result_str,
|
||||
isolate->factory()->NewStringFromTwoByte(Vector<const uint16_t>(
|
||||
reinterpret_cast<const uint16_t*>(result.getBuffer()),
|
||||
result.length())));
|
||||
return *result_str;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, isolate->factory()->NewStringFromTwoByte(Vector<const uint16_t>(
|
||||
reinterpret_cast<const uint16_t*>(result.getBuffer()),
|
||||
result.length())));
|
||||
}
|
||||
|
||||
|
||||
@ -647,13 +638,10 @@ RUNTIME_FUNCTION(Runtime_StringNormalize) {
|
||||
return isolate->heap()->undefined_value();
|
||||
}
|
||||
|
||||
Handle<String> result_str;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result_str,
|
||||
isolate->factory()->NewStringFromTwoByte(Vector<const uint16_t>(
|
||||
reinterpret_cast<const uint16_t*>(result.getBuffer()),
|
||||
result.length())));
|
||||
return *result_str;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, isolate->factory()->NewStringFromTwoByte(Vector<const uint16_t>(
|
||||
reinterpret_cast<const uint16_t*>(result.getBuffer()),
|
||||
result.length())));
|
||||
}
|
||||
|
||||
|
||||
@ -848,13 +836,11 @@ MUST_USE_RESULT Object* LocaleConvertCase(Handle<String> s, Isolate* isolate,
|
||||
// If no change is made, just return |s|.
|
||||
if (converted.getBuffer() == src) return *s;
|
||||
}
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
isolate->factory()->NewStringFromTwoByte(Vector<const uint16_t>(
|
||||
reinterpret_cast<const uint16_t*>(converted.getBuffer()),
|
||||
converted.length())));
|
||||
return *result;
|
||||
}
|
||||
|
||||
auto case_converter = is_to_upper ? u_strToUpper : u_strToLower;
|
||||
|
@ -369,12 +369,9 @@ RUNTIME_FUNCTION(Runtime_FormatMessageString) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, arg0, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, arg1, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, arg2, 3);
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
MessageTemplate::FormatMessage(template_index, arg0, arg1, arg2));
|
||||
isolate->native_context()->IncrementErrorsThrown();
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, MessageTemplate::FormatMessage(
|
||||
template_index, arg0, arg1, arg2));
|
||||
}
|
||||
|
||||
#define CALLSITE_GET(NAME, RETURN) \
|
||||
@ -515,11 +512,8 @@ RUNTIME_FUNCTION(Runtime_CreateListFromArrayLike) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<FixedArray> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
Object::CreateListFromArrayLike(isolate, object, ElementTypes::kAll));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::CreateListFromArrayLike(
|
||||
isolate, object, ElementTypes::kAll));
|
||||
}
|
||||
|
||||
|
||||
@ -597,10 +591,8 @@ RUNTIME_FUNCTION(Runtime_OrdinaryHasInstance) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, callable, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Object::OrdinaryHasInstance(isolate, callable, object));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Object::OrdinaryHasInstance(isolate, callable, object));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -18,10 +18,8 @@ RUNTIME_FUNCTION(Runtime_QuoteJSONString) {
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
|
||||
DCHECK(args.length() == 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, BasicJsonStringifier::StringifyString(isolate, string));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, BasicJsonStringifier::StringifyString(isolate, string));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_BasicJSONStringify) {
|
||||
@ -29,10 +27,8 @@ RUNTIME_FUNCTION(Runtime_BasicJSONStringify) {
|
||||
DCHECK(args.length() == 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, gap, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, BasicJsonStringifier(isolate).Stringify(object, gap));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, BasicJsonStringifier(isolate).Stringify(object, gap));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ParseJson) {
|
||||
@ -44,12 +40,9 @@ RUNTIME_FUNCTION(Runtime_ParseJson) {
|
||||
Object::ToString(isolate, object));
|
||||
source = String::Flatten(source);
|
||||
// Optimized fast case where we only have Latin1 characters.
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
source->IsSeqOneByteString()
|
||||
? JsonParser<true>::Parse(source)
|
||||
: JsonParser<false>::Parse(source));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, source->IsSeqOneByteString()
|
||||
? JsonParser<true>::Parse(source)
|
||||
: JsonParser<false>::Parse(source));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -263,9 +263,7 @@ RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) {
|
||||
MaybeHandle<Object> maybe_copy =
|
||||
JSObject::DeepCopy(boilerplate, &usage_context);
|
||||
usage_context.ExitScope(site, boilerplate);
|
||||
Handle<Object> copy;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, copy, maybe_copy);
|
||||
return *copy;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, maybe_copy);
|
||||
}
|
||||
|
||||
MUST_USE_RESULT static MaybeHandle<AllocationSite> GetLiteralAllocationSite(
|
||||
@ -333,12 +331,10 @@ RUNTIME_FUNCTION(Runtime_CreateArrayLiteral) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
|
||||
CONVERT_SMI_ARG_CHECKED(flags, 3);
|
||||
|
||||
Handle<JSObject> result;
|
||||
Handle<LiteralsArray> literals(closure->literals(), isolate);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, CreateArrayLiteralImpl(isolate, literals, literals_index,
|
||||
elements, flags));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, CreateArrayLiteralImpl(isolate, literals, literals_index,
|
||||
elements, flags));
|
||||
}
|
||||
|
||||
|
||||
@ -349,13 +345,11 @@ RUNTIME_FUNCTION(Runtime_CreateArrayLiteralStubBailout) {
|
||||
CONVERT_SMI_ARG_CHECKED(literals_index, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
|
||||
|
||||
Handle<JSObject> result;
|
||||
Handle<LiteralsArray> literals(closure->literals(), isolate);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
CreateArrayLiteralImpl(isolate, literals, literals_index, elements,
|
||||
ArrayLiteral::kShallowElements));
|
||||
return *result;
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -70,10 +70,8 @@ RUNTIME_FUNCTION(Runtime_LiveEditGatherCompileInfo) {
|
||||
RUNTIME_ASSERT(script->value()->IsScript());
|
||||
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value()));
|
||||
|
||||
Handle<JSArray> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, LiveEdit::GatherCompileInfo(script_handle, source));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
LiveEdit::GatherCompileInfo(script_handle, source));
|
||||
}
|
||||
|
||||
|
||||
|
@ -230,10 +230,7 @@ RUNTIME_FUNCTION(Runtime_GetPrototype) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK(args.length() == 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0);
|
||||
Handle<Object> prototype;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, prototype,
|
||||
JSReceiver::GetPrototype(isolate, obj));
|
||||
return *prototype;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, JSReceiver::GetPrototype(isolate, obj));
|
||||
}
|
||||
|
||||
|
||||
@ -305,9 +302,7 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) {
|
||||
script_context->set(slot, isolate->heap()->empty_property_cell());
|
||||
}
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::GetProperty(&it));
|
||||
}
|
||||
|
||||
|
||||
@ -376,10 +371,8 @@ RUNTIME_FUNCTION(Runtime_GetProperty) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Runtime::GetObjectProperty(isolate, object, key));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
Runtime::GetObjectProperty(isolate, object, key));
|
||||
}
|
||||
|
||||
|
||||
@ -391,10 +384,8 @@ RUNTIME_FUNCTION(Runtime_KeyedGetProperty) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, receiver_obj, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key_obj, 1);
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, KeyedGetObjectProperty(isolate, receiver_obj, key_obj));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, KeyedGetObjectProperty(isolate, receiver_obj, key_obj));
|
||||
}
|
||||
|
||||
|
||||
@ -416,11 +407,8 @@ RUNTIME_FUNCTION(Runtime_AddNamedProperty) {
|
||||
RUNTIME_ASSERT(!it.IsFound());
|
||||
#endif
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
JSObject::SetOwnPropertyIgnoreAttributes(object, name, value, attrs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, JSObject::SetOwnPropertyIgnoreAttributes(
|
||||
object, name, value, attrs));
|
||||
}
|
||||
|
||||
|
||||
@ -450,11 +438,8 @@ RUNTIME_FUNCTION(Runtime_AddElement) {
|
||||
}
|
||||
#endif
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
JSObject::SetOwnElementIgnoreAttributes(object, index, value, NONE));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, JSObject::SetOwnElementIgnoreAttributes(
|
||||
object, index, value, NONE));
|
||||
}
|
||||
|
||||
|
||||
@ -468,9 +453,8 @@ RUNTIME_FUNCTION(Runtime_AppendElement) {
|
||||
uint32_t index;
|
||||
CHECK(array->length()->ToArrayIndex(&index));
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, JSObject::AddDataElement(array, index, value, NONE));
|
||||
RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, JSObject::AddDataElement(array, index, value, NONE));
|
||||
JSObject::ValidateElements(array);
|
||||
return *array;
|
||||
}
|
||||
@ -486,11 +470,9 @@ RUNTIME_FUNCTION(Runtime_SetProperty) {
|
||||
CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode_arg, 3);
|
||||
LanguageMode language_mode = language_mode_arg;
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(isolate, object, key, value, language_mode));
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
@ -629,10 +611,7 @@ RUNTIME_FUNCTION(Runtime_NewObject) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, new_target, 1);
|
||||
Handle<JSObject> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
JSObject::New(target, new_target));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, JSObject::New(target, new_target));
|
||||
}
|
||||
|
||||
|
||||
@ -836,10 +815,7 @@ RUNTIME_FUNCTION(Runtime_ToObject) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<JSReceiver> receiver;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver,
|
||||
Object::ToObject(isolate, object));
|
||||
return *receiver;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToObject(isolate, object));
|
||||
}
|
||||
|
||||
|
||||
@ -847,10 +823,7 @@ RUNTIME_FUNCTION(Runtime_ToPrimitive) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::ToPrimitive(input));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToPrimitive(input));
|
||||
}
|
||||
|
||||
|
||||
@ -858,10 +831,8 @@ RUNTIME_FUNCTION(Runtime_ToPrimitive_Number) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Object::ToPrimitive(input, ToPrimitiveHint::kNumber));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Object::ToPrimitive(input, ToPrimitiveHint::kNumber));
|
||||
}
|
||||
|
||||
|
||||
@ -869,10 +840,8 @@ RUNTIME_FUNCTION(Runtime_ToPrimitive_String) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Object::ToPrimitive(input, ToPrimitiveHint::kString));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Object::ToPrimitive(input, ToPrimitiveHint::kString));
|
||||
}
|
||||
|
||||
|
||||
@ -880,9 +849,7 @@ RUNTIME_FUNCTION(Runtime_ToNumber) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::ToNumber(input));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToNumber(input));
|
||||
}
|
||||
|
||||
|
||||
@ -890,10 +857,7 @@ RUNTIME_FUNCTION(Runtime_ToInteger) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::ToInteger(isolate, input));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToInteger(isolate, input));
|
||||
}
|
||||
|
||||
|
||||
@ -901,10 +865,7 @@ RUNTIME_FUNCTION(Runtime_ToLength) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::ToLength(isolate, input));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToLength(isolate, input));
|
||||
}
|
||||
|
||||
|
||||
@ -912,10 +873,7 @@ RUNTIME_FUNCTION(Runtime_ToString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::ToString(isolate, input));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToString(isolate, input));
|
||||
}
|
||||
|
||||
|
||||
@ -923,10 +881,7 @@ RUNTIME_FUNCTION(Runtime_ToName) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::ToName(isolate, input));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToName(isolate, input));
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,10 +14,7 @@ RUNTIME_FUNCTION(Runtime_Multiply) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::Multiply(isolate, lhs, rhs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::Multiply(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
|
||||
@ -26,10 +23,7 @@ RUNTIME_FUNCTION(Runtime_Divide) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::Divide(isolate, lhs, rhs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::Divide(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
|
||||
@ -38,10 +32,7 @@ RUNTIME_FUNCTION(Runtime_Modulus) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::Modulus(isolate, lhs, rhs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::Modulus(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
|
||||
@ -50,10 +41,7 @@ RUNTIME_FUNCTION(Runtime_Add) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::Add(isolate, lhs, rhs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::Add(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
|
||||
@ -62,10 +50,7 @@ RUNTIME_FUNCTION(Runtime_Subtract) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::Subtract(isolate, lhs, rhs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::Subtract(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
|
||||
@ -74,10 +59,7 @@ RUNTIME_FUNCTION(Runtime_ShiftLeft) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::ShiftLeft(isolate, lhs, rhs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ShiftLeft(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
|
||||
@ -86,10 +68,7 @@ RUNTIME_FUNCTION(Runtime_ShiftRight) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::ShiftRight(isolate, lhs, rhs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ShiftRight(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
|
||||
@ -98,10 +77,8 @@ RUNTIME_FUNCTION(Runtime_ShiftRightLogical) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Object::ShiftRightLogical(isolate, lhs, rhs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
Object::ShiftRightLogical(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
|
||||
@ -110,10 +87,7 @@ RUNTIME_FUNCTION(Runtime_BitwiseAnd) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::BitwiseAnd(isolate, lhs, rhs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::BitwiseAnd(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
|
||||
@ -122,10 +96,7 @@ RUNTIME_FUNCTION(Runtime_BitwiseOr) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::BitwiseOr(isolate, lhs, rhs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::BitwiseOr(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
|
||||
@ -134,10 +105,7 @@ RUNTIME_FUNCTION(Runtime_BitwiseXor) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
Object::BitwiseXor(isolate, lhs, rhs));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::BitwiseXor(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_Equal) {
|
||||
@ -221,10 +189,8 @@ RUNTIME_FUNCTION(Runtime_InstanceOf) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, callable, 1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Object::InstanceOf(isolate, object, callable));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
Object::InstanceOf(isolate, object, callable));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -46,11 +46,9 @@ RUNTIME_FUNCTION(Runtime_JSProxyCall) {
|
||||
for (int i = 0; i < arguments_length; ++i) {
|
||||
argv[i] = args.at<Object>(i + 1);
|
||||
}
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Execution::Call(isolate, target, receiver,
|
||||
arguments_length, argv.start()));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Execution::Call(isolate, target, receiver, arguments_length,
|
||||
argv.start()));
|
||||
}
|
||||
// 7. Let argArray be CreateArrayFromList(argumentsList).
|
||||
Handle<JSArray> arg_array = isolate->factory()->NewJSArray(
|
||||
@ -63,12 +61,10 @@ RUNTIME_FUNCTION(Runtime_JSProxyCall) {
|
||||
}
|
||||
}
|
||||
// 8. Return Call(trap, handler, «target, thisArgument, argArray»).
|
||||
Handle<Object> trap_result;
|
||||
Handle<Object> trap_args[] = {target, receiver, arg_array};
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, trap_result,
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
Execution::Call(isolate, trap, handler, arraysize(trap_args), trap_args));
|
||||
return *trap_result;
|
||||
}
|
||||
|
||||
|
||||
@ -106,11 +102,9 @@ RUNTIME_FUNCTION(Runtime_JSProxyConstruct) {
|
||||
for (int i = 0; i < arguments_length; ++i) {
|
||||
argv[i] = args.at<Object>(i + 1);
|
||||
}
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Execution::New(isolate, target, new_target,
|
||||
arguments_length, argv.start()));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Execution::New(isolate, target, new_target, arguments_length,
|
||||
argv.start()));
|
||||
}
|
||||
// 7. Let argArray be CreateArrayFromList(argumentsList).
|
||||
Handle<JSArray> arg_array = isolate->factory()->NewJSArray(
|
||||
|
@ -544,9 +544,7 @@ MUST_USE_RESULT static Object* StringReplaceGlobalRegExpWithString(
|
||||
RegExpImpl::SetLastMatchInfo(last_match_info, subject, capture_count,
|
||||
global_cache.LastSuccessfulMatch());
|
||||
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, builder.ToString());
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, builder.ToString());
|
||||
}
|
||||
|
||||
|
||||
@ -779,11 +777,8 @@ RUNTIME_FUNCTION(Runtime_RegExpExec) {
|
||||
RUNTIME_ASSERT(index >= 0);
|
||||
RUNTIME_ASSERT(index <= subject->length());
|
||||
isolate->counters()->regexp_entry_runtime()->Increment();
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
RegExpImpl::Exec(regexp, subject, index, last_match_info));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, RegExpImpl::Exec(regexp, subject, index, last_match_info));
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,10 +162,8 @@ RUNTIME_FUNCTION(Runtime_InitializeVarGlobal) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
|
||||
Handle<JSGlobalObject> global(isolate->context()->global_object());
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, Object::SetProperty(global, name, value, language_mode));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Object::SetProperty(global, name, value, language_mode));
|
||||
}
|
||||
|
||||
|
||||
@ -923,10 +921,8 @@ RUNTIME_FUNCTION(Runtime_LoadLookupSlot) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
Handle<Object> value;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, value, LoadLookupSlot(name, Object::THROW_ON_ERROR));
|
||||
return *value;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
LoadLookupSlot(name, Object::THROW_ON_ERROR));
|
||||
}
|
||||
|
||||
|
||||
@ -934,10 +930,7 @@ RUNTIME_FUNCTION(Runtime_LoadLookupSlotInsideTypeof) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
Handle<Object> value;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, value, LoadLookupSlot(name, Object::DONT_THROW));
|
||||
return *value;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, LoadLookupSlot(name, Object::DONT_THROW));
|
||||
}
|
||||
|
||||
|
||||
@ -1021,9 +1014,7 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Sloppy) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value,
|
||||
StoreLookupSlot(name, value, SLOPPY));
|
||||
return *value;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, SLOPPY));
|
||||
}
|
||||
|
||||
|
||||
@ -1032,9 +1023,7 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value,
|
||||
StoreLookupSlot(name, value, STRICT));
|
||||
return *value;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -313,10 +313,8 @@ RUNTIME_FUNCTION(Runtime_StringAdd) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, str1, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, str2, 1);
|
||||
isolate->counters()->string_add_runtime()->Increment();
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, isolate->factory()->NewConsString(str1, str2));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
isolate->factory()->NewConsString(str1, str2));
|
||||
}
|
||||
|
||||
|
||||
@ -1140,15 +1138,13 @@ RUNTIME_FUNCTION(Runtime_NewString) {
|
||||
CONVERT_INT32_ARG_CHECKED(length, 0);
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(is_one_byte, 1);
|
||||
if (length == 0) return isolate->heap()->empty_string();
|
||||
Handle<String> result;
|
||||
if (is_one_byte) {
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, isolate->factory()->NewRawOneByteString(length));
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
isolate->factory()->NewRawOneByteString(length));
|
||||
} else {
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, isolate->factory()->NewRawTwoByteString(length));
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
isolate->factory()->NewRawTwoByteString(length));
|
||||
}
|
||||
return *result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,9 +52,7 @@ RUNTIME_FUNCTION(Runtime_SymbolDescriptiveString) {
|
||||
builder.AppendString(handle(String::cast(symbol->name()), isolate));
|
||||
}
|
||||
builder.AppendCharacter(')');
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, builder.Finish());
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate, builder.Finish());
|
||||
}
|
||||
|
||||
|
||||
|
@ -264,12 +264,10 @@ RUNTIME_FUNCTION(Runtime_URIEscape) {
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, source,
|
||||
Object::ToString(isolate, input));
|
||||
source = String::Flatten(source);
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, source->IsOneByteRepresentationUnderneath()
|
||||
? URIEscape::Escape<uint8_t>(isolate, source)
|
||||
: URIEscape::Escape<uc16>(isolate, source));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
source->IsOneByteRepresentationUnderneath()
|
||||
? URIEscape::Escape<uint8_t>(isolate, source)
|
||||
: URIEscape::Escape<uc16>(isolate, source));
|
||||
}
|
||||
|
||||
|
||||
@ -281,12 +279,10 @@ RUNTIME_FUNCTION(Runtime_URIUnescape) {
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, source,
|
||||
Object::ToString(isolate, input));
|
||||
source = String::Flatten(source);
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, source->IsOneByteRepresentationUnderneath()
|
||||
? URIUnescape::Unescape<uint8_t>(isolate, source)
|
||||
: URIUnescape::Unescape<uc16>(isolate, source));
|
||||
return *result;
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
source->IsOneByteRepresentationUnderneath()
|
||||
? URIUnescape::Unescape<uint8_t>(isolate, source)
|
||||
: URIUnescape::Unescape<uc16>(isolate, source));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
11
src/uri.cc
11
src/uri.cc
@ -89,7 +89,8 @@ void EncodePair(uc16 cc1, uc16 cc2, List<uint8_t>* buffer) {
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
Object* Uri::Encode(Isolate* isolate, Handle<String> uri, bool is_uri) {
|
||||
MaybeHandle<String> Uri::Encode(Isolate* isolate, Handle<String> uri,
|
||||
bool is_uri) {
|
||||
uri = String::Flatten(uri);
|
||||
int uri_length = uri->length();
|
||||
List<uint8_t> buffer(uri_length);
|
||||
@ -120,15 +121,11 @@ Object* Uri::Encode(Isolate* isolate, Handle<String> uri, bool is_uri) {
|
||||
}
|
||||
|
||||
AllowHeapAllocation allocate_error_and_return;
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewURIError());
|
||||
THROW_NEW_ERROR(isolate, NewURIError(), String);
|
||||
}
|
||||
}
|
||||
|
||||
Handle<String> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
isolate->factory()->NewStringFromOneByte(buffer.ToConstVector()));
|
||||
return *result;
|
||||
return isolate->factory()->NewStringFromOneByte(buffer.ToConstVector());
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -13,12 +13,12 @@ namespace internal {
|
||||
|
||||
class Uri : public AllStatic {
|
||||
public:
|
||||
static Object* EncodeUri(Isolate* isolate, Handle<String> uri) {
|
||||
static MaybeHandle<String> EncodeUri(Isolate* isolate, Handle<String> uri) {
|
||||
return Encode(isolate, uri, true);
|
||||
}
|
||||
|
||||
static Object* EncodeUriComponent(Isolate* isolate,
|
||||
Handle<String> component) {
|
||||
static MaybeHandle<String> EncodeUriComponent(Isolate* isolate,
|
||||
Handle<String> component) {
|
||||
return Encode(isolate, component, false);
|
||||
}
|
||||
|
||||
@ -28,7 +28,8 @@ class Uri : public AllStatic {
|
||||
// unescape
|
||||
|
||||
private:
|
||||
static Object* Encode(Isolate* isolate, Handle<String> uri, bool is_uri);
|
||||
static MaybeHandle<String> Encode(Isolate* isolate, Handle<String> uri,
|
||||
bool is_uri);
|
||||
// decode
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user