Title: [200350] trunk
Revision
200350
Author
[email protected]
Date
2016-05-02 17:51:24 -0700 (Mon, 02 May 2016)

Log Message

Make console a namespace object (like Math/JSON), allowing functions to be called unbound
https://bugs.webkit.org/show_bug.cgi?id=157286
<rdar://problem/26052830>

Patch by Joseph Pecoraro <[email protected]> on 2016-05-02
Reviewed by Timothy Hatcher.

Source/_javascript_Core:

This changes `console` to be a global namespace object, like `Math` and `JSON`.
It just holds a bunch of functions, that can be used on their own, unbound.
For example, `[1,2,3].forEach(console.log)` and `var log = console.log; log(1)`
used to throw exceptions and now do not.

Previously console was an Object/Prototype pair, so functions were on
ConsolePrototype (console.__proto__.log) and they needed to be called
Console objects as the `this` value. Now, `console` is just a standard
object with a bunch of functions. Since there is no console prototype the
functions can be passed around and called as expected and they will
just do the right thing.

For compatability with other browsers, `console` was made enumerable
on the global object.

* CMakeLists.txt:
* _javascript_Core.xcodeproj/project.pbxproj:
Add new files and remove old files.

* runtime/CommonIdentifiers.h:
Add "console".

* runtime/ConsoleObject.cpp: Renamed from Source/_javascript_Core/runtime/ConsolePrototype.cpp.
(JSC::ConsoleObject::ConsoleObject):
(JSC::ConsoleObject::finishCreation):
(JSC::valueToStringWithUndefinedOrNullCheck):
(JSC::consoleLogWithLevel):
(JSC::consoleProtoFuncDebug):
(JSC::consoleProtoFuncError):
(JSC::consoleProtoFuncLog):
(JSC::consoleProtoFuncInfo):
(JSC::consoleProtoFuncWarn):
(JSC::consoleProtoFuncClear):
(JSC::consoleProtoFuncDir):
(JSC::consoleProtoFuncDirXML):
(JSC::consoleProtoFuncTable):
(JSC::consoleProtoFuncTrace):
(JSC::consoleProtoFuncAssert):
(JSC::consoleProtoFuncCount):
(JSC::consoleProtoFuncProfile):
(JSC::consoleProtoFuncProfileEnd):
(JSC::consoleProtoFuncTakeHeapSnapshot):
(JSC::consoleProtoFuncTime):
(JSC::consoleProtoFuncTimeEnd):
(JSC::consoleProtoFuncTimeStamp):
(JSC::consoleProtoFuncGroup):
(JSC::consoleProtoFuncGroupCollapsed):
(JSC::consoleProtoFuncGroupEnd):
Console functions no longer need to check if the this object is
a Console object. They will always just work now.

* runtime/MathObject.cpp:
* runtime/MathObject.h:
* runtime/ConsoleObject.h: Renamed from Source/_javascript_Core/runtime/ConsolePrototype.h.
(JSC::ConsoleObject::create):
(JSC::ConsoleObject::createStructure):
ConsoleObject is a basic object like MathObject.

* runtime/JSConsole.cpp: Removed.
* runtime/JSConsole.h: Removed.
* runtime/JSGlobalObject.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
Remove JSConsole / ConsolePrototype in favor of the single ConsoleObject.

LayoutTests:

* js/console-expected.txt: Added.
* js/console.html: Added.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (200349 => 200350)


--- trunk/LayoutTests/ChangeLog	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/LayoutTests/ChangeLog	2016-05-03 00:51:24 UTC (rev 200350)
@@ -1,3 +1,14 @@
+2016-05-02  Joseph Pecoraro  <[email protected]>
+
+        Make console a namespace object (like Math/JSON), allowing functions to be called unbound
+        https://bugs.webkit.org/show_bug.cgi?id=157286
+        <rdar://problem/26052830>
+
+        Reviewed by Timothy Hatcher.
+
+        * js/console-expected.txt: Added.
+        * js/console.html: Added.
+
 2016-05-02  Antti Koivisto  <[email protected]>
 
         REGRESSION(r199964): Animation on pseudo elements doesn't trigger if first frame matches the current style

Added: trunk/LayoutTests/js/console-expected.txt (0 => 200350)


--- trunk/LayoutTests/js/console-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/console-expected.txt	2016-05-03 00:51:24 UTC (rev 200350)
@@ -0,0 +1,170 @@
+CONSOLE MESSAGE: line 19: log message
+CONSOLE MESSAGE: line 20: log message
+CONSOLE MESSAGE: line 21: log message
+CONSOLE MESSAGE: line 22: log message
+CONSOLE MESSAGE: line 23: log message
+CONSOLE MESSAGE: line 24: log message
+CONSOLE MESSAGE: line 26: log message
+CONSOLE MESSAGE: line 1: 1
+CONSOLE MESSAGE: line 1: 2
+CONSOLE MESSAGE: line 1: 3
+PASS typeof console is "object"
+PASS console.toString() is "[object Console]"
+PASS Object.getPrototypeOf(console) is Object.getPrototypeOf({})
+PASS console is console
+PASS consoleDescriptor.configurable is true
+PASS consoleDescriptor.writable is true
+PASS consoleDescriptor.enumerable is true
+
+console.debug
+PASS typeof console.debug is "function"
+PASS console.debug.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.error
+PASS typeof console.error is "function"
+PASS console.error.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.log
+PASS typeof console.log is "function"
+PASS console.log.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.info
+PASS typeof console.info is "function"
+PASS console.info.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.warn
+PASS typeof console.warn is "function"
+PASS console.warn.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.clear
+PASS typeof console.clear is "function"
+PASS console.clear.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.dir
+PASS typeof console.dir is "function"
+PASS console.dir.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.dirxml
+PASS typeof console.dirxml is "function"
+PASS console.dirxml.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.table
+PASS typeof console.table is "function"
+PASS console.table.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.trace
+PASS typeof console.trace is "function"
+PASS console.trace.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.assert
+PASS typeof console.assert is "function"
+PASS console.assert.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.count
+PASS typeof console.count is "function"
+PASS console.count.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.profile
+PASS typeof console.profile is "function"
+PASS console.profile.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.profileEnd
+PASS typeof console.profileEnd is "function"
+PASS console.profileEnd.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.time
+PASS typeof console.time is "function"
+PASS console.time.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.timeEnd
+PASS typeof console.timeEnd is "function"
+PASS console.timeEnd.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.timeStamp
+PASS typeof console.timeStamp is "function"
+PASS console.timeStamp.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.takeHeapSnapshot
+PASS typeof console.takeHeapSnapshot is "function"
+PASS console.takeHeapSnapshot.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.group
+PASS typeof console.group is "function"
+PASS console.group.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.groupCollapsed
+PASS typeof console.groupCollapsed is "function"
+PASS console.groupCollapsed.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+console.groupEnd
+PASS typeof console.groupEnd is "function"
+PASS console.groupEnd.length is 0
+PASS descriptor.configurable is true
+PASS descriptor.writable is true
+PASS descriptor.enumerable is true
+
+PASS Object.getOwnPropertyNames(console).length is enumerablePropertyCount
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/js/console.html (0 => 200350)


--- trunk/LayoutTests/js/console.html	                        (rev 0)
+++ trunk/LayoutTests/js/console.html	2016-05-03 00:51:24 UTC (rev 200350)
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+shouldBeEqualToString("typeof console", "object");
+shouldBeEqualToString("console.toString()", "[object Console]");
+shouldBe("Object.getPrototypeOf(console)", "Object.getPrototypeOf({})");
+shouldBe("console", "console");
+
+var consoleDescriptor = Object.getOwnPropertyDescriptor(window, "console");
+shouldBeTrue('consoleDescriptor.configurable');
+shouldBeTrue('consoleDescriptor.writable');
+shouldBeTrue('consoleDescriptor.enumerable');
+
+// Console methods don't care what their this object is.
+console.log("log message");
+console.log.call(null, "log message");
+console.log.call(undefined, "log message");
+console.log.call(console, "log message");
+console.log.call(123, "log message");
+console.log.call("ignore", "log message");
+console.log.bind(console, "log message");
+console.log.bind(console)("log message");
+[1,2,3].forEach(console.log);
+
+// All properties should be enumerable.
+var property, descriptor;
+var enumerablePropertyCount = 0;
+for (property in console) {
+    enumerablePropertyCount++;
+    descriptor = Object.getOwnPropertyDescriptor(console, property);
+
+    debug("");
+    debug(`console.${property}`);
+    shouldBeEqualToString(`typeof console.${property}`, "function");
+    shouldBe(`console.${property}.length`, '0');
+    shouldBeTrue('descriptor.configurable');
+    shouldBeTrue('descriptor.writable');
+    shouldBeTrue('descriptor.enumerable');
+}
+
+debug("");
+shouldBe("Object.getOwnPropertyNames(console).length", "enumerablePropertyCount");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/_javascript_Core/CMakeLists.txt (200349 => 200350)


--- trunk/Source/_javascript_Core/CMakeLists.txt	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/CMakeLists.txt	2016-05-03 00:51:24 UTC (rev 200350)
@@ -625,7 +625,7 @@
     runtime/CompilationResult.cpp
     runtime/Completion.cpp
     runtime/ConsoleClient.cpp
-    runtime/ConsolePrototype.cpp
+    runtime/ConsoleObject.cpp
     runtime/ConstantMode.cpp
     runtime/ConstructData.cpp
     runtime/ControlFlowProfiler.cpp
@@ -690,7 +690,6 @@
     runtime/JSCJSValue.cpp
     runtime/JSCallee.cpp
     runtime/JSCell.cpp
-    runtime/JSConsole.cpp
     runtime/JSDataView.cpp
     runtime/JSDataViewPrototype.cpp
     runtime/JSDateMath.cpp

Modified: trunk/Source/_javascript_Core/ChangeLog (200349 => 200350)


--- trunk/Source/_javascript_Core/ChangeLog	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-05-03 00:51:24 UTC (rev 200350)
@@ -1,3 +1,77 @@
+2016-05-02  Joseph Pecoraro  <[email protected]>
+
+        Make console a namespace object (like Math/JSON), allowing functions to be called unbound
+        https://bugs.webkit.org/show_bug.cgi?id=157286
+        <rdar://problem/26052830>
+
+        Reviewed by Timothy Hatcher.
+
+        This changes `console` to be a global namespace object, like `Math` and `JSON`.
+        It just holds a bunch of functions, that can be used on their own, unbound.
+        For example, `[1,2,3].forEach(console.log)` and `var log = console.log; log(1)`
+        used to throw exceptions and now do not.
+
+        Previously console was an Object/Prototype pair, so functions were on
+        ConsolePrototype (console.__proto__.log) and they needed to be called
+        Console objects as the `this` value. Now, `console` is just a standard
+        object with a bunch of functions. Since there is no console prototype the
+        functions can be passed around and called as expected and they will
+        just do the right thing.
+
+        For compatability with other browsers, `console` was made enumerable
+        on the global object.
+
+        * CMakeLists.txt:
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        Add new files and remove old files.
+
+        * runtime/CommonIdentifiers.h:
+        Add "console".
+
+        * runtime/ConsoleObject.cpp: Renamed from Source/_javascript_Core/runtime/ConsolePrototype.cpp.
+        (JSC::ConsoleObject::ConsoleObject):
+        (JSC::ConsoleObject::finishCreation):
+        (JSC::valueToStringWithUndefinedOrNullCheck):
+        (JSC::consoleLogWithLevel):
+        (JSC::consoleProtoFuncDebug):
+        (JSC::consoleProtoFuncError):
+        (JSC::consoleProtoFuncLog):
+        (JSC::consoleProtoFuncInfo):
+        (JSC::consoleProtoFuncWarn):
+        (JSC::consoleProtoFuncClear):
+        (JSC::consoleProtoFuncDir):
+        (JSC::consoleProtoFuncDirXML):
+        (JSC::consoleProtoFuncTable):
+        (JSC::consoleProtoFuncTrace):
+        (JSC::consoleProtoFuncAssert):
+        (JSC::consoleProtoFuncCount):
+        (JSC::consoleProtoFuncProfile):
+        (JSC::consoleProtoFuncProfileEnd):
+        (JSC::consoleProtoFuncTakeHeapSnapshot):
+        (JSC::consoleProtoFuncTime):
+        (JSC::consoleProtoFuncTimeEnd):
+        (JSC::consoleProtoFuncTimeStamp):
+        (JSC::consoleProtoFuncGroup):
+        (JSC::consoleProtoFuncGroupCollapsed):
+        (JSC::consoleProtoFuncGroupEnd):
+        Console functions no longer need to check if the this object is
+        a Console object. They will always just work now.
+
+        * runtime/MathObject.cpp:
+        * runtime/MathObject.h:
+        * runtime/ConsoleObject.h: Renamed from Source/_javascript_Core/runtime/ConsolePrototype.h.
+        (JSC::ConsoleObject::create):
+        (JSC::ConsoleObject::createStructure):
+        ConsoleObject is a basic object like MathObject.
+
+        * runtime/JSConsole.cpp: Removed.
+        * runtime/JSConsole.h: Removed.
+        * runtime/JSGlobalObject.h:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        (JSC::JSGlobalObject::visitChildren):
+        Remove JSConsole / ConsolePrototype in favor of the single ConsoleObject.
+
 2016-05-02  Per Arne Vollan  <[email protected]>
 
         [Win] Clean up annoying compiler warnings

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (200349 => 200350)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2016-05-03 00:51:24 UTC (rev 200350)
@@ -1568,10 +1568,6 @@
 		A5339EC91BB4B4600054F005 /* HeapObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = A5339EC81BB4B4510054F005 /* HeapObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A5398FAB1C750DA40060A963 /* HeapProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = A5398FAA1C750D950060A963 /* HeapProfiler.h */; };
 		A5398FAC1C750DA60060A963 /* HeapProfiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5398FA91C750D950060A963 /* HeapProfiler.cpp */; };
-		A53CE08518BC1A5600BEDF76 /* ConsolePrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A53CE08118BC1A5600BEDF76 /* ConsolePrototype.cpp */; };
-		A53CE08618BC1A5600BEDF76 /* ConsolePrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = A53CE08218BC1A5600BEDF76 /* ConsolePrototype.h */; };
-		A53CE08718BC1A5600BEDF76 /* JSConsole.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A53CE08318BC1A5600BEDF76 /* JSConsole.cpp */; };
-		A53CE08818BC1A5600BEDF76 /* JSConsole.h in Headers */ = {isa = PBXBuildFile; fileRef = A53CE08418BC1A5600BEDF76 /* JSConsole.h */; };
 		A53CE08A18BC21C300BEDF76 /* ConsoleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A53CE08918BC21C300BEDF76 /* ConsoleClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A53F1AC018C90F8F0072EB6D /* framework.sb in Resources */ = {isa = PBXBuildFile; fileRef = A53F1ABE18C90EC70072EB6D /* framework.sb */; };
 		A54982031891D0B00081E5B8 /* EventLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A54982011891D0B00081E5B8 /* EventLoop.cpp */; };
@@ -1589,6 +1585,8 @@
 		A55165D51BDF135A003B75C1 /* ScriptProfilingScope.h in Headers */ = {isa = PBXBuildFile; fileRef = A55165D41BDF134D003B75C1 /* ScriptProfilingScope.h */; };
 		A552C37F1ADDB8FE00139726 /* JSRemoteInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A552C37D1ADDB8FE00139726 /* JSRemoteInspector.cpp */; };
 		A552C3801ADDB8FE00139726 /* JSRemoteInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = A552C37E1ADDB8FE00139726 /* JSRemoteInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A55714BE1CD8049F0004D2C6 /* ConsoleObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A55714BD1CD8048E0004D2C6 /* ConsoleObject.h */; };
+		A55714BF1CD804A40004D2C6 /* ConsoleObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A55714BC1CD8048E0004D2C6 /* ConsoleObject.cpp */; };
 		A55D93A5185012A800400DED /* ScriptFunctionCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A55D93A3185012A800400DED /* ScriptFunctionCall.cpp */; };
 		A55D93A6185012A800400DED /* ScriptFunctionCall.h in Headers */ = {isa = PBXBuildFile; fileRef = A55D93A4185012A800400DED /* ScriptFunctionCall.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A55D93AC18514F7900400DED /* InspectorProtocolTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = A55D93AB18514F7900400DED /* InspectorProtocolTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -3789,10 +3787,6 @@
 		A5339EC81BB4B4510054F005 /* HeapObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapObserver.h; sourceTree = "<group>"; };
 		A5398FA91C750D950060A963 /* HeapProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HeapProfiler.cpp; sourceTree = "<group>"; };
 		A5398FAA1C750D950060A963 /* HeapProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapProfiler.h; sourceTree = "<group>"; };
-		A53CE08118BC1A5600BEDF76 /* ConsolePrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConsolePrototype.cpp; sourceTree = "<group>"; };
-		A53CE08218BC1A5600BEDF76 /* ConsolePrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsolePrototype.h; sourceTree = "<group>"; };
-		A53CE08318BC1A5600BEDF76 /* JSConsole.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSConsole.cpp; sourceTree = "<group>"; };
-		A53CE08418BC1A5600BEDF76 /* JSConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSConsole.h; sourceTree = "<group>"; };
 		A53CE08918BC21C300BEDF76 /* ConsoleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsoleClient.h; sourceTree = "<group>"; };
 		A53F1ABE18C90EC70072EB6D /* framework.sb */ = {isa = PBXFileReference; lastKnownFileType = text; path = framework.sb; sourceTree = "<group>"; };
 		A54982011891D0B00081E5B8 /* EventLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventLoop.cpp; sourceTree = "<group>"; };
@@ -3808,6 +3802,8 @@
 		A55165D41BDF134D003B75C1 /* ScriptProfilingScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfilingScope.h; sourceTree = "<group>"; };
 		A552C37D1ADDB8FE00139726 /* JSRemoteInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRemoteInspector.cpp; sourceTree = "<group>"; };
 		A552C37E1ADDB8FE00139726 /* JSRemoteInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRemoteInspector.h; sourceTree = "<group>"; };
+		A55714BC1CD8048E0004D2C6 /* ConsoleObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConsoleObject.cpp; sourceTree = "<group>"; };
+		A55714BD1CD8048E0004D2C6 /* ConsoleObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsoleObject.h; sourceTree = "<group>"; };
 		A55D93A3185012A800400DED /* ScriptFunctionCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptFunctionCall.cpp; sourceTree = "<group>"; };
 		A55D93A4185012A800400DED /* ScriptFunctionCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptFunctionCall.h; sourceTree = "<group>"; };
 		A55D93AB18514F7900400DED /* InspectorProtocolTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorProtocolTypes.h; sourceTree = "<group>"; };
@@ -5554,8 +5550,8 @@
 				0FDB2CE9174896C7007B3C1B /* ConcurrentJITLock.h */,
 				A5B6A74C18C6DBA600F11E91 /* ConsoleClient.cpp */,
 				A53CE08918BC21C300BEDF76 /* ConsoleClient.h */,
-				A53CE08118BC1A5600BEDF76 /* ConsolePrototype.cpp */,
-				A53CE08218BC1A5600BEDF76 /* ConsolePrototype.h */,
+				A55714BC1CD8048E0004D2C6 /* ConsoleObject.cpp */,
+				A55714BD1CD8048E0004D2C6 /* ConsoleObject.h */,
 				A5FD0071189B038C00633231 /* ConsoleTypes.h */,
 				0F978B3A1AAEA71D007C7369 /* ConstantMode.cpp */,
 				0FFC99D0184EC8AD009C10AB /* ConstantMode.h */,
@@ -5706,8 +5702,6 @@
 				F692A8870255597D01FF60F7 /* JSCJSValue.cpp */,
 				14ABB36E099C076400E2A24F /* JSCJSValue.h */,
 				865A30F0135007E100CDB49E /* JSCJSValueInlines.h */,
-				A53CE08318BC1A5600BEDF76 /* JSConsole.cpp */,
-				A53CE08418BC1A5600BEDF76 /* JSConsole.h */,
 				0F2B66BD17B6B5AB00A7AE3F /* JSDataView.cpp */,
 				0F2B66BE17B6B5AB00A7AE3F /* JSDataView.h */,
 				0F2B66BF17B6B5AB00A7AE3F /* JSDataViewPrototype.cpp */,
@@ -7130,7 +7124,6 @@
 				144836E7132DA7BE005BE785 /* ConservativeRoots.h in Headers */,
 				A53CE08A18BC21C300BEDF76 /* ConsoleClient.h in Headers */,
 				A5FD007A189B051000633231 /* ConsoleMessage.h in Headers */,
-				A53CE08618BC1A5600BEDF76 /* ConsolePrototype.h in Headers */,
 				A5FD0074189B038C00633231 /* ConsoleTypes.h in Headers */,
 				0FFC99D1184EC8AD009C10AB /* ConstantMode.h in Headers */,
 				E354622B1B6065D100545386 /* ConstructAbility.h in Headers */,
@@ -7581,6 +7574,7 @@
 				A5398FAB1C750DA40060A963 /* HeapProfiler.h in Headers */,
 				A1587D721B4DC14100D69849 /* IntlDateTimeFormatPrototype.h in Headers */,
 				A1587D761B4DC1C600D69849 /* IntlDateTimeFormatPrototype.lut.h in Headers */,
+				A55714BE1CD8049F0004D2C6 /* ConsoleObject.h in Headers */,
 				A1D792FD1B43864B004516F5 /* IntlNumberFormat.h in Headers */,
 				A1D792FF1B43864B004516F5 /* IntlNumberFormatConstructor.h in Headers */,
 				A125846E1B45A36000CC7F6C /* IntlNumberFormatConstructor.lut.h in Headers */,
@@ -7636,7 +7630,6 @@
 				BC18C42B0E16F5CD00B34460 /* JSCJSValue.h in Headers */,
 				865A30F1135007E100CDB49E /* JSCJSValueInlines.h in Headers */,
 				BC18C41D0E16F5CD00B34460 /* JSClassRef.h in Headers */,
-				A53CE08818BC1A5600BEDF76 /* JSConsole.h in Headers */,
 				86E3C613167BABD7006D760A /* JSContext.h in Headers */,
 				86E3C617167BABEE006D760A /* JSContextInternal.h in Headers */,
 				A58C024218E4A41A00032BC5 /* JSContextPrivate.h in Headers */,
@@ -8674,6 +8667,7 @@
 				0FEC851F1BDACDAC0080FF74 /* B3MemoryValue.cpp in Sources */,
 				0FEC85211BDACDAC0080FF74 /* B3Opcode.cpp in Sources */,
 				0FEC85231BDACDAC0080FF74 /* B3Origin.cpp in Sources */,
+				A55714BF1CD804A40004D2C6 /* ConsoleObject.cpp in Sources */,
 				0FEC85251BDACDAC0080FF74 /* B3PatchpointSpecial.cpp in Sources */,
 				0FEC85271BDACDAC0080FF74 /* B3PatchpointValue.cpp in Sources */,
 				0FEC85291BDACDAC0080FF74 /* B3PhaseScope.cpp in Sources */,
@@ -8738,7 +8732,6 @@
 				146B16D812EB5B59001BEC1B /* ConservativeRoots.cpp in Sources */,
 				A5B6A74D18C6DBA600F11E91 /* ConsoleClient.cpp in Sources */,
 				A5FD0079189B051000633231 /* ConsoleMessage.cpp in Sources */,
-				A53CE08518BC1A5600BEDF76 /* ConsolePrototype.cpp in Sources */,
 				0F978B3B1AAEA71D007C7369 /* ConstantMode.cpp in Sources */,
 				1428082E107EC0570013E7B2 /* ConstructData.cpp in Sources */,
 				A57D23F11891B5B40031C7FA /* ContentSearchUtilities.cpp in Sources */,
@@ -9092,7 +9085,6 @@
 				147F39D1107EC37600427A48 /* JSCell.cpp in Sources */,
 				147F39D6107EC37600427A48 /* JSCJSValue.cpp in Sources */,
 				1440FCE40A51E46B0005F061 /* JSClassRef.cpp in Sources */,
-				A53CE08718BC1A5600BEDF76 /* JSConsole.cpp in Sources */,
 				86E3C616167BABEE006D760A /* JSContext.mm in Sources */,
 				14BD5A300A3E91F600BAF59C /* JSContextRef.cpp in Sources */,
 				A72028B61797601E0098028C /* JSCTestRunnerUtils.cpp in Sources */,

Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (200349 => 200350)


--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2016-05-03 00:51:24 UTC (rev 200350)
@@ -129,6 +129,7 @@
     macro(compilations) \
     macro(compile) \
     macro(configurable) \
+    macro(console) \
     macro(constructor) \
     macro(count) \
     macro(counters) \

Copied: trunk/Source/_javascript_Core/runtime/ConsoleObject.cpp (from rev 200347, trunk/Source/_javascript_Core/runtime/ConsolePrototype.cpp) (0 => 200350)


--- trunk/Source/_javascript_Core/runtime/ConsoleObject.cpp	                        (rev 0)
+++ trunk/Source/_javascript_Core/runtime/ConsoleObject.cpp	2016-05-03 00:51:24 UTC (rev 200350)
@@ -0,0 +1,362 @@
+/*
+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ConsoleObject.h"
+
+#include "ConsoleClient.h"
+#include "Error.h"
+#include "JSCInlines.h"
+#include "ScriptArguments.h"
+#include "ScriptCallStackFactory.h"
+
+namespace JSC {
+
+STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ConsoleObject);
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDebug(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncError(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncLog(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncInfo(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncWarn(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncClear(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDir(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDirXML(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTable(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTrace(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncAssert(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncCount(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfile(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfileEnd(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTakeHeapSnapshot(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeStamp(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroup(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupCollapsed(ExecState*);
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupEnd(ExecState*);
+
+const ClassInfo ConsoleObject::s_info = { "Console", &Base::s_info, 0, CREATE_METHOD_TABLE(ConsoleObject) };
+
+ConsoleObject::ConsoleObject(VM& vm, Structure* structure)
+    : JSNonFinalObject(vm, structure)
+{
+}
+
+void ConsoleObject::finishCreation(VM& vm, JSGlobalObject* globalObject)
+{
+    Base::finishCreation(vm);
+    ASSERT(inherits(info()));
+
+    // For legacy reasons, console properties are enumerable, writable, deleteable,
+    // and all have a length of 0. This may change if Console is standardized.
+
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("debug", consoleProtoFuncDebug, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("error", consoleProtoFuncError, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("log", consoleProtoFuncLog, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("info", consoleProtoFuncInfo, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("warn", consoleProtoFuncWarn, None, 0);
+
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->clear, consoleProtoFuncClear, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("dir", consoleProtoFuncDir, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("dirxml", consoleProtoFuncDirXML, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("table", consoleProtoFuncTable, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("trace", consoleProtoFuncTrace, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("assert", consoleProtoFuncAssert, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->count, consoleProtoFuncCount, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("profile", consoleProtoFuncProfile, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("profileEnd", consoleProtoFuncProfileEnd, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("time", consoleProtoFuncTime, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeEnd", consoleProtoFuncTimeEnd, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeStamp", consoleProtoFuncTimeStamp, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("takeHeapSnapshot", consoleProtoFuncTakeHeapSnapshot, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("group", consoleProtoFuncGroup, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("groupCollapsed", consoleProtoFuncGroupCollapsed, None, 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("groupEnd", consoleProtoFuncGroupEnd, None, 0);
+}
+
+static String valueToStringWithUndefinedOrNullCheck(ExecState* exec, JSValue value)
+{
+    if (value.isUndefinedOrNull())
+        return String();
+    return value.toString(exec)->value(exec);
+}
+
+static EncodedJSValue consoleLogWithLevel(ExecState* exec, MessageLevel level)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->logWithLevel(exec, arguments.release(), level);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDebug(ExecState* exec)
+{
+    return consoleLogWithLevel(exec, MessageLevel::Debug);
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncError(ExecState* exec)
+{
+    return consoleLogWithLevel(exec, MessageLevel::Error);
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncLog(ExecState* exec)
+{
+    return consoleLogWithLevel(exec, MessageLevel::Log);
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncInfo(ExecState* exec)
+{
+    return consoleLogWithLevel(exec, MessageLevel::Info);
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncWarn(ExecState* exec)
+{
+    return consoleLogWithLevel(exec, MessageLevel::Warning);
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncClear(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->clear(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDir(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->dir(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDirXML(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->dirXML(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTable(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->table(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTrace(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->trace(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncAssert(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    bool condition(exec->argument(0).toBoolean(exec));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 1));
+    client->assertCondition(exec, arguments.release(), condition);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncCount(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->count(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfile(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    size_t argsCount = exec->argumentCount();
+    if (!argsCount) {
+        client->profile(exec, String());
+        return JSValue::encode(jsUndefined());
+    }
+
+    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    client->profile(exec, title);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfileEnd(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    size_t argsCount = exec->argumentCount();
+    if (!argsCount) {
+        client->profileEnd(exec, String());
+        return JSValue::encode(jsUndefined());
+    }
+
+    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    client->profileEnd(exec, title);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTakeHeapSnapshot(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    size_t argsCount = exec->argumentCount();
+    if (!argsCount) {
+        client->takeHeapSnapshot(exec, String());
+        return JSValue::encode(jsUndefined());
+    }
+
+    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    client->takeHeapSnapshot(exec, title);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    if (exec->argumentCount() < 1)
+        return throwVMError(exec, createNotEnoughArgumentsError(exec));
+
+    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    client->time(exec, title);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    if (exec->argumentCount() < 1)
+        return throwVMError(exec, createNotEnoughArgumentsError(exec));
+
+    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+
+    client->timeEnd(exec, title);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeStamp(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->timeStamp(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroup(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->group(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupCollapsed(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->groupCollapsed(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupEnd(ExecState* exec)
+{
+    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
+    client->groupEnd(exec, arguments.release());
+    return JSValue::encode(jsUndefined());
+}
+
+} // namespace JSC

Copied: trunk/Source/_javascript_Core/runtime/ConsoleObject.h (from rev 200347, trunk/Source/_javascript_Core/runtime/ConsolePrototype.h) (0 => 200350)


--- trunk/Source/_javascript_Core/runtime/ConsoleObject.h	                        (rev 0)
+++ trunk/Source/_javascript_Core/runtime/ConsoleObject.h	2016-05-03 00:51:24 UTC (rev 200350)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "JSObject.h"
+
+namespace JSC {
+
+class ConsoleObject : public JSNonFinalObject {
+private:
+    ConsoleObject(VM&, Structure*);
+
+public:
+    typedef JSNonFinalObject Base;
+
+    static ConsoleObject* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
+    {
+        ConsoleObject* object = new (NotNull, allocateCell<ConsoleObject>(vm.heap)) ConsoleObject(vm, structure);
+        object->finishCreation(vm, globalObject);
+        return object;
+    }
+
+    DECLARE_INFO;
+
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
+
+protected:
+    void finishCreation(VM&, JSGlobalObject*);
+};
+
+} // namespace JSC

Deleted: trunk/Source/_javascript_Core/runtime/ConsolePrototype.cpp (200349 => 200350)


--- trunk/Source/_javascript_Core/runtime/ConsolePrototype.cpp	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/runtime/ConsolePrototype.cpp	2016-05-03 00:51:24 UTC (rev 200350)
@@ -1,426 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ConsolePrototype.h"
-
-#include "ConsoleClient.h"
-#include "Error.h"
-#include "ExceptionHelpers.h"
-#include "JSCInlines.h"
-#include "JSConsole.h"
-#include "ScriptArguments.h"
-#include "ScriptCallStackFactory.h"
-
-namespace JSC {
-
-const ClassInfo ConsolePrototype::s_info = { "ConsolePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(ConsolePrototype) };
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDebug(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncError(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncLog(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncInfo(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncWarn(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncClear(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDir(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDirXML(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTable(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTrace(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncAssert(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncCount(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfile(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfileEnd(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTakeHeapSnapshot(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeStamp(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroup(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupCollapsed(ExecState*);
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupEnd(ExecState*);
-
-void ConsolePrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
-{
-    Base::finishCreation(vm);
-    ASSERT(inherits(info()));
-    vm.prototypeMap.addPrototype(this);
-
-    // For legacy reasons, console properties are enumerable, writable, deleteable,
-    // and all have a length of 0. This may change if Console is standardized.
-
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("debug", consoleProtoFuncDebug, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("error", consoleProtoFuncError, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("log", consoleProtoFuncLog, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("info", consoleProtoFuncInfo, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("warn", consoleProtoFuncWarn, None, 0);
-
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("clear", consoleProtoFuncClear, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("dir", consoleProtoFuncDir, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("dirxml", consoleProtoFuncDirXML, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("table", consoleProtoFuncTable, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("trace", consoleProtoFuncTrace, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("assert", consoleProtoFuncAssert, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("count", consoleProtoFuncCount, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("profile", consoleProtoFuncProfile, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("profileEnd", consoleProtoFuncProfileEnd, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("time", consoleProtoFuncTime, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeEnd", consoleProtoFuncTimeEnd, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeStamp", consoleProtoFuncTimeStamp, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("takeHeapSnapshot", consoleProtoFuncTakeHeapSnapshot, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("group", consoleProtoFuncGroup, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("groupCollapsed", consoleProtoFuncGroupCollapsed, None, 0);
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("groupEnd", consoleProtoFuncGroupEnd, None, 0);
-}
-
-static String valueToStringWithUndefinedOrNullCheck(ExecState* exec, JSValue value)
-{
-    if (value.isUndefinedOrNull())
-        return String();
-    return value.toString(exec)->value(exec);
-}
-
-static EncodedJSValue consoleLogWithLevel(ExecState* exec, MessageLevel level)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
-    client->logWithLevel(exec, arguments.release(), level);
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDebug(ExecState* exec)
-{
-    return consoleLogWithLevel(exec, MessageLevel::Debug);
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncError(ExecState* exec)
-{
-    return consoleLogWithLevel(exec, MessageLevel::Error);
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncLog(ExecState* exec)
-{
-    return consoleLogWithLevel(exec, MessageLevel::Log);
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncInfo(ExecState* exec)
-{
-    return consoleLogWithLevel(exec, MessageLevel::Info);
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncWarn(ExecState* exec)
-{
-    return consoleLogWithLevel(exec, MessageLevel::Warning);
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncClear(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
-    client->clear(exec, arguments.release());
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDir(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
-    client->dir(exec, arguments.release());
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncDirXML(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
-    client->dirXML(exec, arguments.release());
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTable(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
-    client->table(exec, arguments.release());
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTrace(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
-    client->trace(exec, arguments.release());
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncAssert(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    bool condition(exec->argument(0).toBoolean(exec));
-    if (exec->hadException())
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 1));
-    client->assertCondition(exec, arguments.release(), condition);
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncCount(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
-    client->count(exec, arguments.release());
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfile(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    size_t argsCount = exec->argumentCount();
-    if (!argsCount) {
-        client->profile(exec, String());
-        return JSValue::encode(jsUndefined());
-    }
-
-    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
-    if (exec->hadException())
-        return JSValue::encode(jsUndefined());
-
-    client->profile(exec, title);
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfileEnd(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    size_t argsCount = exec->argumentCount();
-    if (!argsCount) {
-        client->profileEnd(exec, String());
-        return JSValue::encode(jsUndefined());
-    }
-
-    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
-    if (exec->hadException())
-        return JSValue::encode(jsUndefined());
-
-    client->profileEnd(exec, title);
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTakeHeapSnapshot(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    size_t argsCount = exec->argumentCount();
-    if (!argsCount) {
-        client->takeHeapSnapshot(exec, String());
-        return JSValue::encode(jsUndefined());
-    }
-
-    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
-    if (exec->hadException())
-        return JSValue::encode(jsUndefined());
-
-    client->takeHeapSnapshot(exec, title);
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    if (exec->argumentCount() < 1)
-        return throwVMError(exec, createNotEnoughArgumentsError(exec));
-
-    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
-    if (exec->hadException())
-        return JSValue::encode(jsUndefined());
-
-    client->time(exec, title);
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    if (exec->argumentCount() < 1)
-        return throwVMError(exec, createNotEnoughArgumentsError(exec));
-
-    const String& title(valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)));
-    if (exec->hadException())
-        return JSValue::encode(jsUndefined());
-
-    client->timeEnd(exec, title);
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeStamp(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
-    client->timeStamp(exec, arguments.release());
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroup(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
-    client->group(exec, arguments.release());
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupCollapsed(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
-    client->groupCollapsed(exec, arguments.release());
-    return JSValue::encode(jsUndefined());
-}
-
-static EncodedJSValue JSC_HOST_CALL consoleProtoFuncGroupEnd(ExecState* exec)
-{
-    JSConsole* castedThis = jsDynamicCast<JSConsole*>(exec->thisValue());
-    if (!castedThis)
-        return throwVMTypeError(exec);
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
-    ConsoleClient* client = castedThis->globalObject()->consoleClient();
-    if (!client)
-        return JSValue::encode(jsUndefined());
-
-    RefPtr<Inspector::ScriptArguments> arguments(Inspector::createScriptArguments(exec, 0));
-    client->groupEnd(exec, arguments.release());
-    return JSValue::encode(jsUndefined());
-}
-
-}

Deleted: trunk/Source/_javascript_Core/runtime/ConsolePrototype.h (200349 => 200350)


--- trunk/Source/_javascript_Core/runtime/ConsolePrototype.h	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/runtime/ConsolePrototype.h	2016-05-03 00:51:24 UTC (rev 200350)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ConsolePrototype_h
-#define ConsolePrototype_h
-
-#include "JSObject.h"
-
-namespace JSC {
-
-class ConsolePrototype : public JSNonFinalObject {
-public:
-    typedef JSNonFinalObject Base;
-
-    DECLARE_INFO;
-
-    static ConsolePrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
-    {
-        ConsolePrototype* prototype = new (NotNull, allocateCell<ConsolePrototype>(vm.heap)) ConsolePrototype(vm, structure);
-        prototype->finishCreation(vm, globalObject);
-        return prototype;
-    }
-
-    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-    {
-        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-    }
-
-private:
-    ConsolePrototype(VM& vm, Structure* structure)
-        : Base(vm, structure)
-    {
-    }
-    void finishCreation(VM&, JSGlobalObject*);
-};
-
-}
-
-#endif // !defined(ConsolePrototype_h)

Deleted: trunk/Source/_javascript_Core/runtime/JSConsole.cpp (200349 => 200350)


--- trunk/Source/_javascript_Core/runtime/JSConsole.cpp	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/runtime/JSConsole.cpp	2016-05-03 00:51:24 UTC (rev 200350)
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSConsole.h"
-
-#include "JSCJSValueInlines.h"
-#include "StructureInlines.h"
-
-namespace JSC {
-
-const ClassInfo JSConsole::s_info = { "Console", &Base::s_info, 0, CREATE_METHOD_TABLE(JSConsole) };
-
-}

Deleted: trunk/Source/_javascript_Core/runtime/JSConsole.h (200349 => 200350)


--- trunk/Source/_javascript_Core/runtime/JSConsole.h	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/runtime/JSConsole.h	2016-05-03 00:51:24 UTC (rev 200350)
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef JSConsole_h
-#define JSConsole_h
-
-#include "JSObject.h"
-
-namespace JSC {
-
-class JSConsole : public JSNonFinalObject {
-public:
-    typedef JSNonFinalObject Base;
-
-    DECLARE_EXPORT_INFO;
-
-    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
-    {
-        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
-    }
-
-    static JSConsole* create(VM& vm, Structure* structure)
-    {
-        JSConsole* instance = new (NotNull, allocateCell<JSConsole>(vm.heap)) JSConsole(vm, structure);
-        instance->finishCreation(vm);
-        return instance;
-    }
-
-    static JSConsole* create(ExecState* exec, Structure* structure)
-    {
-        return create(exec->vm(), structure);
-    }
-
-private:
-    JSConsole(VM& vm, Structure* structure)
-        : Base(vm, structure)
-    {
-    }
-};
-
-}
-
-#endif // !defined(JSConsole_h)

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (200349 => 200350)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2016-05-03 00:51:24 UTC (rev 200350)
@@ -39,7 +39,7 @@
 #include "ClonedArguments.h"
 #include "CodeBlock.h"
 #include "CodeCache.h"
-#include "ConsolePrototype.h"
+#include "ConsoleObject.h"
 #include "DateConstructor.h"
 #include "DatePrototype.h"
 #include "Debugger.h"
@@ -70,7 +70,6 @@
 #include "JSCallbackConstructor.h"
 #include "JSCallbackFunction.h"
 #include "JSCallbackObject.h"
-#include "JSConsole.h"
 #include "JSDataView.h"
 #include "JSDataViewPrototype.h"
 #include "JSDollarVM.h"
@@ -498,6 +497,8 @@
     ReflectObject* reflectObject = ReflectObject::create(vm, this, ReflectObject::createStructure(vm, this, m_objectPrototype.get()));
     putDirectWithoutTransition(vm, vm.propertyNames->Reflect, reflectObject, DontEnum);
 
+    putDirectWithoutTransition(vm, vm.propertyNames->console, ConsoleObject::create(vm, this, ConsoleObject::createStructure(vm, this, m_objectPrototype.get())));
+
     JSTypedArrayViewConstructor* typedArraySuperConstructor = JSTypedArrayViewConstructor::create(vm, this, JSTypedArrayViewConstructor::createStructure(vm, this, m_functionPrototype.get()), typedArrayProto, speciesGetterSetter);
     typedArrayProto->putDirectWithoutTransition(vm, vm.propertyNames->constructor, typedArraySuperConstructor, DontEnum);
 
@@ -673,11 +674,6 @@
 
     m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::DefinePropertyFunction)] = m_definePropertyFunction.get();
 
-    ConsolePrototype* consolePrototype = ConsolePrototype::create(vm, this, ConsolePrototype::createStructure(vm, this, m_objectPrototype.get()));
-    m_consoleStructure.set(vm, this, JSConsole::createStructure(vm, this, consolePrototype));
-    JSConsole* consoleObject = JSConsole::create(vm, m_consoleStructure.get());
-    putDirectWithoutTransition(vm, Identifier::fromString(exec, "console"), consoleObject, DontEnum);
-
     if (UNLIKELY(Options::useDollarVM())) {
         JSDollarVMPrototype* dollarVMPrototype = JSDollarVMPrototype::create(vm, this, JSDollarVMPrototype::createStructure(vm, this, m_objectPrototype.get()));
         m_dollarVMStructure.set(vm, this, JSDollarVM::createStructure(vm, this, dollarVMPrototype));
@@ -1000,7 +996,6 @@
     visitor.append(&thisObject->m_regExpMatchesArraySlowPutStructure);
     visitor.append(&thisObject->m_moduleRecordStructure);
     visitor.append(&thisObject->m_moduleNamespaceObjectStructure);
-    visitor.append(&thisObject->m_consoleStructure);
     visitor.append(&thisObject->m_dollarVMStructure);
     visitor.append(&thisObject->m_internalFunctionStructure);
     visitor.append(&thisObject->m_proxyObjectStructure);

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (200349 => 200350)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2016-05-03 00:51:24 UTC (rev 200350)
@@ -281,7 +281,6 @@
     WriteBarrier<Structure> m_privateNameStructure;
     WriteBarrier<Structure> m_regExpStructure;
     WriteBarrier<Structure> m_generatorFunctionStructure;
-    WriteBarrier<Structure> m_consoleStructure;
     WriteBarrier<Structure> m_dollarVMStructure;
     WriteBarrier<Structure> m_internalFunctionStructure;
     WriteBarrier<Structure> m_iteratorResultObjectStructure;

Modified: trunk/Source/_javascript_Core/runtime/MathObject.cpp (200349 => 200350)


--- trunk/Source/_javascript_Core/runtime/MathObject.cpp	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/runtime/MathObject.cpp	2016-05-03 00:51:24 UTC (rev 200350)
@@ -69,10 +69,6 @@
 EncodedJSValue JSC_HOST_CALL mathProtoFuncTanh(ExecState*);
 EncodedJSValue JSC_HOST_CALL mathProtoFuncIMul(ExecState*);
 
-}
-
-namespace JSC {
-
 const ClassInfo MathObject::s_info = { "Math", &Base::s_info, 0, CREATE_METHOD_TABLE(MathObject) };
 
 MathObject::MathObject(VM& vm, Structure* structure)

Modified: trunk/Source/_javascript_Core/runtime/MathObject.h (200349 => 200350)


--- trunk/Source/_javascript_Core/runtime/MathObject.h	2016-05-03 00:11:00 UTC (rev 200349)
+++ trunk/Source/_javascript_Core/runtime/MathObject.h	2016-05-03 00:51:24 UTC (rev 200350)
@@ -31,7 +31,6 @@
 
 public:
     typedef JSNonFinalObject Base;
-    static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;
 
     static MathObject* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
     {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to