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( | 1940 Handle<TypeFeedbackVector> apply_feedback_vector = |
1941 *TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate())); | 1941 TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate()); |
| 1942 apply->shared()->set_feedback_vector(*apply_feedback_vector); |
1942 | 1943 |
1943 Handle<JSFunction> construct = InstallFunction( | 1944 Handle<JSFunction> construct = InstallFunction( |
1944 builtins, "$reflectConstruct", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1945 builtins, "$reflectConstruct", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
1945 MaybeHandle<JSObject>(), Builtins::kReflectConstruct); | 1946 MaybeHandle<JSObject>(), Builtins::kReflectConstruct); |
1946 construct->shared()->set_internal_formal_parameter_count(3); | 1947 construct->shared()->set_internal_formal_parameter_count(3); |
1947 construct->shared()->set_length(2); | 1948 construct->shared()->set_length(2); |
1948 construct->shared()->set_feedback_vector( | 1949 Handle<TypeFeedbackVector> construct_feedback_vector = |
1949 *TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate())); | 1950 TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate()); |
| 1951 construct->shared()->set_feedback_vector(*construct_feedback_vector); |
1950 | 1952 |
1951 if (!FLAG_harmony_reflect) return; | 1953 if (!FLAG_harmony_reflect) return; |
1952 | 1954 |
1953 Handle<JSGlobalObject> global(JSGlobalObject::cast( | 1955 Handle<JSGlobalObject> global(JSGlobalObject::cast( |
1954 native_context()->global_object())); | 1956 native_context()->global_object())); |
1955 Handle<String> reflect_string = | 1957 Handle<String> reflect_string = |
1956 factory()->NewStringFromStaticChars("Reflect"); | 1958 factory()->NewStringFromStaticChars("Reflect"); |
1957 Handle<Object> reflect = | 1959 Handle<Object> reflect = |
1958 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1960 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1959 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); | 1961 JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2437 Handle<JSObject> proto = | 2439 Handle<JSObject> proto = |
2438 Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 2440 Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
2439 | 2441 |
2440 // Install the call and the apply functions. | 2442 // Install the call and the apply functions. |
2441 Handle<JSFunction> call = | 2443 Handle<JSFunction> call = |
2442 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2444 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
2443 MaybeHandle<JSObject>(), Builtins::kFunctionCall); | 2445 MaybeHandle<JSObject>(), Builtins::kFunctionCall); |
2444 Handle<JSFunction> apply = | 2446 Handle<JSFunction> apply = |
2445 InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2447 InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
2446 MaybeHandle<JSObject>(), Builtins::kFunctionApply); | 2448 MaybeHandle<JSObject>(), Builtins::kFunctionApply); |
2447 apply->shared()->set_feedback_vector( | 2449 Handle<TypeFeedbackVector> feedback_vector = |
2448 *TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate())); | 2450 TypeFeedbackVector::CreatePushAppliedArgumentsVector(isolate()); |
| 2451 apply->shared()->set_feedback_vector(*feedback_vector); |
2449 | 2452 |
2450 // Make sure that Function.prototype.call appears to be compiled. | 2453 // Make sure that Function.prototype.call appears to be compiled. |
2451 // The code will never be called, but inline caching for call will | 2454 // The code will never be called, but inline caching for call will |
2452 // only work if it appears to be compiled. | 2455 // only work if it appears to be compiled. |
2453 call->shared()->DontAdaptArguments(); | 2456 call->shared()->DontAdaptArguments(); |
2454 DCHECK(call->is_compiled()); | 2457 DCHECK(call->is_compiled()); |
2455 | 2458 |
2456 // Set the expected parameters for apply to 2; required by builtin. | 2459 // Set the expected parameters for apply to 2; required by builtin. |
2457 apply->shared()->set_internal_formal_parameter_count(2); | 2460 apply->shared()->set_internal_formal_parameter_count(2); |
2458 | 2461 |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3287 } | 3290 } |
3288 | 3291 |
3289 | 3292 |
3290 // Called when the top-level V8 mutex is destroyed. | 3293 // Called when the top-level V8 mutex is destroyed. |
3291 void Bootstrapper::FreeThreadResources() { | 3294 void Bootstrapper::FreeThreadResources() { |
3292 DCHECK(!IsActive()); | 3295 DCHECK(!IsActive()); |
3293 } | 3296 } |
3294 | 3297 |
3295 } // namespace internal | 3298 } // namespace internal |
3296 } // namespace v8 | 3299 } // namespace v8 |
OLD | NEW |