Chromium Code Reviews| 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 4325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4336 // Make sure that Array.prototype.concat appears to be compiled. | 4336 // Make sure that Array.prototype.concat appears to be compiled. |
| 4337 // The code will never be called, but inline caching for call will | 4337 // The code will never be called, but inline caching for call will |
| 4338 // only work if it appears to be compiled. | 4338 // only work if it appears to be compiled. |
| 4339 concat->shared()->DontAdaptArguments(); | 4339 concat->shared()->DontAdaptArguments(); |
| 4340 DCHECK(concat->is_compiled()); | 4340 DCHECK(concat->is_compiled()); |
| 4341 // Set the lengths for the functions to satisfy ECMA-262. | 4341 // Set the lengths for the functions to satisfy ECMA-262. |
| 4342 concat->shared()->set_length(1); | 4342 concat->shared()->set_length(1); |
| 4343 | 4343 |
| 4344 // Install Array.prototype.forEach | 4344 // Install Array.prototype.forEach |
| 4345 Handle<JSFunction> forEach = InstallArrayBuiltinFunction( | 4345 Handle<JSFunction> forEach = InstallArrayBuiltinFunction( |
| 4346 proto, "forEach", Builtins::kArrayForEach, 2); | 4346 proto, "forEach", Builtins::kArrayForEach, |
| 4347 SharedFunctionInfo::kDontAdaptArgumentsSentinel); | |
|
Igor Sheludko
2017/04/27 10:38:05
Idea for further improvement: it would be nice to
danno
2017/04/28 06:58:10
As discussed, I'll do this in a later CL.
| |
| 4347 // Add forEach to the context. | 4348 // Add forEach to the context. |
| 4348 native_context()->set_array_for_each_iterator(*forEach); | 4349 native_context()->set_array_for_each_iterator(*forEach); |
| 4349 | 4350 |
| 4350 // Install Array.prototype.filter | 4351 // Install Array.prototype.filter |
| 4351 InstallArrayBuiltinFunction(proto, "filter", Builtins::kArrayFilter, 2); | 4352 InstallArrayBuiltinFunction( |
| 4353 proto, "filter", Builtins::kArrayFilter, | |
| 4354 SharedFunctionInfo::kDontAdaptArgumentsSentinel); | |
| 4352 | 4355 |
| 4353 // Install Array.prototype.map | 4356 // Install Array.prototype.map |
| 4354 InstallArrayBuiltinFunction(proto, "map", Builtins::kArrayMap, 2); | 4357 InstallArrayBuiltinFunction( |
| 4358 proto, "map", Builtins::kArrayMap, | |
| 4359 SharedFunctionInfo::kDontAdaptArgumentsSentinel); | |
| 4355 | 4360 |
| 4356 // Install Array.prototype.every | 4361 // Install Array.prototype.every |
| 4357 InstallArrayBuiltinFunction(proto, "every", Builtins::kArrayEvery, 2); | 4362 InstallArrayBuiltinFunction( |
| 4363 proto, "every", Builtins::kArrayEvery, | |
| 4364 SharedFunctionInfo::kDontAdaptArgumentsSentinel); | |
| 4358 | 4365 |
| 4359 // Install Array.prototype.some | 4366 // Install Array.prototype.some |
| 4360 InstallArrayBuiltinFunction(proto, "some", Builtins::kArraySome, 2); | 4367 InstallArrayBuiltinFunction( |
| 4368 proto, "some", Builtins::kArraySome, | |
| 4369 SharedFunctionInfo::kDontAdaptArgumentsSentinel); | |
| 4361 | 4370 |
| 4362 // Install Array.prototype.reduce | 4371 // Install Array.prototype.reduce |
| 4363 InstallArrayBuiltinFunction(proto, "reduce", Builtins::kArrayReduce, 2); | 4372 InstallArrayBuiltinFunction( |
| 4373 proto, "reduce", Builtins::kArrayReduce, | |
| 4374 SharedFunctionInfo::kDontAdaptArgumentsSentinel); | |
| 4364 | 4375 |
| 4365 // Install Array.prototype.reduceRight | 4376 // Install Array.prototype.reduceRight |
| 4366 InstallArrayBuiltinFunction(proto, "reduceRight", | 4377 InstallArrayBuiltinFunction( |
| 4367 Builtins::kArrayReduceRight, 2); | 4378 proto, "reduceRight", Builtins::kArrayReduceRight, |
| 4379 SharedFunctionInfo::kDontAdaptArgumentsSentinel); | |
| 4368 } | 4380 } |
| 4369 | 4381 |
| 4370 // Install InternalArray.prototype.concat | 4382 // Install InternalArray.prototype.concat |
| 4371 { | 4383 { |
| 4372 Handle<JSFunction> array_constructor( | 4384 Handle<JSFunction> array_constructor( |
| 4373 native_context()->internal_array_function()); | 4385 native_context()->internal_array_function()); |
| 4374 Handle<JSObject> proto(JSObject::cast(array_constructor->prototype())); | 4386 Handle<JSObject> proto(JSObject::cast(array_constructor->prototype())); |
| 4375 Handle<JSFunction> concat = | 4387 Handle<JSFunction> concat = |
| 4376 InstallFunction(proto, "concat", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 4388 InstallFunction(proto, "concat", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 4377 MaybeHandle<JSObject>(), Builtins::kArrayConcat); | 4389 MaybeHandle<JSObject>(), Builtins::kArrayConcat); |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5264 } | 5276 } |
| 5265 | 5277 |
| 5266 | 5278 |
| 5267 // Called when the top-level V8 mutex is destroyed. | 5279 // Called when the top-level V8 mutex is destroyed. |
| 5268 void Bootstrapper::FreeThreadResources() { | 5280 void Bootstrapper::FreeThreadResources() { |
| 5269 DCHECK(!IsActive()); | 5281 DCHECK(!IsActive()); |
| 5270 } | 5282 } |
| 5271 | 5283 |
| 5272 } // namespace internal | 5284 } // namespace internal |
| 5273 } // namespace v8 | 5285 } // namespace v8 |
| OLD | NEW |