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" |
11 #include "src/compiler.h" | 11 #include "src/compiler.h" |
12 #include "src/extensions/externalize-string-extension.h" | 12 #include "src/extensions/externalize-string-extension.h" |
13 #include "src/extensions/free-buffer-extension.h" | 13 #include "src/extensions/free-buffer-extension.h" |
14 #include "src/extensions/gc-extension.h" | 14 #include "src/extensions/gc-extension.h" |
15 #include "src/extensions/ignition-statistics-extension.h" | 15 #include "src/extensions/ignition-statistics-extension.h" |
16 #include "src/extensions/statistics-extension.h" | 16 #include "src/extensions/statistics-extension.h" |
17 #include "src/extensions/trigger-failure-extension.h" | 17 #include "src/extensions/trigger-failure-extension.h" |
18 #include "src/heap/heap.h" | 18 #include "src/heap/heap.h" |
19 #include "src/isolate-inl.h" | 19 #include "src/isolate-inl.h" |
20 #include "src/snapshot/natives.h" | 20 #include "src/snapshot/natives.h" |
21 #include "src/snapshot/snapshot.h" | 21 #include "src/snapshot/snapshot.h" |
22 #include "src/wasm/wasm-js.h" | 22 #include "src/wasm/wasm-js.h" |
23 | 23 |
| 24 #if V8_I18N_SUPPORT |
| 25 #include "src/i18n.h" |
| 26 #endif // V8_I18N_SUPPORT |
| 27 |
24 namespace v8 { | 28 namespace v8 { |
25 namespace internal { | 29 namespace internal { |
26 | 30 |
27 Bootstrapper::Bootstrapper(Isolate* isolate) | 31 Bootstrapper::Bootstrapper(Isolate* isolate) |
28 : isolate_(isolate), | 32 : isolate_(isolate), |
29 nesting_(0), | 33 nesting_(0), |
30 extensions_cache_(Script::TYPE_EXTENSION) {} | 34 extensions_cache_(Script::TYPE_EXTENSION) {} |
31 | 35 |
32 template <class Source> | 36 template <class Source> |
33 Handle<String> Bootstrapper::SourceLookup(int index) { | 37 Handle<String> Bootstrapper::SourceLookup(int index) { |
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2343 JSObject::AddProperty(global, name, intl, DONT_ENUM); | 2347 JSObject::AddProperty(global, name, intl, DONT_ENUM); |
2344 | 2348 |
2345 Handle<JSObject> date_time_format_prototype = | 2349 Handle<JSObject> date_time_format_prototype = |
2346 factory->NewJSObject(isolate->object_function(), TENURED); | 2350 factory->NewJSObject(isolate->object_function(), TENURED); |
2347 // Install the @@toStringTag property on the {prototype}. | 2351 // Install the @@toStringTag property on the {prototype}. |
2348 JSObject::AddProperty( | 2352 JSObject::AddProperty( |
2349 date_time_format_prototype, factory->to_string_tag_symbol(), | 2353 date_time_format_prototype, factory->to_string_tag_symbol(), |
2350 factory->Object_string(), | 2354 factory->Object_string(), |
2351 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 2355 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
2352 Handle<JSFunction> date_time_format_constructor = InstallFunction( | 2356 Handle<JSFunction> date_time_format_constructor = InstallFunction( |
2353 intl, "DateTimeFormat", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2357 intl, "DateTimeFormat", JS_OBJECT_TYPE, DateFormat::kSize, |
2354 date_time_format_prototype, Builtins::kIllegal); | 2358 date_time_format_prototype, Builtins::kIllegal); |
2355 JSObject::AddProperty(date_time_format_prototype, | 2359 JSObject::AddProperty(date_time_format_prototype, |
2356 factory->constructor_string(), | 2360 factory->constructor_string(), |
2357 date_time_format_constructor, DONT_ENUM); | 2361 date_time_format_constructor, DONT_ENUM); |
| 2362 InstallWithIntrinsicDefaultProto( |
| 2363 isolate, date_time_format_constructor, |
| 2364 Context::INTL_DATE_TIME_FORMAT_FUNCTION_INDEX); |
2358 | 2365 |
2359 Handle<JSObject> number_format_prototype = | 2366 Handle<JSObject> number_format_prototype = |
2360 factory->NewJSObject(isolate->object_function(), TENURED); | 2367 factory->NewJSObject(isolate->object_function(), TENURED); |
2361 // Install the @@toStringTag property on the {prototype}. | 2368 // Install the @@toStringTag property on the {prototype}. |
2362 JSObject::AddProperty( | 2369 JSObject::AddProperty( |
2363 number_format_prototype, factory->to_string_tag_symbol(), | 2370 number_format_prototype, factory->to_string_tag_symbol(), |
2364 factory->Object_string(), | 2371 factory->Object_string(), |
2365 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 2372 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
2366 Handle<JSFunction> number_format_constructor = InstallFunction( | 2373 Handle<JSFunction> number_format_constructor = InstallFunction( |
2367 intl, "NumberFormat", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2374 intl, "NumberFormat", JS_OBJECT_TYPE, NumberFormat::kSize, |
2368 number_format_prototype, Builtins::kIllegal); | 2375 number_format_prototype, Builtins::kIllegal); |
2369 JSObject::AddProperty(number_format_prototype, | 2376 JSObject::AddProperty(number_format_prototype, |
2370 factory->constructor_string(), | 2377 factory->constructor_string(), |
2371 number_format_constructor, DONT_ENUM); | 2378 number_format_constructor, DONT_ENUM); |
| 2379 InstallWithIntrinsicDefaultProto( |
| 2380 isolate, number_format_constructor, |
| 2381 Context::INTL_NUMBER_FORMAT_FUNCTION_INDEX); |
2372 | 2382 |
2373 Handle<JSObject> collator_prototype = | 2383 Handle<JSObject> collator_prototype = |
2374 factory->NewJSObject(isolate->object_function(), TENURED); | 2384 factory->NewJSObject(isolate->object_function(), TENURED); |
2375 // Install the @@toStringTag property on the {prototype}. | 2385 // Install the @@toStringTag property on the {prototype}. |
2376 JSObject::AddProperty( | 2386 JSObject::AddProperty( |
2377 collator_prototype, factory->to_string_tag_symbol(), | 2387 collator_prototype, factory->to_string_tag_symbol(), |
2378 factory->Object_string(), | 2388 factory->Object_string(), |
2379 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 2389 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
2380 Handle<JSFunction> collator_constructor = | 2390 Handle<JSFunction> collator_constructor = |
2381 InstallFunction(intl, "Collator", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2391 InstallFunction(intl, "Collator", JS_OBJECT_TYPE, Collator::kSize, |
2382 collator_prototype, Builtins::kIllegal); | 2392 collator_prototype, Builtins::kIllegal); |
2383 JSObject::AddProperty(collator_prototype, factory->constructor_string(), | 2393 JSObject::AddProperty(collator_prototype, factory->constructor_string(), |
2384 collator_constructor, DONT_ENUM); | 2394 collator_constructor, DONT_ENUM); |
| 2395 InstallWithIntrinsicDefaultProto(isolate, collator_constructor, |
| 2396 Context::INTL_COLLATOR_FUNCTION_INDEX); |
2385 | 2397 |
2386 Handle<JSObject> v8_break_iterator_prototype = | 2398 Handle<JSObject> v8_break_iterator_prototype = |
2387 factory->NewJSObject(isolate->object_function(), TENURED); | 2399 factory->NewJSObject(isolate->object_function(), TENURED); |
2388 // Install the @@toStringTag property on the {prototype}. | 2400 // Install the @@toStringTag property on the {prototype}. |
2389 JSObject::AddProperty( | 2401 JSObject::AddProperty( |
2390 v8_break_iterator_prototype, factory->to_string_tag_symbol(), | 2402 v8_break_iterator_prototype, factory->to_string_tag_symbol(), |
2391 factory->Object_string(), | 2403 factory->Object_string(), |
2392 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 2404 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
2393 Handle<JSFunction> v8_break_iterator_constructor = InstallFunction( | 2405 Handle<JSFunction> v8_break_iterator_constructor = InstallFunction( |
2394 intl, "v8BreakIterator", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 2406 intl, "v8BreakIterator", JS_OBJECT_TYPE, V8BreakIterator::kSize, |
2395 v8_break_iterator_prototype, Builtins::kIllegal); | 2407 v8_break_iterator_prototype, Builtins::kIllegal); |
2396 JSObject::AddProperty(v8_break_iterator_prototype, | 2408 JSObject::AddProperty(v8_break_iterator_prototype, |
2397 factory->constructor_string(), | 2409 factory->constructor_string(), |
2398 v8_break_iterator_constructor, DONT_ENUM); | 2410 v8_break_iterator_constructor, DONT_ENUM); |
| 2411 InstallWithIntrinsicDefaultProto( |
| 2412 isolate, v8_break_iterator_constructor, |
| 2413 Context::INTL_V8_BREAK_ITERATOR_FUNCTION_INDEX); |
2399 } | 2414 } |
2400 #endif // V8_I18N_SUPPORT | 2415 #endif // V8_I18N_SUPPORT |
2401 | 2416 |
2402 { // -- A r r a y B u f f e r | 2417 { // -- A r r a y B u f f e r |
2403 Handle<JSFunction> array_buffer_fun = InstallArrayBuffer( | 2418 Handle<JSFunction> array_buffer_fun = InstallArrayBuffer( |
2404 global, "ArrayBuffer", Builtins::kArrayBufferPrototypeGetByteLength, | 2419 global, "ArrayBuffer", Builtins::kArrayBufferPrototypeGetByteLength, |
2405 BuiltinFunctionId::kArrayBufferByteLength); | 2420 BuiltinFunctionId::kArrayBufferByteLength); |
2406 InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun, | 2421 InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun, |
2407 Context::ARRAY_BUFFER_FUN_INDEX); | 2422 Context::ARRAY_BUFFER_FUN_INDEX); |
2408 InstallSpeciesGetter(array_buffer_fun); | 2423 InstallSpeciesGetter(array_buffer_fun); |
(...skipping 2331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4740 } | 4755 } |
4741 | 4756 |
4742 | 4757 |
4743 // Called when the top-level V8 mutex is destroyed. | 4758 // Called when the top-level V8 mutex is destroyed. |
4744 void Bootstrapper::FreeThreadResources() { | 4759 void Bootstrapper::FreeThreadResources() { |
4745 DCHECK(!IsActive()); | 4760 DCHECK(!IsActive()); |
4746 } | 4761 } |
4747 | 4762 |
4748 } // namespace internal | 4763 } // namespace internal |
4749 } // namespace v8 | 4764 } // namespace v8 |
OLD | NEW |