Bug 960513 - Ensure LazyScript has script set for non-lazy canonical functions. r=jandem
authorTill Schneidereit <till@tillschneidereit.net>
Sat, 01 Feb 2014 23:31:57 +0100
changeset 166535 05fd25b6979ef8019400cd2fd8f0385e713d8e76
parent 166534 30d4356308c79f88a8733b1e54609b7439a84f84
child 166536 dfad58dd98b640ba21974794a97a823c67805039
push id26128
push userphilringnalda@gmail.com
push dateSun, 02 Feb 2014 17:23:15 +0000
treeherderautoland@5f88d54c28e0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs960513
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 960513 - Ensure LazyScript has script set for non-lazy canonical functions. r=jandem
js/src/jsscriptinlines.h
--- a/js/src/jsscriptinlines.h
+++ b/js/src/jsscriptinlines.h
@@ -55,18 +55,23 @@ LazyScript::functionDelazifying(JSContex
 
 } // namespace js
 
 inline JSFunction *
 JSScript::functionDelazifying() const
 {
     js::AutoThreadSafeAccess ts(this);
     JS_ASSERT(js::CurrentThreadCanWriteCompilationData());
-    if (function_ && function_->isInterpretedLazy())
+    if (function_ && function_->isInterpretedLazy()) {
         function_->setUnlazifiedScript(const_cast<JSScript *>(this));
+        // If this script has a LazyScript, make sure the LazyScript has a
+        // reference to the script when delazifying its canonical function.
+        if (lazyScript && !lazyScript->maybeScript())
+            lazyScript->initScript(const_cast<JSScript *>(this));
+    }
     return function_;
 }
 
 inline void
 JSScript::setFunction(JSFunction *fun)
 {
     JS_ASSERT(fun->isTenured());
     function_ = fun;