[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:32:36 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 9812e8a7a309ea58a7bc9930bccc0d539cfc56b5
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 19 08:54:20 2002 +0000

    	Maintain stack of old "arguments" property values for functions
    	implicitly on the system stack instead of explicitly in the
    	FunctionImp. This eliminates only a trivial number of GC
    	allocations (less than 200) but eliminates one of the two cases
    	where a ListImp * is stored directly, paving the way to separate
    	List from Value.
    
            * kjs/function.h: Remove argStack, pushArgs and popArgs.
            * kjs/function.cpp:
            (FunctionImp::FunctionImp): Don't initalize argStack.
            (FunctionImp::~FunctionImp): Remove comment about argStack.
            (FunctionImp::mark): Don't mark the argStack.
            (FunctionImp::call): Save old "arguments" property in a Value,
    	where it will be GC-protected, rather than keeping a list, and
    	restore the old value when done executing.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1864 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 4d21171..c1b1dc0 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,21 @@
+2002-08-19  Maciej Stachowiak  <mjs at apple.com>
+
+	Maintain stack of old "arguments" property values for functions
+	implicitly on the system stack instead of explicitly in the
+	FunctionImp. This eliminates only a trivial number of GC
+	allocations (less than 200) but eliminates one of the two cases
+	where a ListImp * is stored directly, paving the way to separate
+	List from Value.
+	
+        * kjs/function.h: Remove argStack, pushArgs and popArgs.
+        * kjs/function.cpp:
+        (FunctionImp::FunctionImp): Don't initalize argStack.
+        (FunctionImp::~FunctionImp): Remove comment about argStack.
+        (FunctionImp::mark): Don't mark the argStack.
+        (FunctionImp::call): Save old "arguments" property in a Value,
+	where it will be GC-protected, rather than keeping a list, and
+	restore the old value when done executing.
+
 2002-08-18  Darin Adler  <darin at apple.com>
 
         * kjs/internal.cpp: (KJS::printInfo): Remove one more CompletionType
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index 4d21171..c1b1dc0 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,3 +1,21 @@
+2002-08-19  Maciej Stachowiak  <mjs at apple.com>
+
+	Maintain stack of old "arguments" property values for functions
+	implicitly on the system stack instead of explicitly in the
+	FunctionImp. This eliminates only a trivial number of GC
+	allocations (less than 200) but eliminates one of the two cases
+	where a ListImp * is stored directly, paving the way to separate
+	List from Value.
+	
+        * kjs/function.h: Remove argStack, pushArgs and popArgs.
+        * kjs/function.cpp:
+        (FunctionImp::FunctionImp): Don't initalize argStack.
+        (FunctionImp::~FunctionImp): Remove comment about argStack.
+        (FunctionImp::mark): Don't mark the argStack.
+        (FunctionImp::call): Save old "arguments" property in a Value,
+	where it will be GC-protected, rather than keeping a list, and
+	restore the old value when done executing.
+
 2002-08-18  Darin Adler  <darin at apple.com>
 
         * kjs/internal.cpp: (KJS::printInfo): Remove one more CompletionType
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 4d21171..c1b1dc0 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,21 @@
+2002-08-19  Maciej Stachowiak  <mjs at apple.com>
+
+	Maintain stack of old "arguments" property values for functions
+	implicitly on the system stack instead of explicitly in the
+	FunctionImp. This eliminates only a trivial number of GC
+	allocations (less than 200) but eliminates one of the two cases
+	where a ListImp * is stored directly, paving the way to separate
+	List from Value.
+	
+        * kjs/function.h: Remove argStack, pushArgs and popArgs.
+        * kjs/function.cpp:
+        (FunctionImp::FunctionImp): Don't initalize argStack.
+        (FunctionImp::~FunctionImp): Remove comment about argStack.
+        (FunctionImp::mark): Don't mark the argStack.
+        (FunctionImp::call): Save old "arguments" property in a Value,
+	where it will be GC-protected, rather than keeping a list, and
+	restore the old value when done executing.
+
 2002-08-18  Darin Adler  <darin at apple.com>
 
         * kjs/internal.cpp: (KJS::printInfo): Remove one more CompletionType
diff --git a/JavaScriptCore/kjs/function.cpp b/JavaScriptCore/kjs/function.cpp
index a49e42d..771d65a 100644
--- a/JavaScriptCore/kjs/function.cpp
+++ b/JavaScriptCore/kjs/function.cpp
@@ -55,31 +55,21 @@ namespace KJS {
 FunctionImp::FunctionImp(ExecState *exec, const UString &n)
   : InternalFunctionImp(
       static_cast<FunctionPrototypeImp*>(exec->interpreter()->builtinFunctionPrototype().imp())
-      ), param(0L), ident(n), argStack(0)
+      ), param(0L), ident(n)
 {
   Value protect(this);
-  argStack = new ListImp();
-  Value protectArgStack( argStack ); // this also calls setGcAllowed on argStack
-  //fprintf(stderr,"FunctionImp::FunctionImp this=%p argStack=%p\n");
+  //fprintf(stderr,"FunctionImp::FunctionImp this=%p\n");
   put(exec,"arguments",Null(),ReadOnly|DontDelete|DontEnum);
 }
 
 FunctionImp::~FunctionImp()
 {
-  // The function shouldn't be deleted while it is still executed; argStack
-  // should be set to 0 by the last call to popArgs()
-  //assert(argStack->isEmpty());
-  // Accessing argStack from here is a problem though.
-  // When the function isn't used anymore, it's not marked, and neither is the
-  // argStack, so both can be deleted - in any order!
   delete param;
 }
 
 void FunctionImp::mark()
 {
   InternalFunctionImp::mark();
-  if (argStack && !argStack->marked())
-    argStack->mark();
 }
 
 bool FunctionImp::implementsCall() const
@@ -114,15 +104,16 @@ Value FunctionImp::call(ExecState *exec, Object &thisObj, const List &args)
   ExecState newExec(exec->interpreter(), &ctx);
   newExec.setException(exec->exception()); // could be null
 
-  // In order to maintain our "arguments" property, we maintain a list of arguments
-  // properties from earlier in the execution stack. Upon return, we restore the
-  // previous arguments object using popArgs().
+  // In order to maintain our "arguments" property, we save the old
+  // value from a possible earlier call. Upon return, we restore the
+  // previous arguments object.
   // Note: this does not appear to be part of the spec
+  Value oldArgs = get(&newExec, "arguments");
+
   if (codeType() == FunctionCode) {
     assert(ctx.activationObject().inherits(&ActivationImp::info));
     Object argsObj = static_cast<ActivationImp*>(ctx.activationObject().imp())->argumentsObject();
     put(&newExec, "arguments", argsObj, DontDelete|DontEnum|ReadOnly);
-    pushArgs(&newExec, argsObj);
   }
 
   // assign user supplied arguments to parameters
@@ -136,7 +127,7 @@ Value FunctionImp::call(ExecState *exec, Object &thisObj, const List &args)
   if (newExec.hadException())
     exec->setException(newExec.exception());
   if (codeType() == FunctionCode)
-    popArgs(&newExec);
+    put(&newExec, "arguments", oldArgs, DontDelete|DontEnum|ReadOnly);
 
 #ifdef KJS_VERBOSE
   if (comp.complType() == Throw)
@@ -229,22 +220,6 @@ void FunctionImp::processVarDecls(ExecState */*exec*/)
 {
 }
 
-void FunctionImp::pushArgs(ExecState *exec, const Object &args)
-{
-  argStack->append(args);
-  put(exec,"arguments",args,ReadOnly|DontDelete|DontEnum);
-}
-
-void FunctionImp::popArgs(ExecState *exec)
-{
-  argStack->removeLast();
-  if (argStack->isEmpty()) {
-    put(exec,"arguments",Null(),ReadOnly|DontDelete|DontEnum);
-  }
-  else
-    put(exec,"arguments",argStack->at(argStack->size()-1),ReadOnly|DontDelete|DontEnum);
-}
-
 // ------------------------------ DeclaredFunctionImp --------------------------
 
 // ### is "Function" correct here?
diff --git a/JavaScriptCore/kjs/function.h b/JavaScriptCore/kjs/function.h
index 6602b18..15cf3c5 100644
--- a/JavaScriptCore/kjs/function.h
+++ b/JavaScriptCore/kjs/function.h
@@ -61,10 +61,6 @@ namespace KJS {
   private:
     void processParameters(ExecState *exec, const List &);
     virtual void processVarDecls(ExecState *exec);
-
-    void pushArgs(ExecState *exec, const Object &args);
-    void popArgs(ExecState *exec);
-    ListImp *argStack;
   };
 
   class DeclaredFunctionImp : public FunctionImp {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list