Title: [226384] trunk/Source/_javascript_Core
Revision
226384
Author
msab...@apple.com
Date
2018-01-03 16:55:41 -0800 (Wed, 03 Jan 2018)

Log Message

Add "noInline" to $vm
https://bugs.webkit.org/show_bug.cgi?id=181265

Reviewed by Mark Lam.

This would be useful for web based tests.

* tools/JSDollarVM.cpp:
(JSC::getExecutableForFunction):
(JSC::functionNoInline):
(JSC::JSDollarVM::finishCreation):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (226383 => 226384)


--- trunk/Source/_javascript_Core/ChangeLog	2018-01-04 00:51:00 UTC (rev 226383)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-01-04 00:55:41 UTC (rev 226384)
@@ -1,5 +1,19 @@
 2018-01-03  Michael Saboff  <msab...@apple.com>
 
+        Add "noInline" to $vm
+        https://bugs.webkit.org/show_bug.cgi?id=181265
+
+        Reviewed by Mark Lam.
+
+        This would be useful for web based tests.
+
+        * tools/JSDollarVM.cpp:
+        (JSC::getExecutableForFunction):
+        (JSC::functionNoInline):
+        (JSC::JSDollarVM::finishCreation):
+
+2018-01-03  Michael Saboff  <msab...@apple.com>
+
         Remove unnecessary flushing of Butterfly pointer in functionCpuClflush()
         https://bugs.webkit.org/show_bug.cgi?id=181263
 

Modified: trunk/Source/_javascript_Core/tools/JSDollarVM.cpp (226383 => 226384)


--- trunk/Source/_javascript_Core/tools/JSDollarVM.cpp	2018-01-04 00:51:00 UTC (rev 226383)
+++ trunk/Source/_javascript_Core/tools/JSDollarVM.cpp	2018-01-04 00:55:41 UTC (rev 226384)
@@ -1159,6 +1159,22 @@
     mutable JITCode::JITType m_jitType;
 };
 
+static FunctionExecutable* getExecutableForFunction(JSValue theFunctionValue)
+{
+    if (!theFunctionValue.isCell())
+        return nullptr;
+    
+    VM& vm = *theFunctionValue.asCell()->vm();
+    JSFunction* theFunction = jsDynamicCast<JSFunction*>(vm, theFunctionValue);
+    if (!theFunction)
+        return nullptr;
+    
+    FunctionExecutable* executable = jsDynamicCast<FunctionExecutable*>(vm,
+        theFunction->executable());
+
+    return executable;
+}
+
 // Returns true if the current frame is a LLInt frame.
 // Usage: isLLInt = $vm.llintTrue()
 static EncodedJSValue JSC_HOST_CALL functionLLintTrue(ExecState* exec)
@@ -1181,6 +1197,23 @@
     return JSValue::encode(jsBoolean(functor.jitType() == JITCode::BaselineJIT));
 }
 
+// Set that the argument function should not be inlined.
+// Usage:
+// function f() { };
+// $vm.noInline(f);
+static EncodedJSValue JSC_HOST_CALL functionNoInline(ExecState* exec)
+{
+    if (exec->argumentCount() < 1)
+        return JSValue::encode(jsUndefined());
+    
+    JSValue theFunctionValue = exec->uncheckedArgument(0);
+
+    if (FunctionExecutable* executable = getExecutableForFunction(theFunctionValue))
+        executable->setNeverInline(true);
+    
+    return JSValue::encode(jsUndefined());
+}
+
 // Runs a full GC synchronously.
 // Usage: $vm.gc()
 static EncodedJSValue JSC_HOST_CALL functionGC(ExecState* exec)
@@ -1736,6 +1769,8 @@
     addFunction(vm, "llintTrue", functionLLintTrue, 0);
     addFunction(vm, "jitTrue", functionJITTrue, 0);
 
+    addFunction(vm, "noInline", functionNoInline, 1);
+
     addFunction(vm, "gc", functionGC, 0);
     addFunction(vm, "edenGC", functionEdenGC, 0);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to