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 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2578 InstallConstant(isolate, math, "PI", factory->NewNumber(kPI)); | 2578 InstallConstant(isolate, math, "PI", factory->NewNumber(kPI)); |
2579 InstallConstant(isolate, math, "SQRT1_2", | 2579 InstallConstant(isolate, math, "SQRT1_2", |
2580 factory->NewNumber(std::sqrt(0.5))); | 2580 factory->NewNumber(std::sqrt(0.5))); |
2581 InstallConstant(isolate, math, "SQRT2", factory->NewNumber(std::sqrt(2.0))); | 2581 InstallConstant(isolate, math, "SQRT2", factory->NewNumber(std::sqrt(2.0))); |
2582 JSObject::AddProperty( | 2582 JSObject::AddProperty( |
2583 math, factory->to_string_tag_symbol(), | 2583 math, factory->to_string_tag_symbol(), |
2584 factory->NewStringFromAsciiChecked("Math"), | 2584 factory->NewStringFromAsciiChecked("Math"), |
2585 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 2585 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
2586 } | 2586 } |
2587 | 2587 |
| 2588 { // -- C o n s o l e |
| 2589 Handle<String> name = factory->InternalizeUtf8String("console"); |
| 2590 Handle<JSFunction> cons = factory->NewFunction(name); |
| 2591 Handle<JSObject> console = factory->NewJSObject(cons, TENURED); |
| 2592 DCHECK(console->IsJSObject()); |
| 2593 JSObject::AddProperty(global, name, console, DONT_ENUM); |
| 2594 SimpleInstallFunction(console, "debug", Builtins::kConsoleDebug, 1, false); |
| 2595 SimpleInstallFunction(console, "error", Builtins::kConsoleError, 1, false); |
| 2596 SimpleInstallFunction(console, "info", Builtins::kConsoleInfo, 1, false); |
| 2597 SimpleInstallFunction(console, "log", Builtins::kConsoleLog, 1, false); |
| 2598 SimpleInstallFunction(console, "warn", Builtins::kConsoleWarn, 1, false); |
| 2599 SimpleInstallFunction(console, "dir", Builtins::kConsoleDir, 1, false); |
| 2600 SimpleInstallFunction(console, "dirxml", Builtins::kConsoleDirXml, 1, |
| 2601 false); |
| 2602 SimpleInstallFunction(console, "table", Builtins::kConsoleTable, 1, false); |
| 2603 SimpleInstallFunction(console, "trace", Builtins::kConsoleTrace, 1, false); |
| 2604 SimpleInstallFunction(console, "group", Builtins::kConsoleGroup, 1, false); |
| 2605 SimpleInstallFunction(console, "groupCollapsed", |
| 2606 Builtins::kConsoleGroupCollapsed, 1, false); |
| 2607 SimpleInstallFunction(console, "groupEnd", Builtins::kConsoleGroupEnd, 1, |
| 2608 false); |
| 2609 SimpleInstallFunction(console, "clear", Builtins::kConsoleClear, 1, false); |
| 2610 SimpleInstallFunction(console, "count", Builtins::kConsoleCount, 1, false); |
| 2611 SimpleInstallFunction(console, "assert", Builtins::kConsoleAssert, 1, |
| 2612 false); |
| 2613 SimpleInstallFunction(console, "markTimeline", |
| 2614 Builtins::kConsoleMarkTimeline, 1, false); |
| 2615 SimpleInstallFunction(console, "profile", Builtins::kConsoleProfile, 1, |
| 2616 false); |
| 2617 SimpleInstallFunction(console, "profileEnd", Builtins::kConsoleProfileEnd, |
| 2618 1, false); |
| 2619 SimpleInstallFunction(console, "timeline", Builtins::kConsoleTimeline, 1, |
| 2620 false); |
| 2621 SimpleInstallFunction(console, "timelineEnd", Builtins::kConsoleTimelineEnd, |
| 2622 1, false); |
| 2623 SimpleInstallFunction(console, "time", Builtins::kConsoleTime, 1, false); |
| 2624 SimpleInstallFunction(console, "timeEnd", Builtins::kConsoleTimeEnd, 1, |
| 2625 false); |
| 2626 SimpleInstallFunction(console, "timeStamp", Builtins::kConsoleTimeStamp, 1, |
| 2627 false); |
| 2628 JSObject::AddProperty( |
| 2629 console, factory->to_string_tag_symbol(), |
| 2630 factory->NewStringFromAsciiChecked("Console"), |
| 2631 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
| 2632 } |
| 2633 |
2588 #ifdef V8_I18N_SUPPORT | 2634 #ifdef V8_I18N_SUPPORT |
2589 { // -- I n t l | 2635 { // -- I n t l |
2590 Handle<String> name = factory->InternalizeUtf8String("Intl"); | 2636 Handle<String> name = factory->InternalizeUtf8String("Intl"); |
2591 Handle<JSFunction> cons = factory->NewFunction(name); | 2637 Handle<JSFunction> cons = factory->NewFunction(name); |
2592 JSFunction::SetInstancePrototype( | 2638 JSFunction::SetInstancePrototype( |
2593 cons, | 2639 cons, |
2594 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 2640 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
2595 Handle<JSObject> intl = factory->NewJSObject(cons, TENURED); | 2641 Handle<JSObject> intl = factory->NewJSObject(cons, TENURED); |
2596 DCHECK(intl->IsJSObject()); | 2642 DCHECK(intl->IsJSObject()); |
2597 JSObject::AddProperty(global, name, intl, DONT_ENUM); | 2643 JSObject::AddProperty(global, name, intl, DONT_ENUM); |
(...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5244 } | 5290 } |
5245 | 5291 |
5246 | 5292 |
5247 // Called when the top-level V8 mutex is destroyed. | 5293 // Called when the top-level V8 mutex is destroyed. |
5248 void Bootstrapper::FreeThreadResources() { | 5294 void Bootstrapper::FreeThreadResources() { |
5249 DCHECK(!IsActive()); | 5295 DCHECK(!IsActive()); |
5250 } | 5296 } |
5251 | 5297 |
5252 } // namespace internal | 5298 } // namespace internal |
5253 } // namespace v8 | 5299 } // namespace v8 |
OLD | NEW |