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/base/utils/random-number-generator.h" | 9 #include "src/base/utils/random-number-generator.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 | 1930 |
1931 | 1931 |
1932 void Genesis::InitializeGlobal_harmony_reflect() { | 1932 void Genesis::InitializeGlobal_harmony_reflect() { |
1933 Handle<JSObject> builtins(native_context()->builtins()); | 1933 Handle<JSObject> builtins(native_context()->builtins()); |
1934 | 1934 |
1935 Handle<JSFunction> apply = InstallFunction( | 1935 Handle<JSFunction> apply = InstallFunction( |
1936 builtins, "$reflectApply", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1936 builtins, "$reflectApply", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
1937 MaybeHandle<JSObject>(), Builtins::kReflectApply); | 1937 MaybeHandle<JSObject>(), Builtins::kReflectApply); |
1938 apply->shared()->set_internal_formal_parameter_count(3); | 1938 apply->shared()->set_internal_formal_parameter_count(3); |
1939 apply->shared()->set_length(3); | 1939 apply->shared()->set_length(3); |
| 1940 apply->shared()->set_feedback_vector( |
| 1941 *TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate())); |
1940 | 1942 |
1941 Handle<JSFunction> construct = InstallFunction( | 1943 Handle<JSFunction> construct = InstallFunction( |
1942 builtins, "$reflectConstruct", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1944 builtins, "$reflectConstruct", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
1943 MaybeHandle<JSObject>(), Builtins::kReflectConstruct); | 1945 MaybeHandle<JSObject>(), Builtins::kReflectConstruct); |
1944 construct->shared()->set_internal_formal_parameter_count(3); | 1946 construct->shared()->set_internal_formal_parameter_count(3); |
1945 construct->shared()->set_length(2); | 1947 construct->shared()->set_length(2); |
| 1948 construct->shared()->set_feedback_vector( |
| 1949 *TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate())); |
1946 | 1950 |
1947 if (!FLAG_harmony_reflect) return; | 1951 if (!FLAG_harmony_reflect) return; |
1948 | 1952 |
1949 Handle<JSGlobalObject> global(JSGlobalObject::cast( | 1953 Handle<JSGlobalObject> global(JSGlobalObject::cast( |
1950 native_context()->global_object())); | 1954 native_context()->global_object())); |
1951 Handle<String> reflect_string = | 1955 Handle<String> reflect_string = |
1952 factory()->NewStringFromStaticChars("Reflect"); | 1956 factory()->NewStringFromStaticChars("Reflect"); |
1953 Handle<Object> reflect = | 1957 Handle<Object> reflect = |
1954 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1958 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1955 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); | 1959 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 Handle<JSObject> proto = | 2437 Handle<JSObject> proto = |
2434 Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 2438 Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
2435 | 2439 |
2436 // Install the call and the apply functions. | 2440 // Install the call and the apply functions. |
2437 Handle<JSFunction> call = | 2441 Handle<JSFunction> call = |
2438 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2442 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
2439 MaybeHandle<JSObject>(), Builtins::kFunctionCall); | 2443 MaybeHandle<JSObject>(), Builtins::kFunctionCall); |
2440 Handle<JSFunction> apply = | 2444 Handle<JSFunction> apply = |
2441 InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2445 InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
2442 MaybeHandle<JSObject>(), Builtins::kFunctionApply); | 2446 MaybeHandle<JSObject>(), Builtins::kFunctionApply); |
| 2447 apply->shared()->set_feedback_vector( |
| 2448 *TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate())); |
2443 | 2449 |
2444 // Make sure that Function.prototype.call appears to be compiled. | 2450 // Make sure that Function.prototype.call appears to be compiled. |
2445 // The code will never be called, but inline caching for call will | 2451 // The code will never be called, but inline caching for call will |
2446 // only work if it appears to be compiled. | 2452 // only work if it appears to be compiled. |
2447 call->shared()->DontAdaptArguments(); | 2453 call->shared()->DontAdaptArguments(); |
2448 DCHECK(call->is_compiled()); | 2454 DCHECK(call->is_compiled()); |
2449 | 2455 |
2450 // Set the expected parameters for apply to 2; required by builtin. | 2456 // Set the expected parameters for apply to 2; required by builtin. |
2451 apply->shared()->set_internal_formal_parameter_count(2); | 2457 apply->shared()->set_internal_formal_parameter_count(2); |
2452 | 2458 |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3281 } | 3287 } |
3282 | 3288 |
3283 | 3289 |
3284 // Called when the top-level V8 mutex is destroyed. | 3290 // Called when the top-level V8 mutex is destroyed. |
3285 void Bootstrapper::FreeThreadResources() { | 3291 void Bootstrapper::FreeThreadResources() { |
3286 DCHECK(!IsActive()); | 3292 DCHECK(!IsActive()); |
3287 } | 3293 } |
3288 | 3294 |
3289 } // namespace internal | 3295 } // namespace internal |
3290 } // namespace v8 | 3296 } // namespace v8 |
OLD | NEW |