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

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:04:47 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 0210a25271af7a217d06b9f8c1a53e78e66cb580
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 20 09:11:43 2002 +0000

    	- on the road to killing ActivationImp
    
            * kjs/function.h: Add get/put to FunctionImp. Remove argumentsObject() from
    	ActivationImp. Add function() to ActivationImp.
            * kjs/function.cpp:
            (FunctionImp::FunctionImp): No arguments property.
            (FunctionImp::call): No need to set up the arguments property.
            (FunctionImp::parameterString): Remove ** strangeness.
            (FunctionImp::processParameters): Ditto.
            (FunctionImp::get): Added, handles arguments and length properties.
            (FunctionImp::put): Ditto.
            (FunctionImp::hasProperty): Ditto.
            (FunctionImp::deleteProperty): Ditto.
            (ActivationImp::ActivationImp): Store a function pointer so we can find it
    	in the context.
    
            * kjs/function_object.cpp: (FunctionObjectImp::construct): No need to set up
    	arguments property.
            * kjs/nodes.cpp: (FuncExprNode::evaluate): No need to set up length property.
    
            * kjs/internal.h: Return ObjectImp * for activation object.
    
            * kjs/interpreter.h: Remove stray declaration of ExecStateImp.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2778 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index e60b399..e8b6bb1 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,31 @@
 2002-11-20  Darin Adler  <darin at apple.com>
 
+	- on the road to killing ActivationImp
+
+        * kjs/function.h: Add get/put to FunctionImp. Remove argumentsObject() from
+	ActivationImp. Add function() to ActivationImp.
+        * kjs/function.cpp:
+        (FunctionImp::FunctionImp): No arguments property.
+        (FunctionImp::call): No need to set up the arguments property.
+        (FunctionImp::parameterString): Remove ** strangeness.
+        (FunctionImp::processParameters): Ditto.
+        (FunctionImp::get): Added, handles arguments and length properties.
+        (FunctionImp::put): Ditto.
+        (FunctionImp::hasProperty): Ditto.
+        (FunctionImp::deleteProperty): Ditto.
+        (ActivationImp::ActivationImp): Store a function pointer so we can find it
+	in the context.
+
+        * kjs/function_object.cpp: (FunctionObjectImp::construct): No need to set up
+	arguments property.
+        * kjs/nodes.cpp: (FuncExprNode::evaluate): No need to set up length property.
+
+        * kjs/internal.h: Return ObjectImp * for activation object.
+
+        * kjs/interpreter.h: Remove stray declaration of ExecStateImp.
+
+2002-11-20  Darin Adler  <darin at apple.com>
+
 	- add a couple of list operations to avoid clearing lists so much during sorting; gives 1.5% iBench
 
         * kjs/types.h: Added replaceFirst/replaceLast.
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index e60b399..e8b6bb1 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,5 +1,31 @@
 2002-11-20  Darin Adler  <darin at apple.com>
 
+	- on the road to killing ActivationImp
+
+        * kjs/function.h: Add get/put to FunctionImp. Remove argumentsObject() from
+	ActivationImp. Add function() to ActivationImp.
+        * kjs/function.cpp:
+        (FunctionImp::FunctionImp): No arguments property.
+        (FunctionImp::call): No need to set up the arguments property.
+        (FunctionImp::parameterString): Remove ** strangeness.
+        (FunctionImp::processParameters): Ditto.
+        (FunctionImp::get): Added, handles arguments and length properties.
+        (FunctionImp::put): Ditto.
+        (FunctionImp::hasProperty): Ditto.
+        (FunctionImp::deleteProperty): Ditto.
+        (ActivationImp::ActivationImp): Store a function pointer so we can find it
+	in the context.
+
+        * kjs/function_object.cpp: (FunctionObjectImp::construct): No need to set up
+	arguments property.
+        * kjs/nodes.cpp: (FuncExprNode::evaluate): No need to set up length property.
+
+        * kjs/internal.h: Return ObjectImp * for activation object.
+
+        * kjs/interpreter.h: Remove stray declaration of ExecStateImp.
+
+2002-11-20  Darin Adler  <darin at apple.com>
+
 	- add a couple of list operations to avoid clearing lists so much during sorting; gives 1.5% iBench
 
         * kjs/types.h: Added replaceFirst/replaceLast.
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index e60b399..e8b6bb1 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,5 +1,31 @@
 2002-11-20  Darin Adler  <darin at apple.com>
 
+	- on the road to killing ActivationImp
+
+        * kjs/function.h: Add get/put to FunctionImp. Remove argumentsObject() from
+	ActivationImp. Add function() to ActivationImp.
+        * kjs/function.cpp:
+        (FunctionImp::FunctionImp): No arguments property.
+        (FunctionImp::call): No need to set up the arguments property.
+        (FunctionImp::parameterString): Remove ** strangeness.
+        (FunctionImp::processParameters): Ditto.
+        (FunctionImp::get): Added, handles arguments and length properties.
+        (FunctionImp::put): Ditto.
+        (FunctionImp::hasProperty): Ditto.
+        (FunctionImp::deleteProperty): Ditto.
+        (ActivationImp::ActivationImp): Store a function pointer so we can find it
+	in the context.
+
+        * kjs/function_object.cpp: (FunctionObjectImp::construct): No need to set up
+	arguments property.
+        * kjs/nodes.cpp: (FuncExprNode::evaluate): No need to set up length property.
+
+        * kjs/internal.h: Return ObjectImp * for activation object.
+
+        * kjs/interpreter.h: Remove stray declaration of ExecStateImp.
+
+2002-11-20  Darin Adler  <darin at apple.com>
+
 	- add a couple of list operations to avoid clearing lists so much during sorting; gives 1.5% iBench
 
         * kjs/types.h: Added replaceFirst/replaceLast.
diff --git a/JavaScriptCore/kjs/function.cpp b/JavaScriptCore/kjs/function.cpp
index b9a14dc..7d84185 100644
--- a/JavaScriptCore/kjs/function.cpp
+++ b/JavaScriptCore/kjs/function.cpp
@@ -57,9 +57,7 @@ FunctionImp::FunctionImp(ExecState *exec, const Identifier &n)
       static_cast<FunctionPrototypeImp*>(exec->interpreter()->builtinFunctionPrototype().imp())
       ), param(0L), ident(n)
 {
-  Value protect(this);
   //fprintf(stderr,"FunctionImp::FunctionImp this=%p\n");
-  put(exec,argumentsPropertyName,Null(),ReadOnly|DontDelete|DontEnum);
 }
 
 FunctionImp::~FunctionImp()
@@ -104,18 +102,6 @@ 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 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, argumentsPropertyName);
-
-  if (codeType() == FunctionCode) {
-    assert(ctx.activationObject().inherits(&ActivationImp::info));
-    Object argsObj = static_cast<ActivationImp*>(ctx.activationObject().imp())->argumentsObject();
-    put(&newExec, argumentsPropertyName, argsObj, DontDelete|DontEnum|ReadOnly);
-  }
-
   // assign user supplied arguments to parameters
   processParameters(&newExec, args);
   // add variable declarations (initialized to undefined)
@@ -126,8 +112,6 @@ Value FunctionImp::call(ExecState *exec, Object &thisObj, const List &args)
   // if an exception occured, propogate it back to the previous execution object
   if (newExec.hadException())
     exec->setException(newExec.exception());
-  if (codeType() == FunctionCode)
-    put(&newExec, argumentsPropertyName, oldArgs, DontDelete|DontEnum|ReadOnly);
 
 #ifdef KJS_VERBOSE
   if (comp.complType() == Throw)
@@ -169,12 +153,12 @@ void FunctionImp::addParameter(const Identifier &n)
 UString FunctionImp::parameterString() const
 {
   UString s;
-  const Parameter * const *p = &param;
-  while (*p) {
+  const Parameter *p = param;
+  while (p) {
     if (!s.isEmpty())
         s += ", ";
-    s += (*p)->name.ustring();
-    p = &(*p)->next;
+    s += p->name.ustring();
+    p = p->next;
   }
 
   return s;
@@ -194,18 +178,18 @@ void FunctionImp::processParameters(ExecState *exec, const List &args)
 
   if (param) {
     ListIterator it = args.begin();
-    Parameter **p = &param;
-    while (*p) {
+    Parameter *p = param;
+    while (p) {
       if (it != args.end()) {
 #ifdef KJS_VERBOSE
-	fprintf(stderr, "setting parameter %s ", (*p)->name.ascii());
+	fprintf(stderr, "setting parameter %s ", p->name.ascii());
 	printInfo(exec,"to", *it);
 #endif
-	variable.put(exec,(*p)->name, *it);
+	variable.put(exec, p->name, *it);
 	it++;
       } else
-	variable.put(exec,(*p)->name, Undefined());
-      p = &(*p)->next;
+	variable.put(exec, p->name, Undefined());
+      p = p->next;
     }
   }
 #ifdef KJS_VERBOSE
@@ -220,6 +204,55 @@ void FunctionImp::processVarDecls(ExecState */*exec*/)
 {
 }
 
+Value FunctionImp::get(ExecState *exec, const Identifier &propertyName) const
+{
+    // Find the arguments from the closest context.
+    if (propertyName == argumentsPropertyName) {
+        ContextImp *context = exec->_context;
+        while (context) {
+            ActivationImp *activation = static_cast<ActivationImp *>(context->activationObject());
+            if (activation->function() == this)
+                return activation->get(exec, propertyName);
+            context = context->callingContext();
+        }
+        return Undefined();
+    }
+    
+    // Compute length of parameters.
+    if (propertyName == lengthPropertyName) {
+        const Parameter * p = param;
+        int count = 0;
+        while (p) {
+            ++count;
+            p = p->next;
+        }
+        return Number(count);
+    }
+    
+    return InternalFunctionImp::get(exec, propertyName);
+}
+
+void FunctionImp::put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr)
+{
+    if (propertyName == argumentsPropertyName || propertyName == lengthPropertyName)
+        return;
+    InternalFunctionImp::put(exec, propertyName, value, attr);
+}
+
+bool FunctionImp::hasProperty(ExecState *exec, const Identifier &propertyName) const
+{
+    if (propertyName == argumentsPropertyName || propertyName == lengthPropertyName)
+        return true;
+    return InternalFunctionImp::hasProperty(exec, propertyName);
+}
+
+bool FunctionImp::deleteProperty(ExecState *exec, const Identifier &propertyName)
+{
+    if (propertyName == argumentsPropertyName || propertyName == lengthPropertyName)
+        return false;
+    return InternalFunctionImp::deleteProperty(exec, propertyName);
+}
+
 // ------------------------------ DeclaredFunctionImp --------------------------
 
 // ### is "Function" correct here?
@@ -304,7 +337,7 @@ const ClassInfo ActivationImp::info = {"Activation", 0, 0, 0};
 
 // ECMA 10.1.6
 ActivationImp::ActivationImp(ExecState *exec, FunctionImp *f, const List &args)
-  : ObjectImp()
+  : _function(f)
 {
   Value protect(this);
   arguments = new ArgumentsImp(exec,f, args);
diff --git a/JavaScriptCore/kjs/function.h b/JavaScriptCore/kjs/function.h
index c7f67d6..4895e62 100644
--- a/JavaScriptCore/kjs/function.h
+++ b/JavaScriptCore/kjs/function.h
@@ -39,6 +39,11 @@ namespace KJS {
     FunctionImp(ExecState *exec, const Identifier &n = Identifier::null);
     virtual ~FunctionImp();
 
+    virtual Value get(ExecState *exec, const Identifier &propertyName) const;
+    virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
+    virtual bool hasProperty(ExecState *exec, const Identifier &propertyName) const;
+    virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
+
     virtual void mark();
 
     virtual bool implementsCall() const;
@@ -98,11 +103,13 @@ namespace KJS {
     ActivationImp(ExecState *exec, FunctionImp *f, const List &args);
     ~ActivationImp();
 
-    Object argumentsObject() { return Object(arguments); }
-
     virtual const ClassInfo *classInfo() const { return &info; }
     static const ClassInfo info;
+    
+    FunctionImp *function() const { return _function; }
+    
   private:
+    FunctionImp *_function;
     ObjectImp* arguments;
   };
 
diff --git a/JavaScriptCore/kjs/function_object.cpp b/JavaScriptCore/kjs/function_object.cpp
index 9e75d86..24880fb 100644
--- a/JavaScriptCore/kjs/function_object.cpp
+++ b/JavaScriptCore/kjs/function_object.cpp
@@ -283,7 +283,6 @@ Object FunctionObjectImp::construct(ExecState *exec, const List &args)
   prototype.put(exec, constructorPropertyName,
 		Object(fimp), DontEnum|DontDelete|ReadOnly);
   fimp->put(exec,prototypePropertyName,prototype,DontEnum|DontDelete|ReadOnly);
-  fimp->put(exec,argumentsPropertyName,Null(),DontEnum|DontDelete|ReadOnly);
   return ret;
 }
 
diff --git a/JavaScriptCore/kjs/internal.h b/JavaScriptCore/kjs/internal.h
index 79281f5..1779ba1 100644
--- a/JavaScriptCore/kjs/internal.h
+++ b/JavaScriptCore/kjs/internal.h
@@ -196,7 +196,7 @@ namespace KJS {
     void setVariableObject(const Object &v) { variable = v; }
     Object thisValue() const { return thisVal; }
     ContextImp *callingContext() { return callingCon; }
-    Object activationObject() { return activation; }
+    ObjectImp *activationObject() { return activation.imp(); }
 
     void pushScope(const Object &s);
     void popScope();
diff --git a/JavaScriptCore/kjs/interpreter.h b/JavaScriptCore/kjs/interpreter.h
index 3d1ccf8..5243845 100644
--- a/JavaScriptCore/kjs/interpreter.h
+++ b/JavaScriptCore/kjs/interpreter.h
@@ -31,7 +31,6 @@
 namespace KJS {
 
   class ContextImp;
-  class ExecStateImp;
   class InterpreterImp;
 
   /**
diff --git a/JavaScriptCore/kjs/nodes.cpp b/JavaScriptCore/kjs/nodes.cpp
index f332c15..0992759 100644
--- a/JavaScriptCore/kjs/nodes.cpp
+++ b/JavaScriptCore/kjs/nodes.cpp
@@ -2830,7 +2830,6 @@ Value FuncExprNode::evaluate(ExecState *exec)
   int plen = 0;
   for(ParameterNode *p = param; p != 0L; p = p->nextParam(), plen++)
     fimp->addParameter(p->ident());
-  fimp->put(exec,lengthPropertyName, Number(plen), ReadOnly|DontDelete|DontEnum);
 
   return ret;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list