Merge V8 5.3.332.45. DO NOT MERGE
Test: Manual
FPIIM-449
Change-Id: Id3254828b068abdea3cb10442e0172a8c9a98e03
(cherry picked from commit 13e2dadd00298019ed862f2b2fc5068bba730bcf)
diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc
index a784d6d..303122f 100644
--- a/src/runtime/runtime-classes.cc
+++ b/src/runtime/runtime-classes.cc
@@ -88,25 +88,21 @@
Handle<Object> prototype_parent;
Handle<Object> constructor_parent;
- if (super_class->IsTheHole()) {
+ if (super_class->IsTheHole(isolate)) {
prototype_parent = isolate->initial_object_prototype();
} else {
- if (super_class->IsNull()) {
+ if (super_class->IsNull(isolate)) {
prototype_parent = isolate->factory()->null_value();
} else if (super_class->IsConstructor()) {
- if (super_class->IsJSFunction() &&
- Handle<JSFunction>::cast(super_class)->shared()->is_generator()) {
- THROW_NEW_ERROR(
- isolate,
- NewTypeError(MessageTemplate::kExtendsValueGenerator, super_class),
- Object);
- }
+ DCHECK(!super_class->IsJSFunction() ||
+ !Handle<JSFunction>::cast(super_class)->shared()->is_resumable());
ASSIGN_RETURN_ON_EXCEPTION(
isolate, prototype_parent,
Runtime::GetObjectProperty(isolate, super_class,
isolate->factory()->prototype_string()),
Object);
- if (!prototype_parent->IsNull() && !prototype_parent->IsJSReceiver()) {
+ if (!prototype_parent->IsNull(isolate) &&
+ !prototype_parent->IsJSReceiver()) {
THROW_NEW_ERROR(
isolate, NewTypeError(MessageTemplate::kPrototypeParentNotAnObject,
prototype_parent),
@@ -114,10 +110,10 @@
}
constructor_parent = super_class;
} else {
- THROW_NEW_ERROR(
- isolate,
- NewTypeError(MessageTemplate::kExtendsValueNotFunction, super_class),
- Object);
+ THROW_NEW_ERROR(isolate,
+ NewTypeError(MessageTemplate::kExtendsValueNotConstructor,
+ super_class),
+ Object);
}
}
@@ -128,7 +124,7 @@
map->SetConstructor(*constructor);
Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map);
- if (!super_class->IsTheHole()) {
+ if (!super_class->IsTheHole(isolate)) {
// Derived classes, just like builtins, don't create implicit receivers in
// [[construct]]. Instead they just set up new.target and call into the
// constructor. Hence we can reuse the builtins construct stub for derived
@@ -186,11 +182,9 @@
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 +241,8 @@
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 +254,10 @@
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 +265,11 @@
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));
}