| 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/ieee754.h" | 9 #include "src/base/ieee754.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 3842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3853 Handle<Object> function = Object::GetProperty(&it).ToHandleChecked(); | 3853 Handle<Object> function = Object::GetProperty(&it).ToHandleChecked(); |
| 3854 Handle<JSFunction>::cast(function)->set_code( | 3854 Handle<JSFunction>::cast(function)->set_code( |
| 3855 isolate()->builtins()->builtin(builtin_name)); | 3855 isolate()->builtins()->builtin(builtin_name)); |
| 3856 Handle<JSFunction>::cast(function)->shared()->set_code( | 3856 Handle<JSFunction>::cast(function)->shared()->set_code( |
| 3857 isolate()->builtins()->builtin(builtin_name)); | 3857 isolate()->builtins()->builtin(builtin_name)); |
| 3858 } | 3858 } |
| 3859 | 3859 |
| 3860 void Genesis::InitializeGlobal_experimental_fast_array_builtins() { | 3860 void Genesis::InitializeGlobal_experimental_fast_array_builtins() { |
| 3861 if (!FLAG_experimental_fast_array_builtins) return; | 3861 if (!FLAG_experimental_fast_array_builtins) return; |
| 3862 { | 3862 { |
| 3863 Handle<JSFunction> array_constructor(native_context()->array_function()); | |
| 3864 Handle<Object> array_prototype(array_constructor->prototype(), isolate()); | |
| 3865 // Insert experimental fast Array builtins here. | |
| 3866 InstallOneBuiltinFunction(array_prototype, "filter", | |
| 3867 Builtins::kArrayFilter); | |
| 3868 InstallOneBuiltinFunction(array_prototype, "map", Builtins::kArrayMap); | |
| 3869 } | |
| 3870 { | |
| 3871 Handle<Object> typed_array_prototype( | 3863 Handle<Object> typed_array_prototype( |
| 3872 native_context()->typed_array_prototype(), isolate()); | 3864 native_context()->typed_array_prototype(), isolate()); |
| 3873 // Insert experimental fast TypedArray builtins here. | 3865 // Insert experimental fast TypedArray builtins here. |
| 3874 InstallOneBuiltinFunction(typed_array_prototype, "every", | 3866 InstallOneBuiltinFunction(typed_array_prototype, "every", |
| 3875 Builtins::kTypedArrayPrototypeEvery); | 3867 Builtins::kTypedArrayPrototypeEvery); |
| 3876 InstallOneBuiltinFunction(typed_array_prototype, "some", | 3868 InstallOneBuiltinFunction(typed_array_prototype, "some", |
| 3877 Builtins::kTypedArrayPrototypeSome); | 3869 Builtins::kTypedArrayPrototypeSome); |
| 3878 InstallOneBuiltinFunction(typed_array_prototype, "reduce", | 3870 InstallOneBuiltinFunction(typed_array_prototype, "reduce", |
| 3879 Builtins::kTypedArrayPrototypeReduce); | 3871 Builtins::kTypedArrayPrototypeReduce); |
| 3880 InstallOneBuiltinFunction(typed_array_prototype, "reduceRight", | 3872 InstallOneBuiltinFunction(typed_array_prototype, "reduceRight", |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4348 DCHECK(concat->is_compiled()); | 4340 DCHECK(concat->is_compiled()); |
| 4349 // Set the lengths for the functions to satisfy ECMA-262. | 4341 // Set the lengths for the functions to satisfy ECMA-262. |
| 4350 concat->shared()->set_length(1); | 4342 concat->shared()->set_length(1); |
| 4351 | 4343 |
| 4352 // Install Array.prototype.forEach | 4344 // Install Array.prototype.forEach |
| 4353 Handle<JSFunction> forEach = InstallArrayBuiltinFunction( | 4345 Handle<JSFunction> forEach = InstallArrayBuiltinFunction( |
| 4354 proto, "forEach", Builtins::kArrayForEach, 2); | 4346 proto, "forEach", Builtins::kArrayForEach, 2); |
| 4355 // Add forEach to the context. | 4347 // Add forEach to the context. |
| 4356 native_context()->set_array_for_each_iterator(*forEach); | 4348 native_context()->set_array_for_each_iterator(*forEach); |
| 4357 | 4349 |
| 4350 // Install Array.prototype.filter |
| 4351 InstallArrayBuiltinFunction(proto, "filter", Builtins::kArrayFilter, 2); |
| 4352 |
| 4353 // Install Array.prototype.map |
| 4354 InstallArrayBuiltinFunction(proto, "map", Builtins::kArrayMap, 2); |
| 4355 |
| 4358 // Install Array.prototype.every | 4356 // Install Array.prototype.every |
| 4359 InstallArrayBuiltinFunction(proto, "every", Builtins::kArrayEvery, 2); | 4357 InstallArrayBuiltinFunction(proto, "every", Builtins::kArrayEvery, 2); |
| 4360 | 4358 |
| 4361 // Install Array.prototype.some | 4359 // Install Array.prototype.some |
| 4362 InstallArrayBuiltinFunction(proto, "some", Builtins::kArraySome, 2); | 4360 InstallArrayBuiltinFunction(proto, "some", Builtins::kArraySome, 2); |
| 4363 | 4361 |
| 4364 // Install Array.prototype.reduce | 4362 // Install Array.prototype.reduce |
| 4365 InstallArrayBuiltinFunction(proto, "reduce", Builtins::kArrayReduce, 2); | 4363 InstallArrayBuiltinFunction(proto, "reduce", Builtins::kArrayReduce, 2); |
| 4366 | 4364 |
| 4367 // Install Array.prototype.reduceRight | 4365 // Install Array.prototype.reduceRight |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5266 } | 5264 } |
| 5267 | 5265 |
| 5268 | 5266 |
| 5269 // Called when the top-level V8 mutex is destroyed. | 5267 // Called when the top-level V8 mutex is destroyed. |
| 5270 void Bootstrapper::FreeThreadResources() { | 5268 void Bootstrapper::FreeThreadResources() { |
| 5271 DCHECK(!IsActive()); | 5269 DCHECK(!IsActive()); |
| 5272 } | 5270 } |
| 5273 | 5271 |
| 5274 } // namespace internal | 5272 } // namespace internal |
| 5275 } // namespace v8 | 5273 } // namespace v8 |
| OLD | NEW |