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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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()) { | 91 if (super_class->IsTheHole()) { |
92 prototype_parent = isolate->initial_object_prototype(); | 92 prototype_parent = isolate->initial_object_prototype(); |
93 } else { | 93 } else { |
94 if (super_class->IsNull()) { | 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 if (super_class->IsJSFunction() && | 97 DCHECK(!Handle<JSFunction>::cast(super_class)->shared()->is_resumable()); |
caitp (gmail)
2016/05/20 13:35:56
Is this CHECK really needed? if we have this check
Dan Ehrenberg
2016/05/20 14:59:19
Just because I'm removing old code on the basis of
| |
98 Handle<JSFunction>::cast(super_class)->shared()->is_generator()) { | |
99 THROW_NEW_ERROR( | |
100 isolate, | |
101 NewTypeError(MessageTemplate::kExtendsValueGenerator, super_class), | |
102 Object); | |
103 } | |
104 ASSIGN_RETURN_ON_EXCEPTION( | 98 ASSIGN_RETURN_ON_EXCEPTION( |
105 isolate, prototype_parent, | 99 isolate, prototype_parent, |
106 Runtime::GetObjectProperty(isolate, super_class, | 100 Runtime::GetObjectProperty(isolate, super_class, |
107 isolate->factory()->prototype_string()), | 101 isolate->factory()->prototype_string()), |
108 Object); | 102 Object); |
109 if (!prototype_parent->IsNull() && !prototype_parent->IsJSReceiver()) { | 103 if (!prototype_parent->IsNull() && !prototype_parent->IsJSReceiver()) { |
110 THROW_NEW_ERROR( | 104 THROW_NEW_ERROR( |
111 isolate, NewTypeError(MessageTemplate::kPrototypeParentNotAnObject, | 105 isolate, NewTypeError(MessageTemplate::kPrototypeParentNotAnObject, |
112 prototype_parent), | 106 prototype_parent), |
113 Object); | 107 Object); |
114 } | 108 } |
115 constructor_parent = super_class; | 109 constructor_parent = super_class; |
116 } else { | 110 } else { |
117 THROW_NEW_ERROR( | 111 THROW_NEW_ERROR( |
118 isolate, | 112 isolate, |
119 NewTypeError(MessageTemplate::kExtendsValueNotFunction, super_class), | 113 NewTypeError(MessageTemplate::kExtendsValueNotConstructor, super_class ), |
caitp (gmail)
2016/05/20 13:35:56
awfully similar to my CL from yesterday :p but it'
Dan Ehrenberg
2016/05/20 14:59:19
Oops! I hadn't gotten around to reviewing it yet.
| |
120 Object); | 114 Object); |
121 } | 115 } |
122 } | 116 } |
123 | 117 |
124 Handle<Map> map = | 118 Handle<Map> map = |
125 isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 119 isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
126 map->set_is_prototype_map(true); | 120 map->set_is_prototype_map(true); |
127 Map::SetPrototype(map, prototype_parent); | 121 Map::SetPrototype(map, prototype_parent); |
128 map->SetConstructor(*constructor); | 122 map->SetConstructor(*constructor); |
129 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); | 123 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
404 | 398 |
405 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) { | 399 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) { |
406 SealHandleScope shs(isolate); | 400 SealHandleScope shs(isolate); |
407 DCHECK_EQ(1, args.length()); | 401 DCHECK_EQ(1, args.length()); |
408 CONVERT_ARG_CHECKED(JSFunction, active_function, 0); | 402 CONVERT_ARG_CHECKED(JSFunction, active_function, 0); |
409 return active_function->map()->prototype(); | 403 return active_function->map()->prototype(); |
410 } | 404 } |
411 | 405 |
412 } // namespace internal | 406 } // namespace internal |
413 } // namespace v8 | 407 } // namespace v8 |
OLD | NEW |