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/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 Handle<String> NAME##_name = factory->NewStringFromAsciiChecked(#NAME); \ | 1858 Handle<String> NAME##_name = factory->NewStringFromAsciiChecked(#NAME); \ |
1859 JSObject::AddProperty(container, NAME##_name, factory->NAME(), NONE); | 1859 JSObject::AddProperty(container, NAME##_name, factory->NAME(), NONE); |
1860 PUBLIC_SYMBOL_LIST(EXPORT_PUBLIC_SYMBOL) | 1860 PUBLIC_SYMBOL_LIST(EXPORT_PUBLIC_SYMBOL) |
1861 WELL_KNOWN_SYMBOL_LIST(EXPORT_PUBLIC_SYMBOL) | 1861 WELL_KNOWN_SYMBOL_LIST(EXPORT_PUBLIC_SYMBOL) |
1862 #undef EXPORT_PUBLIC_SYMBOL | 1862 #undef EXPORT_PUBLIC_SYMBOL |
1863 | 1863 |
1864 { | 1864 { |
1865 Handle<JSFunction> apply = InstallFunction( | 1865 Handle<JSFunction> apply = InstallFunction( |
1866 container, "reflect_apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1866 container, "reflect_apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
1867 MaybeHandle<JSObject>(), Builtins::kReflectApply); | 1867 MaybeHandle<JSObject>(), Builtins::kReflectApply); |
1868 apply->shared()->DontAdaptArguments(); | 1868 apply->shared()->set_internal_formal_parameter_count(3); |
1869 apply->shared()->set_length(3); | 1869 apply->shared()->set_length(3); |
| 1870 Handle<TypeFeedbackVector> feedback_vector = |
| 1871 TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate); |
| 1872 apply->shared()->set_feedback_vector(*feedback_vector); |
1870 native_context->set_reflect_apply(*apply); | 1873 native_context->set_reflect_apply(*apply); |
1871 } | 1874 } |
1872 | 1875 |
1873 { | 1876 { |
1874 Handle<JSFunction> construct = InstallFunction( | 1877 Handle<JSFunction> construct = InstallFunction( |
1875 container, "reflect_construct", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1878 container, "reflect_construct", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
1876 MaybeHandle<JSObject>(), Builtins::kReflectConstruct); | 1879 MaybeHandle<JSObject>(), Builtins::kReflectConstruct); |
1877 construct->shared()->DontAdaptArguments(); | 1880 construct->shared()->set_internal_formal_parameter_count(3); |
1878 construct->shared()->set_length(2); | 1881 construct->shared()->set_length(2); |
| 1882 Handle<TypeFeedbackVector> feedback_vector = |
| 1883 TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate); |
| 1884 construct->shared()->set_feedback_vector(*feedback_vector); |
1879 native_context->set_reflect_construct(*construct); | 1885 native_context->set_reflect_construct(*construct); |
1880 } | 1886 } |
1881 | 1887 |
1882 { | 1888 { |
1883 Handle<JSFunction> to_string = InstallFunction( | 1889 Handle<JSFunction> to_string = InstallFunction( |
1884 container, "object_to_string", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1890 container, "object_to_string", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
1885 MaybeHandle<JSObject>(), Builtins::kObjectProtoToString); | 1891 MaybeHandle<JSObject>(), Builtins::kObjectProtoToString); |
1886 to_string->shared()->DontAdaptArguments(); | 1892 to_string->shared()->DontAdaptArguments(); |
1887 to_string->shared()->set_length(0); | 1893 to_string->shared()->set_length(0); |
1888 native_context->set_object_to_string(*to_string); | 1894 native_context->set_object_to_string(*to_string); |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2522 Handle<JSObject> proto = | 2528 Handle<JSObject> proto = |
2523 Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 2529 Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
2524 | 2530 |
2525 // Install the call and the apply functions. | 2531 // Install the call and the apply functions. |
2526 Handle<JSFunction> call = | 2532 Handle<JSFunction> call = |
2527 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2533 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
2528 MaybeHandle<JSObject>(), Builtins::kFunctionCall); | 2534 MaybeHandle<JSObject>(), Builtins::kFunctionCall); |
2529 Handle<JSFunction> apply = | 2535 Handle<JSFunction> apply = |
2530 InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2536 InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
2531 MaybeHandle<JSObject>(), Builtins::kFunctionApply); | 2537 MaybeHandle<JSObject>(), Builtins::kFunctionApply); |
| 2538 Handle<TypeFeedbackVector> feedback_vector = |
| 2539 TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate()); |
| 2540 apply->shared()->set_feedback_vector(*feedback_vector); |
2532 | 2541 |
2533 // Make sure that Function.prototype.call appears to be compiled. | 2542 // Make sure that Function.prototype.call appears to be compiled. |
2534 // The code will never be called, but inline caching for call will | 2543 // The code will never be called, but inline caching for call will |
2535 // only work if it appears to be compiled. | 2544 // only work if it appears to be compiled. |
2536 apply->shared()->DontAdaptArguments(); | |
2537 call->shared()->DontAdaptArguments(); | 2545 call->shared()->DontAdaptArguments(); |
2538 DCHECK(call->is_compiled()); | 2546 DCHECK(call->is_compiled()); |
2539 | 2547 |
| 2548 // Set the expected parameters for apply to 2; required by builtin. |
| 2549 apply->shared()->set_internal_formal_parameter_count(2); |
| 2550 |
2540 // Set the lengths for the functions to satisfy ECMA-262. | 2551 // Set the lengths for the functions to satisfy ECMA-262. |
| 2552 call->shared()->set_length(1); |
2541 apply->shared()->set_length(2); | 2553 apply->shared()->set_length(2); |
2542 call->shared()->set_length(1); | |
2543 } | 2554 } |
2544 | 2555 |
2545 // Set up the Promise constructor. | 2556 // Set up the Promise constructor. |
2546 { | 2557 { |
2547 Handle<String> key = factory()->Promise_string(); | 2558 Handle<String> key = factory()->Promise_string(); |
2548 Handle<JSFunction> function = Handle<JSFunction>::cast( | 2559 Handle<JSFunction> function = Handle<JSFunction>::cast( |
2549 Object::GetProperty(handle(native_context()->global_object()), key) | 2560 Object::GetProperty(handle(native_context()->global_object()), key) |
2550 .ToHandleChecked()); | 2561 .ToHandleChecked()); |
2551 JSFunction::EnsureHasInitialMap(function); | 2562 JSFunction::EnsureHasInitialMap(function); |
2552 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); | 2563 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3352 } | 3363 } |
3353 | 3364 |
3354 | 3365 |
3355 // Called when the top-level V8 mutex is destroyed. | 3366 // Called when the top-level V8 mutex is destroyed. |
3356 void Bootstrapper::FreeThreadResources() { | 3367 void Bootstrapper::FreeThreadResources() { |
3357 DCHECK(!IsActive()); | 3368 DCHECK(!IsActive()); |
3358 } | 3369 } |
3359 | 3370 |
3360 } // namespace internal | 3371 } // namespace internal |
3361 } // namespace v8 | 3372 } // namespace v8 |
OLD | NEW |