OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 | 759 |
760 Handle<JSObject> Factory::NewArgumentsObject(Handle<Object> callee, | 760 Handle<JSObject> Factory::NewArgumentsObject(Handle<Object> callee, |
761 int length) { | 761 int length) { |
762 CALL_HEAP_FUNCTION(Heap::AllocateArgumentsObject(*callee, length), JSObject); | 762 CALL_HEAP_FUNCTION(Heap::AllocateArgumentsObject(*callee, length), JSObject); |
763 } | 763 } |
764 | 764 |
765 | 765 |
766 Handle<JSFunction> Factory::CreateApiFunction( | 766 Handle<JSFunction> Factory::CreateApiFunction( |
767 Handle<FunctionTemplateInfo> obj, ApiInstanceType instance_type) { | 767 Handle<FunctionTemplateInfo> obj, ApiInstanceType instance_type) { |
768 Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::HandleApiCall)); | 768 Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::HandleApiCall)); |
| 769 Handle<Code> construct_stub = |
| 770 Handle<Code>(Builtins::builtin(Builtins::JSConstructStubApi)); |
769 | 771 |
770 int internal_field_count = 0; | 772 int internal_field_count = 0; |
771 if (!obj->instance_template()->IsUndefined()) { | 773 if (!obj->instance_template()->IsUndefined()) { |
772 Handle<ObjectTemplateInfo> instance_template = | 774 Handle<ObjectTemplateInfo> instance_template = |
773 Handle<ObjectTemplateInfo>( | 775 Handle<ObjectTemplateInfo>( |
774 ObjectTemplateInfo::cast(obj->instance_template())); | 776 ObjectTemplateInfo::cast(obj->instance_template())); |
775 internal_field_count = | 777 internal_field_count = |
776 Smi::cast(instance_template->internal_field_count())->value(); | 778 Smi::cast(instance_template->internal_field_count())->value(); |
777 } | 779 } |
778 | 780 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 if (!obj->indexed_property_handler()->IsUndefined()) { | 835 if (!obj->indexed_property_handler()->IsUndefined()) { |
834 map->set_has_indexed_interceptor(); | 836 map->set_has_indexed_interceptor(); |
835 } | 837 } |
836 | 838 |
837 // Set instance call-as-function information in the map. | 839 // Set instance call-as-function information in the map. |
838 if (!obj->instance_call_handler()->IsUndefined()) { | 840 if (!obj->instance_call_handler()->IsUndefined()) { |
839 map->set_has_instance_call_handler(); | 841 map->set_has_instance_call_handler(); |
840 } | 842 } |
841 | 843 |
842 result->shared()->set_function_data(*obj); | 844 result->shared()->set_function_data(*obj); |
| 845 result->shared()->set_construct_stub(*construct_stub); |
843 result->shared()->DontAdaptArguments(); | 846 result->shared()->DontAdaptArguments(); |
844 | 847 |
845 // Recursively copy parent templates' accessors, 'data' may be modified. | 848 // Recursively copy parent templates' accessors, 'data' may be modified. |
846 Handle<DescriptorArray> array = | 849 Handle<DescriptorArray> array = |
847 Handle<DescriptorArray>(map->instance_descriptors()); | 850 Handle<DescriptorArray>(map->instance_descriptors()); |
848 while (true) { | 851 while (true) { |
849 Handle<Object> props = Handle<Object>(obj->property_accessors()); | 852 Handle<Object> props = Handle<Object>(obj->property_accessors()); |
850 if (!props->IsUndefined()) { | 853 if (!props->IsUndefined()) { |
851 array = Factory::CopyAppendCallbackDescriptors(array, props); | 854 array = Factory::CopyAppendCallbackDescriptors(array, props); |
852 } | 855 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 Execution::ConfigureInstance(instance, | 951 Execution::ConfigureInstance(instance, |
949 instance_template, | 952 instance_template, |
950 pending_exception); | 953 pending_exception); |
951 } else { | 954 } else { |
952 *pending_exception = false; | 955 *pending_exception = false; |
953 } | 956 } |
954 } | 957 } |
955 | 958 |
956 | 959 |
957 } } // namespace v8::internal | 960 } } // namespace v8::internal |
OLD | NEW |