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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 map->SetPrototype(prototype_parent); | 110 map->SetPrototype(prototype_parent); |
111 map->set_constructor(*constructor); | 111 map->set_constructor(*constructor); |
112 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); | 112 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); |
113 | 113 |
114 Handle<String> name_string = name->IsString() | 114 Handle<String> name_string = name->IsString() |
115 ? Handle<String>::cast(name) | 115 ? Handle<String>::cast(name) |
116 : isolate->factory()->empty_string(); | 116 : isolate->factory()->empty_string(); |
117 constructor->shared()->set_name(*name_string); | 117 constructor->shared()->set_name(*name_string); |
118 | 118 |
119 if (FLAG_experimental_classes) { | 119 if (FLAG_experimental_classes) { |
120 if (!super_class->IsTheHole()) { | 120 if (!super_class->IsTheHole() && !super_class->IsNull()) { |
121 Handle<Code> stub(isolate->builtins()->JSConstructStubForDerived()); | 121 Handle<Code> stub(isolate->builtins()->JSConstructStubForDerived()); |
122 constructor->shared()->set_construct_stub(*stub); | 122 constructor->shared()->set_construct_stub(*stub); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 JSFunction::SetPrototype(constructor, prototype); | 126 JSFunction::SetPrototype(constructor, prototype); |
127 PropertyAttributes attribs = | 127 PropertyAttributes attribs = |
128 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 128 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
129 RETURN_FAILURE_ON_EXCEPTION( | 129 RETURN_FAILURE_ON_EXCEPTION( |
130 isolate, JSObject::SetOwnPropertyIgnoreAttributes( | 130 isolate, JSObject::SetOwnPropertyIgnoreAttributes( |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 } | 454 } |
455 | 455 |
456 Handle<Object> result; | 456 Handle<Object> result; |
457 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 457 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
458 isolate, result, | 458 isolate, result, |
459 Execution::Call(isolate, proto_function, receiver, argc, argv, false)); | 459 Execution::Call(isolate, proto_function, receiver, argc, argv, false)); |
460 return *result; | 460 return *result; |
461 } | 461 } |
462 } | 462 } |
463 } // namespace v8::internal | 463 } // namespace v8::internal |
OLD | NEW |