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/utils/random-number-generator.h" | 9 #include "src/base/utils/random-number-generator.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2324 Builtins::kDateToPrimitive, | 2324 Builtins::kDateToPrimitive, |
2325 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 2325 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
2326 | 2326 |
2327 // Set the expected parameters for @@toPrimitive to 1; required by builtin. | 2327 // Set the expected parameters for @@toPrimitive to 1; required by builtin. |
2328 to_primitive->shared()->set_internal_formal_parameter_count(1); | 2328 to_primitive->shared()->set_internal_formal_parameter_count(1); |
2329 | 2329 |
2330 // Set the length for the function to satisfy ECMA-262. | 2330 // Set the length for the function to satisfy ECMA-262. |
2331 to_primitive->shared()->set_length(1); | 2331 to_primitive->shared()->set_length(1); |
2332 } | 2332 } |
2333 | 2333 |
| 2334 // Install Array.prototype.concat |
| 2335 { |
| 2336 Handle<JSFunction> array_constructor(native_context()->array_function()); |
| 2337 Handle<JSObject> proto(JSObject::cast(array_constructor->prototype())); |
| 2338 Handle<JSFunction> concat = |
| 2339 InstallFunction(proto, "concat", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 2340 MaybeHandle<JSObject>(), Builtins::kArrayConcat); |
| 2341 |
| 2342 // Make sure that Array.prototype.concat appears to be compiled. |
| 2343 // The code will never be called, but inline caching for call will |
| 2344 // only work if it appears to be compiled. |
| 2345 concat->shared()->DontAdaptArguments(); |
| 2346 DCHECK(concat->is_compiled()); |
| 2347 // Set the lengths for the functions to satisfy ECMA-262. |
| 2348 concat->shared()->set_length(1); |
| 2349 } |
| 2350 |
| 2351 // Install InternalArray.prototype.concat |
| 2352 { |
| 2353 Handle<JSFunction> array_constructor( |
| 2354 native_context()->internal_array_function()); |
| 2355 Handle<JSObject> proto(JSObject::cast(array_constructor->prototype())); |
| 2356 Handle<JSFunction> concat = |
| 2357 InstallFunction(proto, "concat", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 2358 MaybeHandle<JSObject>(), Builtins::kArrayConcat); |
| 2359 |
| 2360 // Make sure that InternalArray.prototype.concat appears to be compiled. |
| 2361 // The code will never be called, but inline caching for call will |
| 2362 // only work if it appears to be compiled. |
| 2363 concat->shared()->DontAdaptArguments(); |
| 2364 DCHECK(concat->is_compiled()); |
| 2365 // Set the lengths for the functions to satisfy ECMA-262. |
| 2366 concat->shared()->set_length(1); |
| 2367 } |
2334 // Install Function.prototype.call and apply. | 2368 // Install Function.prototype.call and apply. |
2335 { | 2369 { |
2336 Handle<String> key = factory()->Function_string(); | 2370 Handle<String> key = factory()->Function_string(); |
2337 Handle<JSFunction> function = | 2371 Handle<JSFunction> function = |
2338 Handle<JSFunction>::cast(Object::GetProperty( | 2372 Handle<JSFunction>::cast(Object::GetProperty( |
2339 handle(native_context()->global_object()), key).ToHandleChecked()); | 2373 handle(native_context()->global_object()), key).ToHandleChecked()); |
2340 Handle<JSObject> proto = | 2374 Handle<JSObject> proto = |
2341 Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 2375 Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
2342 | 2376 |
2343 // Install the call and the apply functions. | 2377 // Install the call and the apply functions. |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3191 } | 3225 } |
3192 | 3226 |
3193 | 3227 |
3194 // Called when the top-level V8 mutex is destroyed. | 3228 // Called when the top-level V8 mutex is destroyed. |
3195 void Bootstrapper::FreeThreadResources() { | 3229 void Bootstrapper::FreeThreadResources() { |
3196 DCHECK(!IsActive()); | 3230 DCHECK(!IsActive()); |
3197 } | 3231 } |
3198 | 3232 |
3199 } // namespace internal | 3233 } // namespace internal |
3200 } // namespace v8 | 3234 } // namespace v8 |
OLD | NEW |