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 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2423 SimpleInstallFunction(reflect, factory->ownKeys_string(), | 2423 SimpleInstallFunction(reflect, factory->ownKeys_string(), |
2424 Builtins::kReflectOwnKeys, 1, true); | 2424 Builtins::kReflectOwnKeys, 1, true); |
2425 SimpleInstallFunction(reflect, factory->preventExtensions_string(), | 2425 SimpleInstallFunction(reflect, factory->preventExtensions_string(), |
2426 Builtins::kReflectPreventExtensions, 1, true); | 2426 Builtins::kReflectPreventExtensions, 1, true); |
2427 SimpleInstallFunction(reflect, factory->set_string(), Builtins::kReflectSet, | 2427 SimpleInstallFunction(reflect, factory->set_string(), Builtins::kReflectSet, |
2428 3, false); | 2428 3, false); |
2429 SimpleInstallFunction(reflect, factory->setPrototypeOf_string(), | 2429 SimpleInstallFunction(reflect, factory->setPrototypeOf_string(), |
2430 Builtins::kReflectSetPrototypeOf, 2, true); | 2430 Builtins::kReflectSetPrototypeOf, 2, true); |
2431 } | 2431 } |
2432 | 2432 |
2433 { // --- S P R E A D | |
2434 Handle<JSObject> spread = | |
2435 factory->NewJSObject(isolate->object_function(), TENURED); | |
2436 | |
2437 Handle<JSFunction> apply_prepare = SimpleInstallFunction( | |
2438 spread, factory->NewStringFromAsciiChecked("SpreadIterablePrepare"), | |
2439 Builtins::kSpreadIterablePrepare, 1, false); | |
Yang
2016/11/08 14:08:41
Why do we need this? I think what you want is to c
petermarshall
2016/11/10 12:19:20
Yep I've moved it to a runtime function
| |
2440 native_context()->set_spread_iterable_prepare(*apply_prepare); | |
2441 } | |
2442 | |
2433 { // --- B o u n d F u n c t i o n | 2443 { // --- B o u n d F u n c t i o n |
2434 Handle<Map> map = | 2444 Handle<Map> map = |
2435 factory->NewMap(JS_BOUND_FUNCTION_TYPE, JSBoundFunction::kSize); | 2445 factory->NewMap(JS_BOUND_FUNCTION_TYPE, JSBoundFunction::kSize); |
2436 map->set_is_callable(); | 2446 map->set_is_callable(); |
2437 Map::SetPrototype(map, empty_function); | 2447 Map::SetPrototype(map, empty_function); |
2438 | 2448 |
2439 PropertyAttributes roc_attribs = | 2449 PropertyAttributes roc_attribs = |
2440 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); | 2450 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); |
2441 Map::EnsureDescriptorSlack(map, 2); | 2451 Map::EnsureDescriptorSlack(map, 2); |
2442 | 2452 |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3472 InstallInternalArray(utils, "InternalArray", FAST_HOLEY_ELEMENTS); | 3482 InstallInternalArray(utils, "InternalArray", FAST_HOLEY_ELEMENTS); |
3473 native_context()->set_internal_array_function(*array_function); | 3483 native_context()->set_internal_array_function(*array_function); |
3474 InstallInternalArray(utils, "InternalPackedArray", FAST_ELEMENTS); | 3484 InstallInternalArray(utils, "InternalPackedArray", FAST_ELEMENTS); |
3475 } | 3485 } |
3476 | 3486 |
3477 // Run the rest of the native scripts. | 3487 // Run the rest of the native scripts. |
3478 while (builtin_index < Natives::GetBuiltinsCount()) { | 3488 while (builtin_index < Natives::GetBuiltinsCount()) { |
3479 if (!Bootstrapper::CompileBuiltin(isolate(), builtin_index++)) return false; | 3489 if (!Bootstrapper::CompileBuiltin(isolate(), builtin_index++)) return false; |
3480 } | 3490 } |
3481 | 3491 |
3492 // Store the initial array iterator on the native context. | |
3493 { | |
3494 Handle<JSFunction> array_constructor(native_context()->array_function()); | |
3495 Handle<JSObject> array_prototype( | |
3496 JSObject::cast(array_constructor->instance_prototype())); | |
3497 | |
3498 Handle<Object> iterator_func = | |
3499 Object::GetProperty(array_prototype, factory()->iterator_symbol()) | |
3500 .ToHandleChecked(); | |
3501 DCHECK(iterator_func->IsJSFunction()); | |
3502 native_context()->set_initial_array_iterator( | |
Yang
2016/11/08 14:08:41
Isn't this the same thing as native_context()->arr
petermarshall
2016/11/10 12:19:20
Removed this anyway - no longer needed
| |
3503 JSObject::cast(*iterator_func)); | |
3504 } | |
3505 | |
3482 if (!CallUtilsFunction(isolate(), "PostNatives")) return false; | 3506 if (!CallUtilsFunction(isolate(), "PostNatives")) return false; |
3483 auto fast_template_instantiations_cache = isolate()->factory()->NewFixedArray( | 3507 auto fast_template_instantiations_cache = isolate()->factory()->NewFixedArray( |
3484 TemplateInfo::kFastTemplateInstantiationsCacheSize); | 3508 TemplateInfo::kFastTemplateInstantiationsCacheSize); |
3485 native_context()->set_fast_template_instantiations_cache( | 3509 native_context()->set_fast_template_instantiations_cache( |
3486 *fast_template_instantiations_cache); | 3510 *fast_template_instantiations_cache); |
3487 | 3511 |
3488 auto slow_template_instantiations_cache = UnseededNumberDictionary::New( | 3512 auto slow_template_instantiations_cache = UnseededNumberDictionary::New( |
3489 isolate(), ApiNatives::kInitialFunctionCacheSize); | 3513 isolate(), ApiNatives::kInitialFunctionCacheSize); |
3490 native_context()->set_slow_template_instantiations_cache( | 3514 native_context()->set_slow_template_instantiations_cache( |
3491 *slow_template_instantiations_cache); | 3515 *slow_template_instantiations_cache); |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4543 } | 4567 } |
4544 | 4568 |
4545 | 4569 |
4546 // Called when the top-level V8 mutex is destroyed. | 4570 // Called when the top-level V8 mutex is destroyed. |
4547 void Bootstrapper::FreeThreadResources() { | 4571 void Bootstrapper::FreeThreadResources() { |
4548 DCHECK(!IsActive()); | 4572 DCHECK(!IsActive()); |
4549 } | 4573 } |
4550 | 4574 |
4551 } // namespace internal | 4575 } // namespace internal |
4552 } // namespace v8 | 4576 } // namespace v8 |
OLD | NEW |