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