<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[183790] trunk/Source/JavaScriptCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/183790">183790</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-04 20:35:13 -0700 (Mon, 04 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/183789">r183789</a>.
https://bugs.webkit.org/show_bug.cgi?id=144620
Causing flakiness on exceptionFuzz tests locally on 32-bit
build (Requested by saamyjoon on #webkit).
Reverted changeset:
"Global functions should be initialized as JSFunctions in byte
code"
https://bugs.webkit.org/show_bug.cgi?id=144178
http://trac.webkit.org/changeset/183789</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutablecpp">trunk/Source/JavaScriptCore/runtime/Executable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjecth">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (183789 => 183790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-05-05 03:27:09 UTC (rev 183789)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-05-05 03:35:13 UTC (rev 183790)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-05-04 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r183789.
+ https://bugs.webkit.org/show_bug.cgi?id=144620
+
+ Causing flakiness on exceptionFuzz tests locally on 32-bit
+ build (Requested by saamyjoon on #webkit).
+
+ Reverted changeset:
+
+ "Global functions should be initialized as JSFunctions in byte
+ code"
+ https://bugs.webkit.org/show_bug.cgi?id=144178
+ http://trac.webkit.org/changeset/183789
+
</ins><span class="cx"> 2015-05-04 Saam Barati <saambarati1@gmail.com>
</span><span class="cx">
</span><span class="cx"> Global functions should be initialized as JSFunctions in byte code
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp (183789 => 183790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2015-05-05 03:27:09 UTC (rev 183789)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2015-05-05 03:35:13 UTC (rev 183790)
</span><span class="lines">@@ -471,6 +471,8 @@
</span><span class="cx"> UnlinkedProgramCodeBlock* thisObject = jsCast<UnlinkedProgramCodeBlock*>(cell);
</span><span class="cx"> ASSERT_GC_OBJECT_INHERITS(thisObject, info());
</span><span class="cx"> Base::visitChildren(thisObject, visitor);
</span><ins>+ for (size_t i = 0, end = thisObject->m_functionDeclarations.size(); i != end; i++)
+ visitor.append(&thisObject->m_functionDeclarations[i].second);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> UnlinkedCodeBlock::~UnlinkedCodeBlock()
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h (183789 => 183790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2015-05-05 03:27:09 UTC (rev 183789)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2015-05-05 03:35:13 UTC (rev 183790)
</span><span class="lines">@@ -654,14 +654,21 @@
</span><span class="cx">
</span><span class="cx"> static void destroy(JSCell*);
</span><span class="cx">
</span><ins>+ void addFunctionDeclaration(VM& vm, const Identifier& name, UnlinkedFunctionExecutable* functionExecutable)
+ {
+ m_functionDeclarations.append(std::make_pair(name, WriteBarrier<UnlinkedFunctionExecutable>(vm, this, functionExecutable)));
+ }
+
</ins><span class="cx"> void addVariableDeclaration(const Identifier& name, bool isConstant)
</span><span class="cx"> {
</span><span class="cx"> m_varDeclarations.append(std::make_pair(name, isConstant));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> typedef Vector<std::pair<Identifier, bool>> VariableDeclations;
</span><ins>+ typedef Vector<std::pair<Identifier, WriteBarrier<UnlinkedFunctionExecutable>> > FunctionDeclations;
</ins><span class="cx">
</span><span class="cx"> const VariableDeclations& variableDeclarations() const { return m_varDeclarations; }
</span><ins>+ const FunctionDeclations& functionDeclarations() const { return m_functionDeclarations; }
</ins><span class="cx">
</span><span class="cx"> static void visitChildren(JSCell*, SlotVisitor&);
</span><span class="cx">
</span><span class="lines">@@ -672,6 +679,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> VariableDeclations m_varDeclarations;
</span><ins>+ FunctionDeclations m_functionDeclarations;
</ins><span class="cx">
</span><span class="cx"> public:
</span><span class="cx"> static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp (183789 => 183790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2015-05-05 03:27:09 UTC (rev 183789)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2015-05-05 03:35:13 UTC (rev 183790)
</span><span class="lines">@@ -77,17 +77,9 @@
</span><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> RefPtr<RegisterID> temp = newTemporary();
</span><del>- RefPtr<RegisterID> globalScope = scopeRegister(); // FIXME: With lexical scoping, this won't always be the global object: https://bugs.webkit.org/show_bug.cgi?id=142944
- for (auto functionPair : m_functionsToInitialize) {
- FunctionBodyNode* functionBody = functionPair.first;
- FunctionVariableType functionType = functionPair.second;
</del><ins>+ for (FunctionBodyNode* functionBody : m_functionsToInitialize) {
</ins><span class="cx"> emitNewFunction(temp.get(), functionBody);
</span><del>- if (functionType == NormalFunctionVariable)
- initializeVariable(variable(functionBody->ident()) , temp.get());
- else if (functionType == GlobalFunctionVariable)
- emitPutToScope(globalScope.get(), Variable(functionBody->ident()), temp.get(), ThrowIfNotFound);
- else
- RELEASE_ASSERT_NOT_REACHED();
</del><ins>+ initializeVariable(variable(functionBody->ident()), temp.get());
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -171,7 +163,8 @@
</span><span class="cx">
</span><span class="cx"> for (size_t i = 0; i < functionStack.size(); ++i) {
</span><span class="cx"> FunctionBodyNode* function = functionStack[i];
</span><del>- m_functionsToInitialize.append(std::make_pair(function, GlobalFunctionVariable));
</del><ins>+ UnlinkedFunctionExecutable* unlinkedFunction = makeFunction(function);
+ codeBlock->addFunctionDeclaration(*m_vm, function->ident(), unlinkedFunction);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (size_t i = 0; i < varStack.size(); ++i)
</span><span class="lines">@@ -391,7 +384,7 @@
</span><span class="cx"> for (FunctionBodyNode* function : functionNode->functionStack()) {
</span><span class="cx"> const Identifier& ident = function->ident();
</span><span class="cx"> createVariable(ident, varKind(ident.impl()), IsVariable);
</span><del>- m_functionsToInitialize.append(std::make_pair(function, NormalFunctionVariable));
</del><ins>+ m_functionsToInitialize.append(function);
</ins><span class="cx"> }
</span><span class="cx"> for (auto& entry : functionNode->varStack()) {
</span><span class="cx"> ConstantMode constantMode = modeForIsConstant(entry.second & DeclarationStacks::IsConstant);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h (183789 => 183790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2015-05-05 03:27:09 UTC (rev 183789)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2015-05-05 03:35:13 UTC (rev 183790)
</span><span class="lines">@@ -744,8 +744,7 @@
</span><span class="cx"> Vector<std::unique_ptr<ForInContext>> m_forInContextStack;
</span><span class="cx"> Vector<TryContext> m_tryContextStack;
</span><span class="cx"> Vector<std::pair<RefPtr<RegisterID>, const DeconstructionPatternNode*>> m_deconstructedParameters;
</span><del>- enum FunctionVariableType : uint8_t { NormalFunctionVariable, GlobalFunctionVariable };
- Vector<std::pair<FunctionBodyNode*, FunctionVariableType>> m_functionsToInitialize;
</del><ins>+ Vector<FunctionBodyNode*> m_functionsToInitialize;
</ins><span class="cx"> bool m_needToInitializeArguments { false };
</span><span class="cx">
</span><span class="cx"> Vector<TryRange> m_tryRanges;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (183789 => 183790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-05-05 03:27:09 UTC (rev 183789)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-05-05 03:35:13 UTC (rev 183790)
</span><span class="lines">@@ -510,11 +510,12 @@
</span><span class="cx"> BatchedTransitionOptimizer optimizer(vm, globalObject);
</span><span class="cx">
</span><span class="cx"> const UnlinkedProgramCodeBlock::VariableDeclations& variableDeclarations = unlinkedCodeBlock->variableDeclarations();
</span><ins>+ const UnlinkedProgramCodeBlock::FunctionDeclations& functionDeclarations = unlinkedCodeBlock->functionDeclarations();
</ins><span class="cx">
</span><del>- for (size_t i = 0, numberOfFunctions = unlinkedCodeBlock->numberOfFunctionDecls(); i < numberOfFunctions; ++i) {
- UnlinkedFunctionExecutable* unlinkedFunctionExecutable = unlinkedCodeBlock->functionDecl(i);
- ASSERT(!unlinkedFunctionExecutable->name().isEmpty());
- globalObject->addFunction(callFrame, unlinkedFunctionExecutable->name());
</del><ins>+ for (size_t i = 0; i < functionDeclarations.size(); ++i) {
+ UnlinkedFunctionExecutable* unlinkedFunctionExecutable = functionDeclarations[i].second.get();
+ JSValue value = JSFunction::create(vm, unlinkedFunctionExecutable->link(vm, m_source), scope);
+ globalObject->addFunction(callFrame, functionDeclarations[i].first, value);
</ins><span class="cx"> if (vm.typeProfiler() || vm.controlFlowProfiler()) {
</span><span class="cx"> vm.functionHasExecutedCache()->insertUnexecutedRange(sourceID(),
</span><span class="cx"> unlinkedFunctionExecutable->typeProfilingStartOffset(),
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (183789 => 183790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2015-05-05 03:27:09 UTC (rev 183789)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2015-05-05 03:35:13 UTC (rev 183790)
</span><span class="lines">@@ -502,12 +502,16 @@
</span><span class="cx"> return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void JSGlobalObject::addGlobalVar(const Identifier& ident, ConstantMode constantMode)
</del><ins>+JSGlobalObject::NewGlobalVar JSGlobalObject::addGlobalVar(const Identifier& ident, ConstantMode constantMode)
</ins><span class="cx"> {
</span><span class="cx"> ConcurrentJITLocker locker(symbolTable()->m_lock);
</span><span class="cx"> SymbolTableEntry entry = symbolTable()->get(locker, ident.impl());
</span><del>- if (!entry.isNull())
- return;
</del><ins>+ if (!entry.isNull()) {
+ NewGlobalVar result;
+ result.offset = entry.scopeOffset();
+ result.set = entry.watchpointSet();
+ return result;
+ }
</ins><span class="cx">
</span><span class="cx"> ScopeOffset offset = symbolTable()->takeNextScopeOffset(locker);
</span><span class="cx"> SymbolTableEntry newEntry(VarOffset(offset), (constantMode == IsConstant) ? ReadOnly : 0);
</span><span class="lines">@@ -519,13 +523,21 @@
</span><span class="cx">
</span><span class="cx"> ScopeOffset offsetForAssert = addVariables(1);
</span><span class="cx"> RELEASE_ASSERT(offsetForAssert == offset);
</span><ins>+
+ NewGlobalVar var;
+ var.offset = offset;
+ var.set = newEntry.watchpointSet();
+ return var;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void JSGlobalObject::addFunction(ExecState* exec, const Identifier& propertyName)
</del><ins>+void JSGlobalObject::addFunction(ExecState* exec, const Identifier& propertyName, JSValue value)
</ins><span class="cx"> {
</span><span class="cx"> VM& vm = exec->vm();
</span><span class="cx"> removeDirect(vm, propertyName); // Newly declared functions overwrite existing properties.
</span><del>- addGlobalVar(propertyName, IsVariable);
</del><ins>+ NewGlobalVar var = addGlobalVar(propertyName, IsVariable);
+ variableAt(var.offset).set(exec->vm(), this, value);
+ if (var.set)
+ var.set->touch(VariableWriteFireDetail(this, propertyName));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline JSObject* lastInPrototypeChain(JSObject* object)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h (183789 => 183790)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2015-05-05 03:27:09 UTC (rev 183789)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2015-05-05 03:35:13 UTC (rev 183790)
</span><span class="lines">@@ -338,7 +338,11 @@
</span><span class="cx"> setGlobalThis(vm, thisValue);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- void addGlobalVar(const Identifier&, ConstantMode);
</del><ins>+ struct NewGlobalVar {
+ ScopeOffset offset;
+ WatchpointSet* set;
+ };
+ NewGlobalVar addGlobalVar(const Identifier&, ConstantMode);
</ins><span class="cx">
</span><span class="cx"> public:
</span><span class="cx"> JS_EXPORT_PRIVATE ~JSGlobalObject();
</span><span class="lines">@@ -370,7 +374,7 @@
</span><span class="cx"> if (!hasProperty(exec, propertyName))
</span><span class="cx"> addGlobalVar(propertyName, IsConstant);
</span><span class="cx"> }
</span><del>- void addFunction(ExecState*, const Identifier&);
</del><ins>+ void addFunction(ExecState*, const Identifier&, JSValue);
</ins><span class="cx">
</span><span class="cx"> // The following accessors return pristine values, even if a script
</span><span class="cx"> // replaces the global object's associated property.
</span></span></pre>
</div>
</div>
</body>
</html>