Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1562)

Side by Side Diff: src/bootstrapper.cc

Issue 2785293002: [inspector] move console to builtins (Closed)
Patch Set: removed unused variable Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | src/builtins/builtins-console.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2551 InstallConstant(isolate, math, "PI", factory->NewNumber(kPI)); 2551 InstallConstant(isolate, math, "PI", factory->NewNumber(kPI));
2552 InstallConstant(isolate, math, "SQRT1_2", 2552 InstallConstant(isolate, math, "SQRT1_2",
2553 factory->NewNumber(std::sqrt(0.5))); 2553 factory->NewNumber(std::sqrt(0.5)));
2554 InstallConstant(isolate, math, "SQRT2", factory->NewNumber(std::sqrt(2.0))); 2554 InstallConstant(isolate, math, "SQRT2", factory->NewNumber(std::sqrt(2.0)));
2555 JSObject::AddProperty( 2555 JSObject::AddProperty(
2556 math, factory->to_string_tag_symbol(), 2556 math, factory->to_string_tag_symbol(),
2557 factory->NewStringFromAsciiChecked("Math"), 2557 factory->NewStringFromAsciiChecked("Math"),
2558 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); 2558 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
2559 } 2559 }
2560 2560
2561 { // -- C o n s o l e
2562 Handle<String> name = factory->InternalizeUtf8String("console");
2563 Handle<JSFunction> cons = factory->NewFunction(name);
2564 Handle<JSObject> empty = factory->NewJSObject(isolate->object_function());
2565 JSFunction::SetInstancePrototype(cons, empty);
2566 Handle<JSObject> console = factory->NewJSObject(cons, TENURED);
2567 DCHECK(console->IsJSObject());
2568 JSObject::AddProperty(global, name, console, DONT_ENUM);
2569 SimpleInstallFunction(console, "debug", Builtins::kConsoleDebug, 1, false);
2570 SimpleInstallFunction(console, "error", Builtins::kConsoleError, 1, false);
2571 SimpleInstallFunction(console, "info", Builtins::kConsoleInfo, 1, false);
2572 SimpleInstallFunction(console, "log", Builtins::kConsoleLog, 1, false);
2573 SimpleInstallFunction(console, "warn", Builtins::kConsoleWarn, 1, false);
2574 SimpleInstallFunction(console, "dir", Builtins::kConsoleDir, 1, false);
2575 SimpleInstallFunction(console, "dirxml", Builtins::kConsoleDirXml, 1,
2576 false);
2577 SimpleInstallFunction(console, "table", Builtins::kConsoleTable, 1, false);
2578 SimpleInstallFunction(console, "trace", Builtins::kConsoleTrace, 1, false);
2579 SimpleInstallFunction(console, "group", Builtins::kConsoleGroup, 1, false);
2580 SimpleInstallFunction(console, "groupCollapsed",
2581 Builtins::kConsoleGroupCollapsed, 1, false);
2582 SimpleInstallFunction(console, "groupEnd", Builtins::kConsoleGroupEnd, 1,
2583 false);
2584 SimpleInstallFunction(console, "clear", Builtins::kConsoleClear, 1, false);
2585 SimpleInstallFunction(console, "count", Builtins::kConsoleCount, 1, false);
2586 SimpleInstallFunction(console, "assert", Builtins::kConsoleAssert, 1,
2587 false);
2588 SimpleInstallFunction(console, "markTimeline",
2589 Builtins::kConsoleMarkTimeline, 1, false);
2590 SimpleInstallFunction(console, "profile", Builtins::kConsoleProfile, 1,
2591 false);
2592 SimpleInstallFunction(console, "profileEnd", Builtins::kConsoleProfileEnd,
2593 1, false);
2594 SimpleInstallFunction(console, "timeline", Builtins::kConsoleTimeline, 1,
2595 false);
2596 SimpleInstallFunction(console, "timelineEnd", Builtins::kConsoleTimelineEnd,
2597 1, false);
2598 SimpleInstallFunction(console, "time", Builtins::kConsoleTime, 1, false);
2599 SimpleInstallFunction(console, "timeEnd", Builtins::kConsoleTimeEnd, 1,
2600 false);
2601 SimpleInstallFunction(console, "timeStamp", Builtins::kConsoleTimeStamp, 1,
2602 false);
2603 JSObject::AddProperty(
2604 console, factory->to_string_tag_symbol(),
2605 factory->NewStringFromAsciiChecked("Object"),
2606 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
2607 }
2608
2561 #ifdef V8_I18N_SUPPORT 2609 #ifdef V8_I18N_SUPPORT
2562 { // -- I n t l 2610 { // -- I n t l
2563 Handle<String> name = factory->InternalizeUtf8String("Intl"); 2611 Handle<String> name = factory->InternalizeUtf8String("Intl");
2564 Handle<JSFunction> cons = factory->NewFunction(name); 2612 Handle<JSFunction> cons = factory->NewFunction(name);
2565 JSFunction::SetInstancePrototype( 2613 JSFunction::SetInstancePrototype(
2566 cons, 2614 cons,
2567 Handle<Object>(native_context()->initial_object_prototype(), isolate)); 2615 Handle<Object>(native_context()->initial_object_prototype(), isolate));
2568 Handle<JSObject> intl = factory->NewJSObject(cons, TENURED); 2616 Handle<JSObject> intl = factory->NewJSObject(cons, TENURED);
2569 DCHECK(intl->IsJSObject()); 2617 DCHECK(intl->IsJSObject());
2570 JSObject::AddProperty(global, name, intl, DONT_ENUM); 2618 JSObject::AddProperty(global, name, intl, DONT_ENUM);
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after
5227 } 5275 }
5228 5276
5229 5277
5230 // Called when the top-level V8 mutex is destroyed. 5278 // Called when the top-level V8 mutex is destroyed.
5231 void Bootstrapper::FreeThreadResources() { 5279 void Bootstrapper::FreeThreadResources() {
5232 DCHECK(!IsActive()); 5280 DCHECK(!IsActive());
5233 } 5281 }
5234 5282
5235 } // namespace internal 5283 } // namespace internal
5236 } // namespace v8 5284 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/builtins/builtins-console.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698