Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: src/bootstrapper.cc

Issue 2829093004: [turbofan] Avoid going through ArgumentsAdaptorTrampoline for CSA/C++ builtins (Closed)
Patch Set: Add other files again Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/builtins/builtins-array-gen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \ 171 #define DECLARE_FEATURE_INITIALIZATION(id, descr) \
172 void InitializeGlobal_##id(); 172 void InitializeGlobal_##id();
173 173
174 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) 174 HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION)
175 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) 175 HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION)
176 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) 176 HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION)
177 #undef DECLARE_FEATURE_INITIALIZATION 177 #undef DECLARE_FEATURE_INITIALIZATION
178 178
179 void InstallOneBuiltinFunction(Handle<Object> prototype, const char* method, 179 void InstallOneBuiltinFunction(Handle<Object> prototype, const char* method,
180 Builtins::Name name); 180 Builtins::Name name,
181 int internal_formal_parameter_count);
181 void InitializeGlobal_experimental_fast_array_builtins(); 182 void InitializeGlobal_experimental_fast_array_builtins();
182 183
183 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target, 184 Handle<JSFunction> InstallArrayBuffer(Handle<JSObject> target,
184 const char* name, 185 const char* name,
185 Builtins::Name call_byteLength, 186 Builtins::Name call_byteLength,
186 BuiltinFunctionId byteLength_id, 187 BuiltinFunctionId byteLength_id,
187 Builtins::Name call_slice); 188 Builtins::Name call_slice);
188 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target, 189 Handle<JSFunction> InstallInternalArray(Handle<JSObject> target,
189 const char* name, 190 const char* name,
190 ElementsKind elements_kind); 191 ElementsKind elements_kind);
(...skipping 3664 matching lines...) Expand 10 before | Expand all | Expand 10 after
3855 Handle<JSObject> symbol = Handle<JSObject>::cast( 3856 Handle<JSObject> symbol = Handle<JSObject>::cast(
3856 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); 3857 JSObject::GetProperty(global, symbol_string).ToHandleChecked());
3857 Handle<String> name_string = factory->InternalizeUtf8String(name); 3858 Handle<String> name_string = factory->InternalizeUtf8String(name);
3858 PropertyAttributes attributes = 3859 PropertyAttributes attributes =
3859 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 3860 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
3860 JSObject::AddProperty(symbol, name_string, value, attributes); 3861 JSObject::AddProperty(symbol, name_string, value, attributes);
3861 } 3862 }
3862 3863
3863 void Genesis::InstallOneBuiltinFunction(Handle<Object> prototype, 3864 void Genesis::InstallOneBuiltinFunction(Handle<Object> prototype,
3864 const char* method_name, 3865 const char* method_name,
3865 Builtins::Name builtin_name) { 3866 Builtins::Name builtin_name,
3867 int internal_formal_parameter_count) {
3866 LookupIterator it( 3868 LookupIterator it(
3867 prototype, isolate()->factory()->NewStringFromAsciiChecked(method_name), 3869 prototype, isolate()->factory()->NewStringFromAsciiChecked(method_name),
3868 LookupIterator::OWN_SKIP_INTERCEPTOR); 3870 LookupIterator::OWN_SKIP_INTERCEPTOR);
3869 Handle<Object> function = Object::GetProperty(&it).ToHandleChecked(); 3871 Handle<Object> function = Object::GetProperty(&it).ToHandleChecked();
3870 Handle<JSFunction>::cast(function)->set_code( 3872 Handle<JSFunction>::cast(function)->set_code(
3871 isolate()->builtins()->builtin(builtin_name)); 3873 isolate()->builtins()->builtin(builtin_name));
3872 Handle<JSFunction>::cast(function)->shared()->set_code( 3874 SharedFunctionInfo* info = Handle<JSFunction>::cast(function)->shared();
3873 isolate()->builtins()->builtin(builtin_name)); 3875 info->set_code(isolate()->builtins()->builtin(builtin_name));
3876 info->set_internal_formal_parameter_count(internal_formal_parameter_count);
3874 } 3877 }
3875 3878
3876 void Genesis::InitializeGlobal_experimental_fast_array_builtins() { 3879 void Genesis::InitializeGlobal_experimental_fast_array_builtins() {
3877 if (!FLAG_experimental_fast_array_builtins) return; 3880 if (!FLAG_experimental_fast_array_builtins) return;
3878 { 3881 {
3879 Handle<Object> typed_array_prototype( 3882 Handle<Object> typed_array_prototype(
3880 native_context()->typed_array_prototype(), isolate()); 3883 native_context()->typed_array_prototype(), isolate());
3881 // Insert experimental fast TypedArray builtins here. 3884 // Insert experimental fast TypedArray builtins here.
3882 InstallOneBuiltinFunction(typed_array_prototype, "every", 3885 InstallOneBuiltinFunction(typed_array_prototype, "every",
3883 Builtins::kTypedArrayPrototypeEvery); 3886 Builtins::kTypedArrayPrototypeEvery,
3887 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
3884 InstallOneBuiltinFunction(typed_array_prototype, "some", 3888 InstallOneBuiltinFunction(typed_array_prototype, "some",
3885 Builtins::kTypedArrayPrototypeSome); 3889 Builtins::kTypedArrayPrototypeSome,
3890 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
3886 InstallOneBuiltinFunction(typed_array_prototype, "reduce", 3891 InstallOneBuiltinFunction(typed_array_prototype, "reduce",
3887 Builtins::kTypedArrayPrototypeReduce); 3892 Builtins::kTypedArrayPrototypeReduce,
3893 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
3888 InstallOneBuiltinFunction(typed_array_prototype, "reduceRight", 3894 InstallOneBuiltinFunction(typed_array_prototype, "reduceRight",
3889 Builtins::kTypedArrayPrototypeReduceRight); 3895 Builtins::kTypedArrayPrototypeReduceRight,
3896 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
3890 } 3897 }
3891 } 3898 }
3892 3899
3893 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { 3900 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() {
3894 if (!FLAG_harmony_sharedarraybuffer) return; 3901 if (!FLAG_harmony_sharedarraybuffer) return;
3895 3902
3896 Handle<JSGlobalObject> global(native_context()->global_object()); 3903 Handle<JSGlobalObject> global(native_context()->global_object());
3897 Isolate* isolate = global->GetIsolate(); 3904 Isolate* isolate = global->GetIsolate();
3898 Factory* factory = isolate->factory(); 3905 Factory* factory = isolate->factory();
3899 3906
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
4345 // Make sure that Array.prototype.concat appears to be compiled. 4352 // Make sure that Array.prototype.concat appears to be compiled.
4346 // The code will never be called, but inline caching for call will 4353 // The code will never be called, but inline caching for call will
4347 // only work if it appears to be compiled. 4354 // only work if it appears to be compiled.
4348 concat->shared()->DontAdaptArguments(); 4355 concat->shared()->DontAdaptArguments();
4349 DCHECK(concat->is_compiled()); 4356 DCHECK(concat->is_compiled());
4350 // Set the lengths for the functions to satisfy ECMA-262. 4357 // Set the lengths for the functions to satisfy ECMA-262.
4351 concat->shared()->set_length(1); 4358 concat->shared()->set_length(1);
4352 4359
4353 // Install Array.prototype.forEach 4360 // Install Array.prototype.forEach
4354 Handle<JSFunction> forEach = InstallArrayBuiltinFunction( 4361 Handle<JSFunction> forEach = InstallArrayBuiltinFunction(
4355 proto, "forEach", Builtins::kArrayForEach, 2); 4362 proto, "forEach", Builtins::kArrayForEach,
4363 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
4356 // Add forEach to the context. 4364 // Add forEach to the context.
4357 native_context()->set_array_for_each_iterator(*forEach); 4365 native_context()->set_array_for_each_iterator(*forEach);
4358 4366
4359 // Install Array.prototype.filter 4367 // Install Array.prototype.filter
4360 InstallArrayBuiltinFunction(proto, "filter", Builtins::kArrayFilter, 2); 4368 InstallArrayBuiltinFunction(
4369 proto, "filter", Builtins::kArrayFilter,
4370 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
4361 4371
4362 // Install Array.prototype.map 4372 // Install Array.prototype.map
4363 InstallArrayBuiltinFunction(proto, "map", Builtins::kArrayMap, 2); 4373 InstallArrayBuiltinFunction(
4374 proto, "map", Builtins::kArrayMap,
4375 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
4364 4376
4365 // Install Array.prototype.every 4377 // Install Array.prototype.every
4366 InstallArrayBuiltinFunction(proto, "every", Builtins::kArrayEvery, 2); 4378 InstallArrayBuiltinFunction(
4379 proto, "every", Builtins::kArrayEvery,
4380 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
4367 4381
4368 // Install Array.prototype.some 4382 // Install Array.prototype.some
4369 InstallArrayBuiltinFunction(proto, "some", Builtins::kArraySome, 2); 4383 InstallArrayBuiltinFunction(
4384 proto, "some", Builtins::kArraySome,
4385 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
4370 4386
4371 // Install Array.prototype.reduce 4387 // Install Array.prototype.reduce
4372 InstallArrayBuiltinFunction(proto, "reduce", Builtins::kArrayReduce, 2); 4388 InstallArrayBuiltinFunction(
4389 proto, "reduce", Builtins::kArrayReduce,
4390 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
4373 4391
4374 // Install Array.prototype.reduceRight 4392 // Install Array.prototype.reduceRight
4375 InstallArrayBuiltinFunction(proto, "reduceRight", 4393 InstallArrayBuiltinFunction(
4376 Builtins::kArrayReduceRight, 2); 4394 proto, "reduceRight", Builtins::kArrayReduceRight,
4395 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
4377 } 4396 }
4378 4397
4379 // Install InternalArray.prototype.concat 4398 // Install InternalArray.prototype.concat
4380 { 4399 {
4381 Handle<JSFunction> array_constructor( 4400 Handle<JSFunction> array_constructor(
4382 native_context()->internal_array_function()); 4401 native_context()->internal_array_function());
4383 Handle<JSObject> proto(JSObject::cast(array_constructor->prototype())); 4402 Handle<JSObject> proto(JSObject::cast(array_constructor->prototype()));
4384 Handle<JSFunction> concat = 4403 Handle<JSFunction> concat =
4385 InstallFunction(proto, "concat", JS_OBJECT_TYPE, JSObject::kHeaderSize, 4404 InstallFunction(proto, "concat", JS_OBJECT_TYPE, JSObject::kHeaderSize,
4386 MaybeHandle<JSObject>(), Builtins::kArrayConcat); 4405 MaybeHandle<JSObject>(), Builtins::kArrayConcat);
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
5271 } 5290 }
5272 5291
5273 5292
5274 // Called when the top-level V8 mutex is destroyed. 5293 // Called when the top-level V8 mutex is destroyed.
5275 void Bootstrapper::FreeThreadResources() { 5294 void Bootstrapper::FreeThreadResources() {
5276 DCHECK(!IsActive()); 5295 DCHECK(!IsActive());
5277 } 5296 }
5278 5297
5279 } // namespace internal 5298 } // namespace internal
5280 } // namespace v8 5299 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins-array-gen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698