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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 type = JS_OBJECT_TYPE; // Keep the compiler happy. | 649 type = JS_OBJECT_TYPE; // Keep the compiler happy. |
650 break; | 650 break; |
651 } | 651 } |
652 | 652 |
653 Handle<Map> map = | 653 Handle<Map> map = |
654 isolate->factory()->NewMap(type, instance_size, FAST_HOLEY_SMI_ELEMENTS); | 654 isolate->factory()->NewMap(type, instance_size, FAST_HOLEY_SMI_ELEMENTS); |
655 JSFunction::SetInitialMap(result, map, Handle<JSObject>::cast(prototype)); | 655 JSFunction::SetInitialMap(result, map, Handle<JSObject>::cast(prototype)); |
656 | 656 |
657 // Mark as undetectable if needed. | 657 // Mark as undetectable if needed. |
658 if (obj->undetectable()) { | 658 if (obj->undetectable()) { |
| 659 // We only allow callable undetectable receivers here, since this whole |
| 660 // undetectable business is only to support document.all, which is both |
| 661 // undetectable and callable. If we ever see the need to have an object |
| 662 // that is undetectable but not callable, we need to update the types.h |
| 663 // to allow encoding this. |
| 664 CHECK(!obj->instance_call_handler()->IsUndefined(isolate)); |
659 map->set_is_undetectable(); | 665 map->set_is_undetectable(); |
660 } | 666 } |
661 | 667 |
662 // Mark as needs_access_check if needed. | 668 // Mark as needs_access_check if needed. |
663 if (obj->needs_access_check()) { | 669 if (obj->needs_access_check()) { |
664 map->set_is_access_check_needed(true); | 670 map->set_is_access_check_needed(true); |
665 } | 671 } |
666 | 672 |
667 // Set interceptor information in the map. | 673 // Set interceptor information in the map. |
668 if (!obj->named_property_handler()->IsUndefined(isolate)) { | 674 if (!obj->named_property_handler()->IsUndefined(isolate)) { |
669 map->set_has_named_interceptor(); | 675 map->set_has_named_interceptor(); |
670 } | 676 } |
671 if (!obj->indexed_property_handler()->IsUndefined(isolate)) { | 677 if (!obj->indexed_property_handler()->IsUndefined(isolate)) { |
672 map->set_has_indexed_interceptor(); | 678 map->set_has_indexed_interceptor(); |
673 } | 679 } |
674 | 680 |
675 // Mark instance as callable in the map. | 681 // Mark instance as callable in the map. |
676 if (!obj->instance_call_handler()->IsUndefined(isolate)) { | 682 if (!obj->instance_call_handler()->IsUndefined(isolate)) { |
677 map->set_is_callable(); | 683 map->set_is_callable(); |
678 map->set_is_constructor(true); | 684 map->set_is_constructor(true); |
679 } | 685 } |
680 | 686 |
681 if (immutable_proto) map->set_immutable_proto(true); | 687 if (immutable_proto) map->set_immutable_proto(true); |
682 | 688 |
683 return result; | 689 return result; |
684 } | 690 } |
685 | 691 |
686 } // namespace internal | 692 } // namespace internal |
687 } // namespace v8 | 693 } // namespace v8 |
OLD | NEW |