| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 static MaybeHandle<Object> DefineClass(Isolate* isolate, | 84 static MaybeHandle<Object> DefineClass(Isolate* isolate, |
| 85 Handle<Object> super_class, | 85 Handle<Object> super_class, |
| 86 Handle<JSFunction> constructor, | 86 Handle<JSFunction> constructor, |
| 87 int start_position, int end_position) { | 87 int start_position, int end_position) { |
| 88 Handle<Object> prototype_parent; | 88 Handle<Object> prototype_parent; |
| 89 Handle<Object> constructor_parent; | 89 Handle<Object> constructor_parent; |
| 90 | 90 |
| 91 if (super_class->IsTheHole(isolate)) { | 91 if (super_class->IsTheHole(isolate)) { |
| 92 prototype_parent = isolate->initial_object_prototype(); | 92 prototype_parent = isolate->initial_object_prototype(); |
| 93 } else { | 93 } else { |
| 94 if (super_class->IsNull(isolate)) { | 94 if (super_class->IsNull()) { |
| 95 prototype_parent = isolate->factory()->null_value(); | 95 prototype_parent = isolate->factory()->null_value(); |
| 96 } else if (super_class->IsConstructor()) { | 96 } else if (super_class->IsConstructor()) { |
| 97 DCHECK(!super_class->IsJSFunction() || | 97 DCHECK(!super_class->IsJSFunction() || |
| 98 !Handle<JSFunction>::cast(super_class)->shared()->is_resumable()); | 98 !Handle<JSFunction>::cast(super_class)->shared()->is_resumable()); |
| 99 ASSIGN_RETURN_ON_EXCEPTION( | 99 ASSIGN_RETURN_ON_EXCEPTION( |
| 100 isolate, prototype_parent, | 100 isolate, prototype_parent, |
| 101 Runtime::GetObjectProperty(isolate, super_class, | 101 Runtime::GetObjectProperty(isolate, super_class, |
| 102 isolate->factory()->prototype_string()), | 102 isolate->factory()->prototype_string()), |
| 103 Object); | 103 Object); |
| 104 if (!prototype_parent->IsNull(isolate) && | 104 if (!prototype_parent->IsNull() && !prototype_parent->IsJSReceiver()) { |
| 105 !prototype_parent->IsJSReceiver()) { | |
| 106 THROW_NEW_ERROR( | 105 THROW_NEW_ERROR( |
| 107 isolate, NewTypeError(MessageTemplate::kPrototypeParentNotAnObject, | 106 isolate, NewTypeError(MessageTemplate::kPrototypeParentNotAnObject, |
| 108 prototype_parent), | 107 prototype_parent), |
| 109 Object); | 108 Object); |
| 110 } | 109 } |
| 111 constructor_parent = super_class; | 110 constructor_parent = super_class; |
| 112 } else { | 111 } else { |
| 113 THROW_NEW_ERROR(isolate, | 112 THROW_NEW_ERROR(isolate, |
| 114 NewTypeError(MessageTemplate::kExtendsValueNotConstructor, | 113 NewTypeError(MessageTemplate::kExtendsValueNotConstructor, |
| 115 super_class), | 114 super_class), |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 389 |
| 391 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) { | 390 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) { |
| 392 SealHandleScope shs(isolate); | 391 SealHandleScope shs(isolate); |
| 393 DCHECK_EQ(1, args.length()); | 392 DCHECK_EQ(1, args.length()); |
| 394 CONVERT_ARG_CHECKED(JSFunction, active_function, 0); | 393 CONVERT_ARG_CHECKED(JSFunction, active_function, 0); |
| 395 return active_function->map()->prototype(); | 394 return active_function->map()->prototype(); |
| 396 } | 395 } |
| 397 | 396 |
| 398 } // namespace internal | 397 } // namespace internal |
| 399 } // namespace v8 | 398 } // namespace v8 |
| OLD | NEW |