Chromium Code Reviews| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 Map::SetPrototype(map, prototype_parent); | 135 Map::SetPrototype(map, prototype_parent); |
| 136 map->SetConstructor(*constructor); | 136 map->SetConstructor(*constructor); |
| 137 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); | 137 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); |
| 138 | 138 |
| 139 Handle<String> name_string = name->IsString() | 139 Handle<String> name_string = name->IsString() |
| 140 ? Handle<String>::cast(name) | 140 ? Handle<String>::cast(name) |
| 141 : isolate->factory()->empty_string(); | 141 : isolate->factory()->empty_string(); |
| 142 constructor->shared()->set_name(*name_string); | 142 constructor->shared()->set_name(*name_string); |
| 143 | 143 |
| 144 if (!super_class->IsTheHole()) { | 144 if (!super_class->IsTheHole()) { |
| 145 Handle<Code> stub(isolate->builtins()->JSConstructStubForDerived()); | 145 Handle<Code> stub(isolate->builtins()->JSBuiltinsConstructStub()); |
|
Igor Sheludko
2015/11/18 09:16:07
Please add a comment about why do we use JSBuiltin
Toon Verwaest
2015/11/18 13:24:57
Done.
| |
| 146 constructor->shared()->set_construct_stub(*stub); | 146 constructor->shared()->set_construct_stub(*stub); |
| 147 } | 147 } |
| 148 | 148 |
| 149 JSFunction::SetPrototype(constructor, prototype); | 149 JSFunction::SetPrototype(constructor, prototype); |
| 150 PropertyAttributes attribs = | 150 PropertyAttributes attribs = |
| 151 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 151 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 152 RETURN_ON_EXCEPTION(isolate, | 152 RETURN_ON_EXCEPTION(isolate, |
| 153 JSObject::SetOwnPropertyIgnoreAttributes( | 153 JSObject::SetOwnPropertyIgnoreAttributes( |
| 154 constructor, isolate->factory()->prototype_string(), | 154 constructor, isolate->factory()->prototype_string(), |
| 155 prototype, attribs), | 155 prototype, attribs), |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 Handle<Object> result; | 497 Handle<Object> result; |
| 498 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 498 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 499 isolate, result, Execution::New(isolate, super_constructor, new_target, | 499 isolate, result, Execution::New(isolate, super_constructor, new_target, |
| 500 argument_count, arguments.get())); | 500 argument_count, arguments.get())); |
| 501 | 501 |
| 502 return *result; | 502 return *result; |
| 503 } | 503 } |
| 504 | 504 |
| 505 } // namespace internal | 505 } // namespace internal |
| 506 } // namespace v8 | 506 } // namespace v8 |
| OLD | NEW |