| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 Map::SetPrototype(map, prototype_parent); | 123 Map::SetPrototype(map, prototype_parent); |
| 124 map->SetConstructor(*constructor); | 124 map->SetConstructor(*constructor); |
| 125 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); | 125 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); |
| 126 | 126 |
| 127 if (!super_class->IsTheHole(isolate)) { | 127 if (!super_class->IsTheHole(isolate)) { |
| 128 // Derived classes, just like builtins, don't create implicit receivers in | 128 // Derived classes, just like builtins, don't create implicit receivers in |
| 129 // [[construct]]. Instead they just set up new.target and call into the | 129 // [[construct]]. Instead they just set up new.target and call into the |
| 130 // constructor. Hence we can reuse the builtins construct stub for derived | 130 // constructor. Hence we can reuse the builtins construct stub for derived |
| 131 // classes. | 131 // classes. |
| 132 Handle<Code> stub(isolate->builtins()->JSBuiltinsConstructStubForDerived()); | 132 Handle<Code> stub(isolate->builtins()->JSBuiltinsConstructStubForDerived()); |
| 133 constructor->shared()->set_construct_stub(*stub); | 133 constructor->shared()->SetConstructStub(*stub); |
| 134 } | 134 } |
| 135 | 135 |
| 136 JSFunction::SetPrototype(constructor, prototype); | 136 JSFunction::SetPrototype(constructor, prototype); |
| 137 PropertyAttributes attribs = | 137 PropertyAttributes attribs = |
| 138 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 138 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 139 RETURN_ON_EXCEPTION(isolate, | 139 RETURN_ON_EXCEPTION(isolate, |
| 140 JSObject::SetOwnPropertyIgnoreAttributes( | 140 JSObject::SetOwnPropertyIgnoreAttributes( |
| 141 constructor, isolate->factory()->prototype_string(), | 141 constructor, isolate->factory()->prototype_string(), |
| 142 prototype, attribs), | 142 prototype, attribs), |
| 143 Object); | 143 Object); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 390 |
| 391 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) { | 391 RUNTIME_FUNCTION(Runtime_GetSuperConstructor) { |
| 392 SealHandleScope shs(isolate); | 392 SealHandleScope shs(isolate); |
| 393 DCHECK_EQ(1, args.length()); | 393 DCHECK_EQ(1, args.length()); |
| 394 CONVERT_ARG_CHECKED(JSFunction, active_function, 0); | 394 CONVERT_ARG_CHECKED(JSFunction, active_function, 0); |
| 395 return active_function->map()->prototype(); | 395 return active_function->map()->prototype(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 } // namespace internal | 398 } // namespace internal |
| 399 } // namespace v8 | 399 } // namespace v8 |
| OLD | NEW |