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