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 3846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3857 Handle<Object> function = Object::GetProperty(&it).ToHandleChecked(); | 3857 Handle<Object> function = Object::GetProperty(&it).ToHandleChecked(); |
3858 Handle<JSFunction>::cast(function)->set_code( | 3858 Handle<JSFunction>::cast(function)->set_code( |
3859 isolate()->builtins()->builtin(builtin_name)); | 3859 isolate()->builtins()->builtin(builtin_name)); |
3860 Handle<JSFunction>::cast(function)->shared()->set_code( | 3860 Handle<JSFunction>::cast(function)->shared()->set_code( |
3861 isolate()->builtins()->builtin(builtin_name)); | 3861 isolate()->builtins()->builtin(builtin_name)); |
3862 } | 3862 } |
3863 | 3863 |
3864 void Genesis::InitializeGlobal_experimental_fast_array_builtins() { | 3864 void Genesis::InitializeGlobal_experimental_fast_array_builtins() { |
3865 if (!FLAG_experimental_fast_array_builtins) return; | 3865 if (!FLAG_experimental_fast_array_builtins) return; |
3866 { | 3866 { |
3867 Handle<JSFunction> array_constructor(native_context()->array_function()); | |
3868 Handle<Object> array_prototype(array_constructor->prototype(), isolate()); | |
3869 // Insert experimental fast Array builtins here. | |
3870 InstallOneBuiltinFunction(array_prototype, "filter", | |
3871 Builtins::kArrayFilter); | |
3872 InstallOneBuiltinFunction(array_prototype, "map", Builtins::kArrayMap); | |
3873 } | |
3874 { | |
3875 Handle<Object> typed_array_prototype( | 3867 Handle<Object> typed_array_prototype( |
3876 native_context()->typed_array_prototype(), isolate()); | 3868 native_context()->typed_array_prototype(), isolate()); |
3877 // Insert experimental fast TypedArray builtins here. | 3869 // Insert experimental fast TypedArray builtins here. |
3878 InstallOneBuiltinFunction(typed_array_prototype, "every", | 3870 InstallOneBuiltinFunction(typed_array_prototype, "every", |
3879 Builtins::kTypedArrayPrototypeEvery); | 3871 Builtins::kTypedArrayPrototypeEvery); |
3880 InstallOneBuiltinFunction(typed_array_prototype, "some", | 3872 InstallOneBuiltinFunction(typed_array_prototype, "some", |
3881 Builtins::kTypedArrayPrototypeSome); | 3873 Builtins::kTypedArrayPrototypeSome); |
3882 } | 3874 } |
3883 } | 3875 } |
3884 | 3876 |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4363 DCHECK(concat->is_compiled()); | 4355 DCHECK(concat->is_compiled()); |
4364 // Set the lengths for the functions to satisfy ECMA-262. | 4356 // Set the lengths for the functions to satisfy ECMA-262. |
4365 concat->shared()->set_length(1); | 4357 concat->shared()->set_length(1); |
4366 | 4358 |
4367 // Install Array.prototype.forEach | 4359 // Install Array.prototype.forEach |
4368 Handle<JSFunction> forEach = InstallArrayBuiltinFunction( | 4360 Handle<JSFunction> forEach = InstallArrayBuiltinFunction( |
4369 proto, "forEach", Builtins::kArrayForEach, 2); | 4361 proto, "forEach", Builtins::kArrayForEach, 2); |
4370 // Add forEach to the context. | 4362 // Add forEach to the context. |
4371 native_context()->set_array_for_each_iterator(*forEach); | 4363 native_context()->set_array_for_each_iterator(*forEach); |
4372 | 4364 |
| 4365 // Install Array.prototype.filter |
| 4366 InstallArrayBuiltinFunction(proto, "filter", Builtins::kArrayFilter, 2); |
| 4367 |
| 4368 // Install Array.prototype.map |
| 4369 InstallArrayBuiltinFunction(proto, "map", Builtins::kArrayMap, 2); |
| 4370 |
4373 // Install Array.prototype.every | 4371 // Install Array.prototype.every |
4374 InstallArrayBuiltinFunction(proto, "every", Builtins::kArrayEvery, 2); | 4372 InstallArrayBuiltinFunction(proto, "every", Builtins::kArrayEvery, 2); |
4375 | 4373 |
4376 // Install Array.prototype.some | 4374 // Install Array.prototype.some |
4377 InstallArrayBuiltinFunction(proto, "some", Builtins::kArraySome, 2); | 4375 InstallArrayBuiltinFunction(proto, "some", Builtins::kArraySome, 2); |
4378 | 4376 |
4379 // Install Array.prototype.reduce | 4377 // Install Array.prototype.reduce |
4380 InstallArrayBuiltinFunction(proto, "reduce", Builtins::kArrayReduce, 2); | 4378 InstallArrayBuiltinFunction(proto, "reduce", Builtins::kArrayReduce, 2); |
4381 | 4379 |
4382 // Install Array.prototype.reduceRight | 4380 // Install Array.prototype.reduceRight |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5281 } | 5279 } |
5282 | 5280 |
5283 | 5281 |
5284 // Called when the top-level V8 mutex is destroyed. | 5282 // Called when the top-level V8 mutex is destroyed. |
5285 void Bootstrapper::FreeThreadResources() { | 5283 void Bootstrapper::FreeThreadResources() { |
5286 DCHECK(!IsActive()); | 5284 DCHECK(!IsActive()); |
5287 } | 5285 } |
5288 | 5286 |
5289 } // namespace internal | 5287 } // namespace internal |
5290 } // namespace v8 | 5288 } // namespace v8 |
OLD | NEW |