| 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 2586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2597 InstallConstant(isolate, math, "PI", factory->NewNumber(kPI)); | 2597 InstallConstant(isolate, math, "PI", factory->NewNumber(kPI)); |
| 2598 InstallConstant(isolate, math, "SQRT1_2", | 2598 InstallConstant(isolate, math, "SQRT1_2", |
| 2599 factory->NewNumber(std::sqrt(0.5))); | 2599 factory->NewNumber(std::sqrt(0.5))); |
| 2600 InstallConstant(isolate, math, "SQRT2", factory->NewNumber(std::sqrt(2.0))); | 2600 InstallConstant(isolate, math, "SQRT2", factory->NewNumber(std::sqrt(2.0))); |
| 2601 JSObject::AddProperty( | 2601 JSObject::AddProperty( |
| 2602 math, factory->to_string_tag_symbol(), | 2602 math, factory->to_string_tag_symbol(), |
| 2603 factory->NewStringFromAsciiChecked("Math"), | 2603 factory->NewStringFromAsciiChecked("Math"), |
| 2604 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 2604 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
| 2605 } | 2605 } |
| 2606 | 2606 |
| 2607 { // -- C o n s o l e | |
| 2608 Handle<String> name = factory->InternalizeUtf8String("console"); | |
| 2609 Handle<JSFunction> cons = factory->NewFunction(name); | |
| 2610 Handle<JSObject> empty = factory->NewJSObject(isolate->object_function()); | |
| 2611 JSFunction::SetInstancePrototype(cons, empty); | |
| 2612 Handle<JSObject> console = factory->NewJSObject(cons, TENURED); | |
| 2613 DCHECK(console->IsJSObject()); | |
| 2614 JSObject::AddProperty(global, name, console, DONT_ENUM); | |
| 2615 SimpleInstallFunction(console, "debug", Builtins::kConsoleDebug, 1, false); | |
| 2616 SimpleInstallFunction(console, "error", Builtins::kConsoleError, 1, false); | |
| 2617 SimpleInstallFunction(console, "info", Builtins::kConsoleInfo, 1, false); | |
| 2618 SimpleInstallFunction(console, "log", Builtins::kConsoleLog, 1, false); | |
| 2619 SimpleInstallFunction(console, "warn", Builtins::kConsoleWarn, 1, false); | |
| 2620 SimpleInstallFunction(console, "dir", Builtins::kConsoleDir, 1, false); | |
| 2621 SimpleInstallFunction(console, "dirxml", Builtins::kConsoleDirXml, 1, | |
| 2622 false); | |
| 2623 SimpleInstallFunction(console, "table", Builtins::kConsoleTable, 1, false); | |
| 2624 SimpleInstallFunction(console, "trace", Builtins::kConsoleTrace, 1, false); | |
| 2625 SimpleInstallFunction(console, "group", Builtins::kConsoleGroup, 1, false); | |
| 2626 SimpleInstallFunction(console, "groupCollapsed", | |
| 2627 Builtins::kConsoleGroupCollapsed, 1, false); | |
| 2628 SimpleInstallFunction(console, "groupEnd", Builtins::kConsoleGroupEnd, 1, | |
| 2629 false); | |
| 2630 SimpleInstallFunction(console, "clear", Builtins::kConsoleClear, 1, false); | |
| 2631 SimpleInstallFunction(console, "count", Builtins::kConsoleCount, 1, false); | |
| 2632 SimpleInstallFunction(console, "assert", Builtins::kConsoleAssert, 1, | |
| 2633 false); | |
| 2634 SimpleInstallFunction(console, "markTimeline", | |
| 2635 Builtins::kConsoleMarkTimeline, 1, false); | |
| 2636 SimpleInstallFunction(console, "profile", Builtins::kConsoleProfile, 1, | |
| 2637 false); | |
| 2638 SimpleInstallFunction(console, "profileEnd", Builtins::kConsoleProfileEnd, | |
| 2639 1, false); | |
| 2640 SimpleInstallFunction(console, "timeline", Builtins::kConsoleTimeline, 1, | |
| 2641 false); | |
| 2642 SimpleInstallFunction(console, "timelineEnd", Builtins::kConsoleTimelineEnd, | |
| 2643 1, false); | |
| 2644 SimpleInstallFunction(console, "time", Builtins::kConsoleTime, 1, false); | |
| 2645 SimpleInstallFunction(console, "timeEnd", Builtins::kConsoleTimeEnd, 1, | |
| 2646 false); | |
| 2647 SimpleInstallFunction(console, "timeStamp", Builtins::kConsoleTimeStamp, 1, | |
| 2648 false); | |
| 2649 JSObject::AddProperty( | |
| 2650 console, factory->to_string_tag_symbol(), | |
| 2651 factory->NewStringFromAsciiChecked("Object"), | |
| 2652 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | |
| 2653 } | |
| 2654 | |
| 2655 #ifdef V8_I18N_SUPPORT | 2607 #ifdef V8_I18N_SUPPORT |
| 2656 { // -- I n t l | 2608 { // -- I n t l |
| 2657 Handle<String> name = factory->InternalizeUtf8String("Intl"); | 2609 Handle<String> name = factory->InternalizeUtf8String("Intl"); |
| 2658 Handle<JSFunction> cons = factory->NewFunction(name); | 2610 Handle<JSFunction> cons = factory->NewFunction(name); |
| 2659 JSFunction::SetInstancePrototype( | 2611 JSFunction::SetInstancePrototype( |
| 2660 cons, | 2612 cons, |
| 2661 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 2613 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
| 2662 Handle<JSObject> intl = factory->NewJSObject(cons, TENURED); | 2614 Handle<JSObject> intl = factory->NewJSObject(cons, TENURED); |
| 2663 DCHECK(intl->IsJSObject()); | 2615 DCHECK(intl->IsJSObject()); |
| 2664 JSObject::AddProperty(global, name, intl, DONT_ENUM); | 2616 JSObject::AddProperty(global, name, intl, DONT_ENUM); |
| (...skipping 2664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5329 } | 5281 } |
| 5330 | 5282 |
| 5331 | 5283 |
| 5332 // Called when the top-level V8 mutex is destroyed. | 5284 // Called when the top-level V8 mutex is destroyed. |
| 5333 void Bootstrapper::FreeThreadResources() { | 5285 void Bootstrapper::FreeThreadResources() { |
| 5334 DCHECK(!IsActive()); | 5286 DCHECK(!IsActive()); |
| 5335 } | 5287 } |
| 5336 | 5288 |
| 5337 } // namespace internal | 5289 } // namespace internal |
| 5338 } // namespace v8 | 5290 } // namespace v8 |
| OLD | NEW |