OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/api-natives.h" | 5 #include "src/api-natives.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/isolate-inl.h" | 8 #include "src/isolate-inl.h" |
9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 } | 432 } |
433 NeanderArray array(list); | 433 NeanderArray array(list); |
434 array.add(isolate, property); | 434 array.add(isolate, property); |
435 } | 435 } |
436 | 436 |
437 | 437 |
438 Handle<JSFunction> ApiNatives::CreateApiFunction( | 438 Handle<JSFunction> ApiNatives::CreateApiFunction( |
439 Isolate* isolate, Handle<FunctionTemplateInfo> obj, | 439 Isolate* isolate, Handle<FunctionTemplateInfo> obj, |
440 Handle<Object> prototype, ApiInstanceType instance_type) { | 440 Handle<Object> prototype, ApiInstanceType instance_type) { |
441 Handle<Code> code = isolate->builtins()->HandleApiCall(); | 441 Handle<Code> code = isolate->builtins()->HandleApiCall(); |
442 Handle<Code> construct_stub = isolate->builtins()->JSConstructStubApi(); | 442 Handle<Code> construct_stub = |
| 443 prototype.is_null() ? isolate->builtins()->ConstructedNonConstructable() |
| 444 : isolate->builtins()->JSConstructStubApi(); |
443 | 445 |
444 obj->set_instantiated(true); | 446 obj->set_instantiated(true); |
445 Handle<JSFunction> result; | 447 Handle<JSFunction> result; |
446 if (obj->remove_prototype()) { | 448 if (obj->remove_prototype()) { |
447 result = isolate->factory()->NewFunctionWithoutPrototype( | 449 result = isolate->factory()->NewFunctionWithoutPrototype( |
448 isolate->factory()->empty_string(), code); | 450 isolate->factory()->empty_string(), code); |
449 } else { | 451 } else { |
450 int internal_field_count = 0; | 452 int internal_field_count = 0; |
451 if (!obj->instance_template()->IsUndefined()) { | 453 if (!obj->instance_template()->IsUndefined()) { |
452 Handle<ObjectTemplateInfo> instance_template = Handle<ObjectTemplateInfo>( | 454 Handle<ObjectTemplateInfo> instance_template = Handle<ObjectTemplateInfo>( |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); | 610 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); |
609 JSObject::SetAccessor(result, accessor).Assert(); | 611 JSObject::SetAccessor(result, accessor).Assert(); |
610 } | 612 } |
611 | 613 |
612 DCHECK(result->shared()->IsApiFunction()); | 614 DCHECK(result->shared()->IsApiFunction()); |
613 return result; | 615 return result; |
614 } | 616 } |
615 | 617 |
616 } // namespace internal | 618 } // namespace internal |
617 } // namespace v8 | 619 } // namespace v8 |
OLD | NEW |