Title: [183935] trunk/Source/_javascript_Core
- Revision
- 183935
- Author
- [email protected]
- Date
- 2015-05-07 11:01:46 -0700 (Thu, 07 May 2015)
Log Message
Don't branch when accessing the callee
https://bugs.webkit.org/show_bug.cgi?id=144645
Reviewed by Michael Saboff.
The branch was added in <http://trac.webkit.org/changeset/81040> without
explanation.
kling found it to be a performance problem. See <https://webkit.org/b/144586>.
Our theory of access to Registers is that it's up to the client to access
them in the right way. So, let's do that.
* interpreter/CallFrame.h:
(JSC::ExecState::callee):
(JSC::ExecState::setCallee): Call the field object instead of function
because nothing guarantees that it's a function.
* interpreter/ProtoCallFrame.h:
(JSC::ProtoCallFrame::callee):
(JSC::ProtoCallFrame::setCallee):
* interpreter/Register.h:
* runtime/JSObject.h:
(JSC::Register::object): Just do a cast like our other accessors do.
(JSC::Register::operator=):
(JSC::Register::function): Deleted.
(JSC::Register::withCallee): Deleted.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (183934 => 183935)
--- trunk/Source/_javascript_Core/ChangeLog 2015-05-07 17:59:23 UTC (rev 183934)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-05-07 18:01:46 UTC (rev 183935)
@@ -1,3 +1,32 @@
+2015-05-05 Geoffrey Garen <[email protected]>
+
+ Don't branch when accessing the callee
+ https://bugs.webkit.org/show_bug.cgi?id=144645
+
+ Reviewed by Michael Saboff.
+
+ The branch was added in <http://trac.webkit.org/changeset/81040> without
+ explanation.
+
+ kling found it to be a performance problem. See <https://webkit.org/b/144586>.
+
+ Our theory of access to Registers is that it's up to the client to access
+ them in the right way. So, let's do that.
+
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::callee):
+ (JSC::ExecState::setCallee): Call the field object instead of function
+ because nothing guarantees that it's a function.
+ * interpreter/ProtoCallFrame.h:
+ (JSC::ProtoCallFrame::callee):
+ (JSC::ProtoCallFrame::setCallee):
+ * interpreter/Register.h:
+ * runtime/JSObject.h:
+ (JSC::Register::object): Just do a cast like our other accessors do.
+ (JSC::Register::operator=):
+ (JSC::Register::function): Deleted.
+ (JSC::Register::withCallee): Deleted.
+
2015-05-07 Dan Bernstein <[email protected]>
<rdar://problem/19317140> [Xcode] Remove usage of AspenFamily.xcconfig in Source/
Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.h (183934 => 183935)
--- trunk/Source/_javascript_Core/interpreter/CallFrame.h 2015-05-07 17:59:23 UTC (rev 183934)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.h 2015-05-07 18:01:46 UTC (rev 183935)
@@ -43,7 +43,7 @@
class ExecState : private Register {
public:
JSValue calleeAsValue() const { return this[JSStack::Callee].jsValue(); }
- JSObject* callee() const { return this[JSStack::Callee].function(); }
+ JSObject* callee() const { return this[JSStack::Callee].object(); }
CodeBlock* codeBlock() const { return this[JSStack::CodeBlock].Register::codeBlock(); }
JSScope* scope(int scopeRegisterOffset) const
{
@@ -259,7 +259,7 @@
static CallFrame* noCaller() { return 0; }
void setArgumentCountIncludingThis(int count) { static_cast<Register*>(this)[JSStack::ArgumentCount].payload() = count; }
- void setCallee(JSObject* callee) { static_cast<Register*>(this)[JSStack::Callee] = Register::withCallee(callee); }
+ void setCallee(JSObject* callee) { static_cast<Register*>(this)[JSStack::Callee] = callee; }
void setCodeBlock(CodeBlock* codeBlock) { static_cast<Register*>(this)[JSStack::CodeBlock] = codeBlock; }
void setReturnPC(void* value) { callerFrameAndPC().pc = reinterpret_cast<Instruction*>(value); }
Modified: trunk/Source/_javascript_Core/interpreter/ProtoCallFrame.h (183934 => 183935)
--- trunk/Source/_javascript_Core/interpreter/ProtoCallFrame.h 2015-05-07 17:59:23 UTC (rev 183934)
+++ trunk/Source/_javascript_Core/interpreter/ProtoCallFrame.h 2015-05-07 18:01:46 UTC (rev 183935)
@@ -44,8 +44,8 @@
CodeBlock* codeBlock() const { return codeBlockValue.Register::codeBlock(); }
void setCodeBlock(CodeBlock* codeBlock) { codeBlockValue = codeBlock; }
- JSObject* callee() const { return calleeValue.Register::function(); }
- void setCallee(JSObject* callee) { calleeValue = Register::withCallee(callee); }
+ JSObject* callee() const { return calleeValue.Register::object(); }
+ void setCallee(JSObject* callee) { calleeValue = callee; }
int argumentCountIncludingThis() const { return argCountAndCodeOriginValue.payload(); }
int argumentCount() const { return argumentCountIncludingThis() - 1; }
Modified: trunk/Source/_javascript_Core/interpreter/Register.h (183934 => 183935)
--- trunk/Source/_javascript_Core/interpreter/Register.h 2015-05-07 17:59:23 UTC (rev 183934)
+++ trunk/Source/_javascript_Core/interpreter/Register.h 2015-05-07 18:01:46 UTC (rev 183935)
@@ -56,12 +56,13 @@
Register& operator=(CallFrame*);
Register& operator=(CodeBlock*);
Register& operator=(JSScope*);
+ Register& operator=(JSObject*);
int32_t i() const;
JSLexicalEnvironment* lexicalEnvironment() const;
CallFrame* callFrame() const;
CodeBlock* codeBlock() const;
- JSObject* function() const;
+ JSObject* object() const;
JSScope* scope() const;
int32_t unboxedInt32() const;
int64_t unboxedInt52() const;
@@ -80,8 +81,6 @@
return r;
}
- static Register withCallee(JSObject* callee);
-
private:
union {
EncodedJSValue value;
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (183934 => 183935)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2015-05-07 17:59:23 UTC (rev 183934)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2015-05-07 18:01:46 UTC (rev 183935)
@@ -1452,18 +1452,15 @@
return methodTable()->defaultValue(this, exec, preferredType);
}
-ALWAYS_INLINE JSObject* Register::function() const
+ALWAYS_INLINE JSObject* Register::object() const
{
- if (!jsValue())
- return 0;
return asObject(jsValue());
}
-ALWAYS_INLINE Register Register::withCallee(JSObject* callee)
+ALWAYS_INLINE Register& Register::operator=(JSObject* object)
{
- Register r;
- r = JSValue(callee);
- return r;
+ u.value = JSValue::encode(JSValue(object));
+ return *this;
}
inline size_t offsetInButterfly(PropertyOffset offset)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes