Chromium Code Reviews| 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()->set_internal_formal_parameter_count(3); | 1868 apply->shared()->DontAdaptArguments(); |
| 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); | |
| 1873 native_context->set_reflect_apply(*apply); | 1870 native_context->set_reflect_apply(*apply); |
|
Yang
2015/12/15 06:06:58
You can move this to InitializeGlobal if you rebas
Benedikt Meurer
2015/12/15 06:08:28
Yes, my plan was to further simplify this stuff la
| |
| 1874 } | 1871 } |
| 1875 | 1872 |
| 1876 { | 1873 { |
| 1877 Handle<JSFunction> construct = InstallFunction( | 1874 Handle<JSFunction> construct = InstallFunction( |
| 1878 container, "reflect_construct", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1875 container, "reflect_construct", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 1879 MaybeHandle<JSObject>(), Builtins::kReflectConstruct); | 1876 MaybeHandle<JSObject>(), Builtins::kReflectConstruct); |
| 1880 construct->shared()->set_internal_formal_parameter_count(3); | 1877 construct->shared()->DontAdaptArguments(); |
| 1881 construct->shared()->set_length(2); | 1878 construct->shared()->set_length(2); |
| 1882 Handle<TypeFeedbackVector> feedback_vector = | |
| 1883 TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate); | |
| 1884 construct->shared()->set_feedback_vector(*feedback_vector); | |
| 1885 native_context->set_reflect_construct(*construct); | 1879 native_context->set_reflect_construct(*construct); |
| 1886 } | 1880 } |
| 1887 | 1881 |
| 1888 { | 1882 { |
| 1889 Handle<JSFunction> to_string = InstallFunction( | 1883 Handle<JSFunction> to_string = InstallFunction( |
| 1890 container, "object_to_string", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1884 container, "object_to_string", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 1891 MaybeHandle<JSObject>(), Builtins::kObjectProtoToString); | 1885 MaybeHandle<JSObject>(), Builtins::kObjectProtoToString); |
| 1892 to_string->shared()->DontAdaptArguments(); | 1886 to_string->shared()->DontAdaptArguments(); |
| 1893 to_string->shared()->set_length(0); | 1887 to_string->shared()->set_length(0); |
| 1894 native_context->set_object_to_string(*to_string); | 1888 native_context->set_object_to_string(*to_string); |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2528 Handle<JSObject> proto = | 2522 Handle<JSObject> proto = |
| 2529 Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 2523 Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
| 2530 | 2524 |
| 2531 // Install the call and the apply functions. | 2525 // Install the call and the apply functions. |
| 2532 Handle<JSFunction> call = | 2526 Handle<JSFunction> call = |
| 2533 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2527 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 2534 MaybeHandle<JSObject>(), Builtins::kFunctionCall); | 2528 MaybeHandle<JSObject>(), Builtins::kFunctionCall); |
| 2535 Handle<JSFunction> apply = | 2529 Handle<JSFunction> apply = |
| 2536 InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2530 InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 2537 MaybeHandle<JSObject>(), Builtins::kFunctionApply); | 2531 MaybeHandle<JSObject>(), Builtins::kFunctionApply); |
| 2538 Handle<TypeFeedbackVector> feedback_vector = | |
| 2539 TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate()); | |
| 2540 apply->shared()->set_feedback_vector(*feedback_vector); | |
| 2541 | 2532 |
| 2542 // Make sure that Function.prototype.call appears to be compiled. | 2533 // Make sure that Function.prototype.call appears to be compiled. |
| 2543 // The code will never be called, but inline caching for call will | 2534 // The code will never be called, but inline caching for call will |
| 2544 // only work if it appears to be compiled. | 2535 // only work if it appears to be compiled. |
| 2536 apply->shared()->DontAdaptArguments(); | |
| 2545 call->shared()->DontAdaptArguments(); | 2537 call->shared()->DontAdaptArguments(); |
| 2546 DCHECK(call->is_compiled()); | 2538 DCHECK(call->is_compiled()); |
| 2547 | 2539 |
| 2548 // Set the expected parameters for apply to 2; required by builtin. | |
| 2549 apply->shared()->set_internal_formal_parameter_count(2); | |
| 2550 | |
| 2551 // Set the lengths for the functions to satisfy ECMA-262. | 2540 // Set the lengths for the functions to satisfy ECMA-262. |
| 2541 apply->shared()->set_length(2); | |
| 2552 call->shared()->set_length(1); | 2542 call->shared()->set_length(1); |
| 2553 apply->shared()->set_length(2); | |
| 2554 } | 2543 } |
| 2555 | 2544 |
| 2556 // Set up the Promise constructor. | 2545 // Set up the Promise constructor. |
| 2557 { | 2546 { |
| 2558 Handle<String> key = factory()->Promise_string(); | 2547 Handle<String> key = factory()->Promise_string(); |
| 2559 Handle<JSFunction> function = Handle<JSFunction>::cast( | 2548 Handle<JSFunction> function = Handle<JSFunction>::cast( |
| 2560 Object::GetProperty(handle(native_context()->global_object()), key) | 2549 Object::GetProperty(handle(native_context()->global_object()), key) |
| 2561 .ToHandleChecked()); | 2550 .ToHandleChecked()); |
| 2562 JSFunction::EnsureHasInitialMap(function); | 2551 JSFunction::EnsureHasInitialMap(function); |
| 2563 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); | 2552 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3363 } | 3352 } |
| 3364 | 3353 |
| 3365 | 3354 |
| 3366 // Called when the top-level V8 mutex is destroyed. | 3355 // Called when the top-level V8 mutex is destroyed. |
| 3367 void Bootstrapper::FreeThreadResources() { | 3356 void Bootstrapper::FreeThreadResources() { |
| 3368 DCHECK(!IsActive()); | 3357 DCHECK(!IsActive()); |
| 3369 } | 3358 } |
| 3370 | 3359 |
| 3371 } // namespace internal | 3360 } // namespace internal |
| 3372 } // namespace v8 | 3361 } // namespace v8 |
| OLD | NEW |