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 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1724 void Genesis::InitializeGlobal_harmony_reflect() { | 1724 void Genesis::InitializeGlobal_harmony_reflect() { |
1725 Handle<JSObject> builtins(native_context()->builtins()); | 1725 Handle<JSObject> builtins(native_context()->builtins()); |
1726 // Install references to functions of the Reflect object | 1726 // Install references to functions of the Reflect object |
1727 if (FLAG_harmony_reflect || FLAG_harmony_spreadcalls) { | 1727 if (FLAG_harmony_reflect || FLAG_harmony_spreadcalls) { |
1728 Handle<JSFunction> apply = InstallFunction( | 1728 Handle<JSFunction> apply = InstallFunction( |
1729 builtins, "$reflectApply", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1729 builtins, "$reflectApply", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
1730 MaybeHandle<JSObject>(), Builtins::kReflectApply); | 1730 MaybeHandle<JSObject>(), Builtins::kReflectApply); |
1731 Handle<JSFunction> construct = InstallFunction( | 1731 Handle<JSFunction> construct = InstallFunction( |
1732 builtins, "$reflectConstruct", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1732 builtins, "$reflectConstruct", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
1733 MaybeHandle<JSObject>(), Builtins::kReflectConstruct); | 1733 MaybeHandle<JSObject>(), Builtins::kReflectConstruct); |
1734 if (FLAG_vector_ics) { | |
1735 // Apply embeds an IC, so we need a type vector of size 1 in the shared | |
1736 // function info. | |
1737 FeedbackVectorSpec spec(0, Code::CALL_IC); | |
1738 Handle<TypeFeedbackVector> feedback_vector = | |
1739 factory()->NewTypeFeedbackVector(&spec); | |
1740 apply->shared()->set_feedback_vector(*feedback_vector); | |
1741 | |
1742 feedback_vector = factory()->NewTypeFeedbackVector(&spec); | |
1743 construct->shared()->set_feedback_vector(*feedback_vector); | |
1744 } | |
1745 | |
1746 apply->shared()->set_internal_formal_parameter_count(3); | 1734 apply->shared()->set_internal_formal_parameter_count(3); |
1747 apply->shared()->set_length(3); | 1735 apply->shared()->set_length(3); |
1748 | 1736 |
1749 construct->shared()->set_internal_formal_parameter_count(3); | 1737 construct->shared()->set_internal_formal_parameter_count(3); |
1750 construct->shared()->set_length(2); | 1738 construct->shared()->set_length(2); |
1751 } | 1739 } |
1752 | 1740 |
1753 if (!FLAG_harmony_reflect) return; | 1741 if (!FLAG_harmony_reflect) return; |
1754 Handle<JSGlobalObject> global(JSGlobalObject::cast( | 1742 Handle<JSGlobalObject> global(JSGlobalObject::cast( |
1755 native_context()->global_object())); | 1743 native_context()->global_object())); |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 Handle<JSObject> proto = | 2162 Handle<JSObject> proto = |
2175 Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 2163 Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
2176 | 2164 |
2177 // Install the call and the apply functions. | 2165 // Install the call and the apply functions. |
2178 Handle<JSFunction> call = | 2166 Handle<JSFunction> call = |
2179 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2167 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
2180 MaybeHandle<JSObject>(), Builtins::kFunctionCall); | 2168 MaybeHandle<JSObject>(), Builtins::kFunctionCall); |
2181 Handle<JSFunction> apply = | 2169 Handle<JSFunction> apply = |
2182 InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2170 InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
2183 MaybeHandle<JSObject>(), Builtins::kFunctionApply); | 2171 MaybeHandle<JSObject>(), Builtins::kFunctionApply); |
2184 if (FLAG_vector_ics) { | |
2185 // Apply embeds an IC, so we need a type vector of size 1 in the shared | |
2186 // function info. | |
2187 FeedbackVectorSpec spec(0, Code::CALL_IC); | |
2188 Handle<TypeFeedbackVector> feedback_vector = | |
2189 factory()->NewTypeFeedbackVector(&spec); | |
2190 apply->shared()->set_feedback_vector(*feedback_vector); | |
2191 } | |
2192 | 2172 |
2193 // Make sure that Function.prototype.call appears to be compiled. | 2173 // Make sure that Function.prototype.call appears to be compiled. |
2194 // The code will never be called, but inline caching for call will | 2174 // The code will never be called, but inline caching for call will |
2195 // only work if it appears to be compiled. | 2175 // only work if it appears to be compiled. |
2196 call->shared()->DontAdaptArguments(); | 2176 call->shared()->DontAdaptArguments(); |
2197 DCHECK(call->is_compiled()); | 2177 DCHECK(call->is_compiled()); |
2198 | 2178 |
2199 // Set the expected parameters for apply to 2; required by builtin. | 2179 // Set the expected parameters for apply to 2; required by builtin. |
2200 apply->shared()->set_internal_formal_parameter_count(2); | 2180 apply->shared()->set_internal_formal_parameter_count(2); |
2201 | 2181 |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2959 return from + sizeof(NestingCounterType); | 2939 return from + sizeof(NestingCounterType); |
2960 } | 2940 } |
2961 | 2941 |
2962 | 2942 |
2963 // Called when the top-level V8 mutex is destroyed. | 2943 // Called when the top-level V8 mutex is destroyed. |
2964 void Bootstrapper::FreeThreadResources() { | 2944 void Bootstrapper::FreeThreadResources() { |
2965 DCHECK(!IsActive()); | 2945 DCHECK(!IsActive()); |
2966 } | 2946 } |
2967 | 2947 |
2968 } } // namespace v8::internal | 2948 } } // namespace v8::internal |
OLD | NEW |