- Revision
- 169005
- Author
- [email protected]
- Date
- 2014-05-17 20:44:23 -0700 (Sat, 17 May 2014)
Log Message
[ftlopt] InlineCallFrame::isCall should be an enumeration
https://bugs.webkit.org/show_bug.cgi?id=133034
Reviewed by Sam Weinig.
Once we start inlining getters and setters, we'll want InlineCallFrame to be able to tell
us that the inlined call was a getter call or a setter call. Initially I thought I would
have a new field called "kind" that would have components NormalCall, GetterCall, and
SetterCall. But that doesn't make sense, because for GetterCall and SetterCall, isCall
would have to be true. Hence, It makes more sense to have one enumeration that is Call,
Construct, GetterCall, or SetterCall. This patch is a first step towards this.
It's interesting that isClosureCall should probably still be separate, since getter and
setter inlining could inline closure calls.
* bytecode/CodeBlock.h:
(JSC::baselineCodeBlockForInlineCallFrame):
* bytecode/CodeOrigin.cpp:
(JSC::InlineCallFrame::dumpInContext):
(WTF::printInternal):
* bytecode/CodeOrigin.h:
(JSC::InlineCallFrame::kindFor):
(JSC::InlineCallFrame::specializationKindFor):
(JSC::InlineCallFrame::InlineCallFrame):
(JSC::InlineCallFrame::specializationKind):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
* dfg/DFGOSRExitPreparation.cpp:
(JSC::DFG::prepareCodeOriginForOSRExit):
* runtime/Arguments.h:
(JSC::Arguments::finishCreation):
Modified Paths
Diff
Modified: branches/ftlopt/Source/_javascript_Core/ChangeLog (169004 => 169005)
--- branches/ftlopt/Source/_javascript_Core/ChangeLog 2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/_javascript_Core/ChangeLog 2014-05-18 03:44:23 UTC (rev 169005)
@@ -1,3 +1,37 @@
+2014-05-17 Filip Pizlo <[email protected]>
+
+ [ftlopt] InlineCallFrame::isCall should be an enumeration
+ https://bugs.webkit.org/show_bug.cgi?id=133034
+
+ Reviewed by Sam Weinig.
+
+ Once we start inlining getters and setters, we'll want InlineCallFrame to be able to tell
+ us that the inlined call was a getter call or a setter call. Initially I thought I would
+ have a new field called "kind" that would have components NormalCall, GetterCall, and
+ SetterCall. But that doesn't make sense, because for GetterCall and SetterCall, isCall
+ would have to be true. Hence, It makes more sense to have one enumeration that is Call,
+ Construct, GetterCall, or SetterCall. This patch is a first step towards this.
+
+ It's interesting that isClosureCall should probably still be separate, since getter and
+ setter inlining could inline closure calls.
+
+ * bytecode/CodeBlock.h:
+ (JSC::baselineCodeBlockForInlineCallFrame):
+ * bytecode/CodeOrigin.cpp:
+ (JSC::InlineCallFrame::dumpInContext):
+ (WTF::printInternal):
+ * bytecode/CodeOrigin.h:
+ (JSC::InlineCallFrame::kindFor):
+ (JSC::InlineCallFrame::specializationKindFor):
+ (JSC::InlineCallFrame::InlineCallFrame):
+ (JSC::InlineCallFrame::specializationKind):
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
+ * dfg/DFGOSRExitPreparation.cpp:
+ (JSC::DFG::prepareCodeOriginForOSRExit):
+ * runtime/Arguments.h:
+ (JSC::Arguments::finishCreation):
+
2014-05-13 Filip Pizlo <[email protected]>
[ftlopt] DFG should not exit due to inadequate profiling coverage when it can trivially fill in the profiling coverage due to variable constant inference and the better prediction modeling of typed array GetByVals
Modified: branches/ftlopt/Source/_javascript_Core/bytecode/CodeBlock.h (169004 => 169005)
--- branches/ftlopt/Source/_javascript_Core/bytecode/CodeBlock.h 2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/_javascript_Core/bytecode/CodeBlock.h 2014-05-18 03:44:23 UTC (rev 169005)
@@ -1195,7 +1195,7 @@
RELEASE_ASSERT(inlineCallFrame);
ExecutableBase* executable = inlineCallFrame->executable.get();
RELEASE_ASSERT(executable->structure()->classInfo() == FunctionExecutable::info());
- return static_cast<FunctionExecutable*>(executable)->baselineCodeBlockFor(inlineCallFrame->isCall ? CodeForCall : CodeForConstruct);
+ return static_cast<FunctionExecutable*>(executable)->baselineCodeBlockFor(inlineCallFrame->specializationKind());
}
inline CodeBlock* baselineCodeBlockForOriginAndBaselineCodeBlock(const CodeOrigin& codeOrigin, CodeBlock* baselineCodeBlock)
Modified: branches/ftlopt/Source/_javascript_Core/bytecode/CodeOrigin.cpp (169004 => 169005)
--- branches/ftlopt/Source/_javascript_Core/bytecode/CodeOrigin.cpp 2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/_javascript_Core/bytecode/CodeOrigin.cpp 2014-05-18 03:44:23 UTC (rev 169005)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013, 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
@@ -178,7 +178,7 @@
out.print(briefFunctionInformation(), ":<", RawPointer(executable.get()));
if (executable->isStrictMode())
out.print(" (StrictMode)");
- out.print(", bc#", caller.bytecodeIndex, ", ", specializationKind());
+ out.print(", bc#", caller.bytecodeIndex, ", ", kind);
if (isClosureCall)
out.print(", closure call");
else
@@ -195,3 +195,20 @@
} // namespace JSC
+namespace WTF {
+
+void printInternal(PrintStream& out, JSC::InlineCallFrame::Kind kind)
+{
+ switch (kind) {
+ case JSC::InlineCallFrame::Call:
+ out.print("Call");
+ return;
+ case JSC::InlineCallFrame::Construct:
+ out.print("Construct");
+ return;
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+}
+
+} // namespace WTF
+
Modified: branches/ftlopt/Source/_javascript_Core/bytecode/CodeOrigin.h (169004 => 169005)
--- branches/ftlopt/Source/_javascript_Core/bytecode/CodeOrigin.h 2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/_javascript_Core/bytecode/CodeOrigin.h 2014-05-18 03:44:23 UTC (rev 169005)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012, 2013, 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
@@ -118,13 +118,42 @@
};
struct InlineCallFrame {
+ enum Kind {
+ Call,
+ Construct,
+ };
+
+ static Kind kindFor(CodeSpecializationKind kind)
+ {
+ switch (kind) {
+ case CodeForCall:
+ return Call;
+ case CodeForConstruct:
+ return Construct;
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ return Call;
+ }
+
+ static CodeSpecializationKind specializationKindFor(Kind kind)
+ {
+ switch (kind) {
+ case Call:
+ return CodeForCall;
+ case Construct:
+ return CodeForConstruct;
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ return CodeForCall;
+ }
+
Vector<ValueRecovery> arguments; // Includes 'this'.
WriteBarrier<ScriptExecutable> executable;
ValueRecovery calleeRecovery;
CodeOrigin caller;
BitVector capturedVars; // Indexed by the machine call frame's variable numbering.
signed stackOffset : 30;
- bool isCall : 1;
+ Kind kind : 1;
bool isClosureCall : 1; // If false then we know that callee/scope are constants and the DFG won't treat them as variables, i.e. they have to be recovered manually.
VirtualRegister argumentsRegister; // This is only set if the code uses arguments. The unmodified arguments register follows the unmodifiedArgumentsRegister() convention (see CodeBlock.h).
@@ -133,12 +162,12 @@
// we forgot to initialize explicitly.
InlineCallFrame()
: stackOffset(0)
- , isCall(false)
+ , kind(Call)
, isClosureCall(false)
{
}
- CodeSpecializationKind specializationKind() const { return specializationFromIsCall(isCall); }
+ CodeSpecializationKind specializationKind() const { return specializationKindFor(kind); }
JSFunction* calleeConstant() const
{
@@ -209,6 +238,8 @@
namespace WTF {
+void printInternal(PrintStream&, JSC::InlineCallFrame::Kind);
+
template<typename T> struct DefaultHash;
template<> struct DefaultHash<JSC::CodeOrigin> {
typedef JSC::CodeOriginHash Hash;
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (169004 => 169005)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2014-05-18 03:44:23 UTC (rev 169005)
@@ -3435,7 +3435,7 @@
m_inlineCallFrame->isClosureCall = true;
m_inlineCallFrame->caller = byteCodeParser->currentCodeOrigin();
m_inlineCallFrame->arguments.resize(argumentCountIncludingThis); // Set the number of arguments including this, but don't configure the value recoveries, yet.
- m_inlineCallFrame->isCall = isCall(kind);
+ m_inlineCallFrame->kind = InlineCallFrame::kindFor(kind);
if (m_inlineCallFrame->caller.inlineCallFrame)
m_inlineCallFrame->capturedVars = m_inlineCallFrame->caller.inlineCallFrame->capturedVars;
Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGOSRExitPreparation.cpp (169004 => 169005)
--- branches/ftlopt/Source/_javascript_Core/dfg/DFGOSRExitPreparation.cpp 2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGOSRExitPreparation.cpp 2014-05-18 03:44:23 UTC (rev 169005)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 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
@@ -45,7 +45,7 @@
FunctionExecutable* executable =
static_cast<FunctionExecutable*>(codeOrigin.inlineCallFrame->executable.get());
CodeBlock* codeBlock = executable->baselineCodeBlockFor(
- codeOrigin.inlineCallFrame->isCall ? CodeForCall : CodeForConstruct);
+ codeOrigin.inlineCallFrame->specializationKind());
if (codeBlock->jitType() == JSC::JITCode::BaselineJIT)
continue;
Modified: branches/ftlopt/Source/_javascript_Core/runtime/Arguments.h (169004 => 169005)
--- branches/ftlopt/Source/_javascript_Core/runtime/Arguments.h 2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/_javascript_Core/runtime/Arguments.h 2014-05-18 03:44:23 UTC (rev 169005)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999-2000 Harri Porten ([email protected])
- * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2014 Apple Inc. All rights reserved.
* Copyright (C) 2007 Cameron Zwarich ([email protected])
* Copyright (C) 2007 Maks Orlovich
*
@@ -321,7 +321,7 @@
m_overrodeCallee = false;
m_overrodeCaller = false;
m_isStrictMode = jsCast<FunctionExecutable*>(inlineCallFrame->executable.get())->isStrictMode();
- ASSERT(!jsCast<FunctionExecutable*>(inlineCallFrame->executable.get())->symbolTable(inlineCallFrame->isCall ? CodeForCall : CodeForConstruct)->slowArguments());
+ ASSERT(!jsCast<FunctionExecutable*>(inlineCallFrame->executable.get())->symbolTable(inlineCallFrame->specializationKind())->slowArguments());
// The bytecode generator omits op_tear_off_activation in cases of no
// declared parameters, so we need to tear off immediately.