Title: [167137] trunk/Source/_javascript_Core
Revision
167137
Author
oli...@apple.com
Date
2014-04-11 11:39:22 -0700 (Fri, 11 Apr 2014)

Log Message

Add BuiltinLog function to make debugging builtins easier
https://bugs.webkit.org/show_bug.cgi?id=131550

Reviewed by Andreas Kling.

Add a logging function that builtins can use for debugging.

* runtime/CommonIdentifiers.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncBuiltinLog):
* runtime/JSGlobalObjectFunctions.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (167136 => 167137)


--- trunk/Source/_javascript_Core/ChangeLog	2014-04-11 18:23:31 UTC (rev 167136)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-04-11 18:39:22 UTC (rev 167137)
@@ -1,3 +1,19 @@
+2014-04-11  Oliver Hunt  <oli...@apple.com>
+
+        Add BuiltinLog function to make debugging builtins easier
+        https://bugs.webkit.org/show_bug.cgi?id=131550
+
+        Reviewed by Andreas Kling.
+
+        Add a logging function that builtins can use for debugging.
+
+        * runtime/CommonIdentifiers.h:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::reset):
+        * runtime/JSGlobalObjectFunctions.cpp:
+        (JSC::globalFuncBuiltinLog):
+        * runtime/JSGlobalObjectFunctions.h:
+
 2014-04-11  Julien Brianceau  <jbria...@cisco.com>
 
         Fix LLInt for sh4 architecture (broken since C stack merge).

Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (167136 => 167137)


--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2014-04-11 18:23:31 UTC (rev 167136)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2014-04-11 18:39:22 UTC (rev 167137)
@@ -225,7 +225,8 @@
     macro(boundFunction) \
     macro(boundFunctionLength) \
     macro(prototypeForHasInstance) \
-    macro(SetTypeErrorAccessor)
+    macro(SetTypeErrorAccessor) \
+    macro(BuiltinLog)
 
 namespace JSC {
     

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (167136 => 167137)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2014-04-11 18:23:31 UTC (rev 167136)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2014-04-11 18:39:22 UTC (rev 167137)
@@ -451,6 +451,7 @@
     }
     
     JSFunction* setTypeErrorAccessor = JSFunction::create(vm, this, 2, vm.propertyNames->emptyIdentifier.string(), globalFuncSetTypeErrorAccessor);
+    JSFunction* builtinLog = JSFunction::create(vm, this, 1, vm.propertyNames->emptyIdentifier.string(), globalFuncBuiltinLog);
     GlobalPropertyInfo staticGlobals[] = {
         GlobalPropertyInfo(vm.propertyNames->NaN, jsNaN(), DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->Infinity, jsNumber(std::numeric_limits<double>::infinity()), DontEnum | DontDelete | ReadOnly),
@@ -458,7 +459,8 @@
         GlobalPropertyInfo(vm.propertyNames->undefinedPrivateName, jsUndefined(), DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->ObjectPrivateName, objectConstructor, DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->TypeErrorPrivateName, m_typeErrorConstructor.get(), DontEnum | DontDelete | ReadOnly),
-        GlobalPropertyInfo(vm.propertyNames->SetTypeErrorAccessorPrivateName, setTypeErrorAccessor, DontEnum | DontDelete | ReadOnly)
+        GlobalPropertyInfo(vm.propertyNames->SetTypeErrorAccessorPrivateName, setTypeErrorAccessor, DontEnum | DontDelete | ReadOnly),
+        GlobalPropertyInfo(vm.propertyNames->BuiltinLogPrivateName, builtinLog, DontEnum | DontDelete | ReadOnly)
     };
     addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
     

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp (167136 => 167137)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp	2014-04-11 18:23:31 UTC (rev 167136)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp	2014-04-11 18:39:22 UTC (rev 167137)
@@ -821,4 +821,10 @@
     return JSValue::encode(jsUndefined());
 }
     
+EncodedJSValue JSC_HOST_CALL globalFuncBuiltinLog(ExecState* exec)
+{
+    dataLog(exec->argument(0).toWTFString(exec), "\n");
+    return JSValue::encode(jsUndefined());
+}
+
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h (167136 => 167137)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h	2014-04-11 18:23:31 UTC (rev 167136)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h	2014-04-11 18:39:22 UTC (rev 167137)
@@ -52,6 +52,7 @@
 EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState*);
 EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState*);
 EncodedJSValue JSC_HOST_CALL globalFuncSetTypeErrorAccessor(ExecState*);
+EncodedJSValue JSC_HOST_CALL globalFuncBuiltinLog(ExecState*);
     
 static const double mantissaOverflowLowerBound = 9007199254740992.0;
 double parseIntOverflow(const LChar*, unsigned length, int radix);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to