Index: src/runtime/runtime-classes.cc |
diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc |
index bc273eec307279c02024b674b0ac1843e8d72a73..d1c8568e58250b356bc2e2c3fece76595b383719 100644 |
--- a/src/runtime/runtime-classes.cc |
+++ b/src/runtime/runtime-classes.cc |
@@ -138,6 +138,18 @@ static MaybeHandle<Object> DefineClass(Isolate* isolate, Handle<Object> name, |
isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
if (constructor->map()->is_strong()) { |
map->set_is_strong(); |
+ if (super_class->IsNull()) { |
+ // Strong class is not permitted to extend null. |
+ THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kStrongExtendNull), |
+ Object); |
+ } |
+ } else { |
+ if (Handle<HeapObject>::cast(super_class)->map()->is_strong()) { |
+ // Weak class is not permitted to extend strong class. |
+ THROW_NEW_ERROR(isolate, |
+ NewTypeError(MessageTemplate::kStrongWeakExtend, name), |
+ Object); |
+ } |
} |
Map::SetPrototype(map, prototype_parent); |
map->SetConstructor(*constructor); |
@@ -212,28 +224,6 @@ RUNTIME_FUNCTION(Runtime_DefineClass) { |
} |
-RUNTIME_FUNCTION(Runtime_DefineClassStrong) { |
- HandleScope scope(isolate); |
- DCHECK(args.length() == 5); |
- CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); |
- CONVERT_ARG_HANDLE_CHECKED(Object, super_class, 1); |
- CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 2); |
- CONVERT_SMI_ARG_CHECKED(start_position, 3); |
- CONVERT_SMI_ARG_CHECKED(end_position, 4); |
- |
- if (super_class->IsNull()) { |
- THROW_NEW_ERROR_RETURN_FAILURE( |
- isolate, NewTypeError(MessageTemplate::kStrongExtendNull)); |
- } |
- |
- Handle<Object> result; |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, result, DefineClass(isolate, name, super_class, constructor, |
- start_position, end_position)); |
- return *result; |
-} |
- |
- |
RUNTIME_FUNCTION(Runtime_DefineClassMethod) { |
HandleScope scope(isolate); |
DCHECK(args.length() == 3); |