[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:31:22 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit b1b21c549797b109c33f40933a4941e549d278a0
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 15 10:08:46 2002 +0000

    	Phase one of the "fixnum" optimization (storing small enough
    	integers in the pointer). This just paves the way for the change
    	by making all the virtual functions of ValueImp private and adding
    	non-virtual dispatchers which can call the virtual function or
    	handle fixnums specially.
    
    	Also, I marked every place that should need a special case with a
    	FIXNUM comment.
    
            * kjs/bool_object.cpp:
            (BooleanObjectImp::construct): Call dispatch method not the real method.
            * kjs/internal.h: Make toUInt32 private to make sure no one calls it directly
    	on a NumberImp*.
            * kjs/nodes.cpp:
            (ForInNode::execute): Call dispatch method not the real method.
            * kjs/object.cpp:
    	(ObjectImp::propList): Call dispatch method not the real method.
            * kjs/object.h:
            * kjs/string_object.cpp:
            (StringProtoFuncImp::call): Call dispatch method not the real method.
            (StringObjectImp::construct): Call dispatch method not the real method.
            * kjs/value.h:
            * kjs/value.cpp:
            (ValueImp::marked): Put a comment about required FIXNUM change.
            (ValueImp::setGcAllowed): Likewise.
            (ValueImp::dispatchType): Just call the virtual method for now.
            (ValueImp::dispatchToPrimitive): Likewise.
            (ValueImp::dispatchToBoolean): Likewise.
            (ValueImp::dispatchToNumber): Likewise.
            (ValueImp::dispatchToString): Likewise.
            (ValueImp::dispatchToObject): Likewise.
            (ValueImp::dispatchToUInt32): Likewise.
            (ValueImp::dispatchGetBase): Likewise.
            (ValueImp::dispatchGetPropertyName): Likewise.
            (ValueImp::dispatchGetValue): Likewise.
            (ValueImp::dispatchPutValue): Likewise.
            (ValueImp::dispatchDeleteValue): Likewise.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1824 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index d4d30b5..2d66890 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,43 @@
+2002-08-15  Maciej Stachowiak  <mjs at apple.com>
+
+	Phase one of the "fixnum" optimization (storing small enough
+	integers in the pointer). This just paves the way for the change
+	by making all the virtual functions of ValueImp private and adding
+	non-virtual dispatchers which can call the virtual function or
+	handle fixnums specially.
+
+	Also, I marked every place that should need a special case with a
+	FIXNUM comment.
+	
+        * kjs/bool_object.cpp:
+        (BooleanObjectImp::construct): Call dispatch method not the real method.
+        * kjs/internal.h: Make toUInt32 private to make sure no one calls it directly
+	on a NumberImp*.
+        * kjs/nodes.cpp:
+        (ForInNode::execute): Call dispatch method not the real method.
+        * kjs/object.cpp:
+	(ObjectImp::propList): Call dispatch method not the real method.
+        * kjs/object.h:
+        * kjs/string_object.cpp:
+        (StringProtoFuncImp::call): Call dispatch method not the real method.
+        (StringObjectImp::construct): Call dispatch method not the real method.
+        * kjs/value.h:
+        * kjs/value.cpp:
+        (ValueImp::marked): Put a comment about required FIXNUM change.
+        (ValueImp::setGcAllowed): Likewise.
+        (ValueImp::dispatchType): Just call the virtual method for now.
+        (ValueImp::dispatchToPrimitive): Likewise.
+        (ValueImp::dispatchToBoolean): Likewise.
+        (ValueImp::dispatchToNumber): Likewise.
+        (ValueImp::dispatchToString): Likewise.
+        (ValueImp::dispatchToObject): Likewise.
+        (ValueImp::dispatchToUInt32): Likewise.
+        (ValueImp::dispatchGetBase): Likewise.
+        (ValueImp::dispatchGetPropertyName): Likewise.
+        (ValueImp::dispatchGetValue): Likewise.
+        (ValueImp::dispatchPutValue): Likewise.
+        (ValueImp::dispatchDeleteValue): Likewise.
+
 2002-08-14  Darin Adler  <darin at apple.com>
 
 	Another pass of tweaks, including one bug fix.
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index d4d30b5..2d66890 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,3 +1,43 @@
+2002-08-15  Maciej Stachowiak  <mjs at apple.com>
+
+	Phase one of the "fixnum" optimization (storing small enough
+	integers in the pointer). This just paves the way for the change
+	by making all the virtual functions of ValueImp private and adding
+	non-virtual dispatchers which can call the virtual function or
+	handle fixnums specially.
+
+	Also, I marked every place that should need a special case with a
+	FIXNUM comment.
+	
+        * kjs/bool_object.cpp:
+        (BooleanObjectImp::construct): Call dispatch method not the real method.
+        * kjs/internal.h: Make toUInt32 private to make sure no one calls it directly
+	on a NumberImp*.
+        * kjs/nodes.cpp:
+        (ForInNode::execute): Call dispatch method not the real method.
+        * kjs/object.cpp:
+	(ObjectImp::propList): Call dispatch method not the real method.
+        * kjs/object.h:
+        * kjs/string_object.cpp:
+        (StringProtoFuncImp::call): Call dispatch method not the real method.
+        (StringObjectImp::construct): Call dispatch method not the real method.
+        * kjs/value.h:
+        * kjs/value.cpp:
+        (ValueImp::marked): Put a comment about required FIXNUM change.
+        (ValueImp::setGcAllowed): Likewise.
+        (ValueImp::dispatchType): Just call the virtual method for now.
+        (ValueImp::dispatchToPrimitive): Likewise.
+        (ValueImp::dispatchToBoolean): Likewise.
+        (ValueImp::dispatchToNumber): Likewise.
+        (ValueImp::dispatchToString): Likewise.
+        (ValueImp::dispatchToObject): Likewise.
+        (ValueImp::dispatchToUInt32): Likewise.
+        (ValueImp::dispatchGetBase): Likewise.
+        (ValueImp::dispatchGetPropertyName): Likewise.
+        (ValueImp::dispatchGetValue): Likewise.
+        (ValueImp::dispatchPutValue): Likewise.
+        (ValueImp::dispatchDeleteValue): Likewise.
+
 2002-08-14  Darin Adler  <darin at apple.com>
 
 	Another pass of tweaks, including one bug fix.
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index d4d30b5..2d66890 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,43 @@
+2002-08-15  Maciej Stachowiak  <mjs at apple.com>
+
+	Phase one of the "fixnum" optimization (storing small enough
+	integers in the pointer). This just paves the way for the change
+	by making all the virtual functions of ValueImp private and adding
+	non-virtual dispatchers which can call the virtual function or
+	handle fixnums specially.
+
+	Also, I marked every place that should need a special case with a
+	FIXNUM comment.
+	
+        * kjs/bool_object.cpp:
+        (BooleanObjectImp::construct): Call dispatch method not the real method.
+        * kjs/internal.h: Make toUInt32 private to make sure no one calls it directly
+	on a NumberImp*.
+        * kjs/nodes.cpp:
+        (ForInNode::execute): Call dispatch method not the real method.
+        * kjs/object.cpp:
+	(ObjectImp::propList): Call dispatch method not the real method.
+        * kjs/object.h:
+        * kjs/string_object.cpp:
+        (StringProtoFuncImp::call): Call dispatch method not the real method.
+        (StringObjectImp::construct): Call dispatch method not the real method.
+        * kjs/value.h:
+        * kjs/value.cpp:
+        (ValueImp::marked): Put a comment about required FIXNUM change.
+        (ValueImp::setGcAllowed): Likewise.
+        (ValueImp::dispatchType): Just call the virtual method for now.
+        (ValueImp::dispatchToPrimitive): Likewise.
+        (ValueImp::dispatchToBoolean): Likewise.
+        (ValueImp::dispatchToNumber): Likewise.
+        (ValueImp::dispatchToString): Likewise.
+        (ValueImp::dispatchToObject): Likewise.
+        (ValueImp::dispatchToUInt32): Likewise.
+        (ValueImp::dispatchGetBase): Likewise.
+        (ValueImp::dispatchGetPropertyName): Likewise.
+        (ValueImp::dispatchGetValue): Likewise.
+        (ValueImp::dispatchPutValue): Likewise.
+        (ValueImp::dispatchDeleteValue): Likewise.
+
 2002-08-14  Darin Adler  <darin at apple.com>
 
 	Another pass of tweaks, including one bug fix.
diff --git a/JavaScriptCore/kjs/bool_object.cpp b/JavaScriptCore/kjs/bool_object.cpp
index 607aeab..20c8c7b 100644
--- a/JavaScriptCore/kjs/bool_object.cpp
+++ b/JavaScriptCore/kjs/bool_object.cpp
@@ -124,7 +124,7 @@ Object BooleanObjectImp::construct(ExecState *exec, const List &args)
 
   Boolean b;
   if (args.size() > 0)
-    b = args.begin()->toBoolean(exec);
+    b = args.begin()->dispatchToBoolean(exec);
   else
     b = Boolean(false);
 
diff --git a/JavaScriptCore/kjs/internal.h b/JavaScriptCore/kjs/internal.h
index 22dc403..f2e92a1 100644
--- a/JavaScriptCore/kjs/internal.h
+++ b/JavaScriptCore/kjs/internal.h
@@ -130,9 +130,9 @@ namespace KJS {
     UString toString(ExecState *exec) const;
     Object toObject(ExecState *exec) const;
 
+  private:
     virtual bool toUInt32(unsigned&) const;
 
-  private:
     double val;
   };
 
diff --git a/JavaScriptCore/kjs/nodes.cpp b/JavaScriptCore/kjs/nodes.cpp
index f43a4a2..99e5b9e 100644
--- a/JavaScriptCore/kjs/nodes.cpp
+++ b/JavaScriptCore/kjs/nodes.cpp
@@ -2078,7 +2078,7 @@ Completion ForInNode::execute(ExecState *exec)
   ListIterator propIt = propList.begin();
 
   while (propIt != propList.end()) {
-    UString name = propIt->getPropertyName(exec);
+    UString name = propIt->dispatchGetPropertyName(exec);
     if (!v.hasProperty(exec,name)) {
       propIt++;
       continue;
diff --git a/JavaScriptCore/kjs/object.cpp b/JavaScriptCore/kjs/object.cpp
index a6ee57e..bd79c8d 100644
--- a/JavaScriptCore/kjs/object.cpp
+++ b/JavaScriptCore/kjs/object.cpp
@@ -406,7 +406,7 @@ void ObjectImp::setScope(const List &s)
 List ObjectImp::propList(ExecState *exec, bool recursive)
 {
   List list;
-  if (_proto && _proto->type() == ObjectType && recursive)
+  if (_proto && _proto->dispatchType() == ObjectType && recursive)
     list = static_cast<ObjectImp*>(_proto)->propList(exec,recursive);
 
 
diff --git a/JavaScriptCore/kjs/object.h b/JavaScriptCore/kjs/object.h
index c16c311..92a84b6 100644
--- a/JavaScriptCore/kjs/object.h
+++ b/JavaScriptCore/kjs/object.h
@@ -352,7 +352,7 @@ namespace KJS {
     void setInternalValue(const Value &v);
   };
 
-  inline Object Value::toObject(ExecState *exec) const { return rep->toObject(exec); }
+  inline Object Value::toObject(ExecState *exec) const { return rep->dispatchToObject(exec); }
   
   class ObjectImp : public ValueImp {
   public:
diff --git a/JavaScriptCore/kjs/string_object.cpp b/JavaScriptCore/kjs/string_object.cpp
index 52e3e5f..480c933 100644
--- a/JavaScriptCore/kjs/string_object.cpp
+++ b/JavaScriptCore/kjs/string_object.cpp
@@ -167,7 +167,7 @@ Value StringProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &arg
   case Concat: {
     ListIterator it = args.begin();
     for ( ; it != args.end() ; ++it) {
-        s += it->toString(exec);
+        s += it->dispatchToString(exec);
     }
     result = String(s);
     break;
@@ -520,7 +520,7 @@ Object StringObjectImp::construct(ExecState *exec, const List &args)
 
   UString s;
   if (args.size() > 0)
-    s = args.begin()->toString(exec);
+    s = args.begin()->dispatchToString(exec);
   else
     s = UString("");
 
diff --git a/JavaScriptCore/kjs/value.cpp b/JavaScriptCore/kjs/value.cpp
index cff7d3c..d4e04b5 100644
--- a/JavaScriptCore/kjs/value.cpp
+++ b/JavaScriptCore/kjs/value.cpp
@@ -63,11 +63,14 @@ void ValueImp::mark()
 
 bool ValueImp::marked() const
 {
+  // FIXNUM: need special case for fixnum, they should act as if
+  // always marked.
   return (_flags & VI_MARKED);
 }
 
 void ValueImp::setGcAllowed()
 {
+  // FIXNUM: need special case for fixnum, should be a no-op
   //fprintf(stderr,"ValueImp::setGcAllowed %p\n",(void*)this);
   _flags |= VI_GCALLOWED;
 }
@@ -171,6 +174,85 @@ bool ValueImp::deleteValue(ExecState *exec)
   return false;
 }
 
+
+// Dispatchers for virtual functions, to special-case fixnums which
+// won't be real pointers
+
+Type ValueImp::dispatchType() const
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->type();
+}
+
+Value ValueImp::dispatchToPrimitive(ExecState *exec, Type preferredType) const
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->toPrimitive(exec, preferredType);
+}
+
+bool ValueImp::dispatchToBoolean(ExecState *exec) const
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->toBoolean(exec);
+}
+
+double ValueImp::dispatchToNumber(ExecState *exec) const
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->toNumber(exec);
+}
+
+UString ValueImp::dispatchToString(ExecState *exec) const
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->toString(exec);
+}
+
+Object ValueImp::dispatchToObject(ExecState *exec) const
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->toObject(exec);
+}
+
+bool ValueImp::dispatchToUInt32(unsigned& result) const
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->toUInt32(result);
+}
+
+Value ValueImp::dispatchGetBase(ExecState *exec) const
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->getBase(exec);
+}
+
+UString ValueImp::dispatchGetPropertyName(ExecState *exec) const
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->getPropertyName(exec);
+}
+
+#if 0
+Value ValueImp::dispatchGetValue(ExecState *exec) const
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->getValue(exec);
+}
+#endif
+
+void ValueImp::dispatchPutValue(ExecState *exec, const Value& w)
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->putValue(exec, w);
+}
+
+bool ValueImp::dispatchDeleteValue(ExecState *exec)
+{
+  // FIXNUM: need special case for fixnums here 
+  return this->deleteValue(exec);
+}
+
+
 // ------------------------------ Value ----------------------------------------
 
 Value::Value(ValueImp *v)
@@ -289,18 +371,23 @@ String String::dynamicCast(const Value &v)
 
 // ------------------------------ Number ---------------------------------------
 
+// FIXNUM: need fixnum special case in below constructor
 Number::Number(int i)
   : Value(new NumberImp(static_cast<double>(i))) { }
 
+// FIXNUM: need fixnum special case in below constructor
 Number::Number(unsigned int u)
   : Value(new NumberImp(static_cast<double>(u))) { }
 
+// FIXNUM: need fixnum special case in below constructor
 Number::Number(double d)
   : Value(new NumberImp(d)) { }
 
+// FIXNUM: need fixnum special case in below constructor
 Number::Number(long int l)
   : Value(new NumberImp(static_cast<double>(l))) { }
 
+// FIXNUM: need fixnum special case in below constructor
 Number::Number(long unsigned int l)
   : Value(new NumberImp(static_cast<double>(l))) { }
 
diff --git a/JavaScriptCore/kjs/value.h b/JavaScriptCore/kjs/value.h
index f2aacd5..3972cb3 100644
--- a/JavaScriptCore/kjs/value.h
+++ b/JavaScriptCore/kjs/value.h
@@ -94,7 +94,9 @@ namespace KJS {
     ValueImp();
     virtual ~ValueImp();
 
+    // FIXNUM: need special case for fixnums below (should be no-op)
     inline ValueImp* ref() { refcount++; return this; }
+    // FIXNUM: need special case for fixnums below (should be no-op)
     inline bool deref() { return (!--refcount); }
     unsigned int refcount;
 
@@ -110,6 +112,27 @@ namespace KJS {
      */
     void setGcAllowed();
 
+    int toInteger(ExecState *exec) const;
+    int toInt32(ExecState *exec) const;
+    unsigned int toUInt32(ExecState *exec) const;
+    unsigned short toUInt16(ExecState *exec) const;
+
+    // Dispatch wrappers that handle the special fixnum case
+
+    Type dispatchType() const;
+    Value dispatchToPrimitive(ExecState *exec, Type preferredType = UnspecifiedType) const;
+    bool dispatchToBoolean(ExecState *exec) const;
+    double dispatchToNumber(ExecState *exec) const;
+    UString dispatchToString(ExecState *exec) const;
+    bool dispatchToUInt32(unsigned&) const;
+    Value dispatchGetBase(ExecState *exec) const;
+    UString dispatchGetPropertyName(ExecState *exec) const;
+    void dispatchPutValue(ExecState *exec, const Value& w);
+    bool dispatchDeleteValue(ExecState *exec);
+    Value dispatchGetValue(ExecState *exec) const;
+    Object dispatchToObject(ExecState *exec) const;
+
+  private:
     virtual Type type() const = 0;
 
     // The conversion operations
@@ -119,13 +142,7 @@ namespace KJS {
     virtual double toNumber(ExecState *exec) const = 0;
     virtual UString toString(ExecState *exec) const = 0;
     virtual Object toObject(ExecState *exec) const = 0;
-
     virtual bool toUInt32(unsigned&) const;
-    
-    int toInteger(ExecState *exec) const;
-    int toInt32(ExecState *exec) const;
-    unsigned int toUInt32(ExecState *exec) const;
-    unsigned short toUInt16(ExecState *exec) const;
 
     // Reference operations
 
@@ -134,8 +151,7 @@ namespace KJS {
     virtual Value getValue(ExecState *exec) const;
     virtual void putValue(ExecState *exec, const Value& w);
     virtual bool deleteValue(ExecState *exec);
-
-  private:
+    
     enum {
       VI_MARKED = 1,
       VI_GCALLOWED = 2,
@@ -184,7 +200,7 @@ namespace KJS {
      *
      * @return The type of value
      */
-    Type type() const { return rep->type(); }
+    Type type() const { return rep->dispatchType(); }
 
     /**
      * Checks whether or not the value is of a particular tpye
@@ -192,7 +208,7 @@ namespace KJS {
      * @param The type to compare with
      * @return true if the value is of the specified type, otherwise false
      */
-    bool isA(Type t) const { return rep->type() == t; }
+    bool isA(Type t) const { return rep->dispatchType() == t; }
 
     /**
      * Performs the ToPrimitive type conversion operation on this value
@@ -200,17 +216,17 @@ namespace KJS {
      */
     Value toPrimitive(ExecState *exec,
                       Type preferredType = UnspecifiedType) const
-      { return rep->toPrimitive(exec, preferredType); }
+      { return rep->dispatchToPrimitive(exec, preferredType); }
 
     /**
      * Performs the ToBoolean type conversion operation on this value (ECMA 9.2)
      */
-    bool toBoolean(ExecState *exec) const { return rep->toBoolean(exec); }
+    bool toBoolean(ExecState *exec) const { return rep->dispatchToBoolean(exec); }
 
     /**
      * Performs the ToNumber type conversion operation on this value (ECMA 9.3)
      */
-    double toNumber(ExecState *exec) const { return rep->toNumber(exec); }
+    double toNumber(ExecState *exec) const { return rep->dispatchToNumber(exec); }
 
     /**
      * Performs the ToInteger type conversion operation on this value (ECMA 9.4)
@@ -235,7 +251,7 @@ namespace KJS {
     /**
      * Performs the ToString type conversion operation on this value (ECMA 9.8)
      */
-    UString toString(ExecState *exec) const { return rep->toString(exec); }
+    UString toString(ExecState *exec) const { return rep->dispatchToString(exec); }
 
     /**
      * Performs the ToObject type conversion operation on this value (ECMA 9.9)
@@ -248,31 +264,31 @@ namespace KJS {
      * Since references are supposed to have an Object or null as their base,
      * this method is guaranteed to return either Null() or an Object value.
      */
-    Value getBase(ExecState *exec) const { return rep->getBase(exec); }
+    Value getBase(ExecState *exec) const { return rep->dispatchGetBase(exec); }
 
     /**
      * Performs the GetPropertyName type conversion operation on this value
      * (ECMA 8.7)
      */
-    UString getPropertyName(ExecState *exec) const { return rep->getPropertyName(exec); }
+    UString getPropertyName(ExecState *exec) const { return rep->dispatchGetPropertyName(exec); }
 
     /**
      * Performs the GetValue type conversion operation on this value
      * (ECMA 8.7.1)
      */
-    Value getValue(ExecState *exec) const { return rep->getValue(exec); }
+    Value getValue(ExecState *exec) const { return rep->dispatchGetValue(exec); }
 
     /**
      * Performs the PutValue type conversion operation on this value
      * (ECMA 8.7.1)
      */
-    void putValue(ExecState *exec, const Value &w) { rep->putValue(exec, w); }
-    bool deleteValue(ExecState *exec) { return rep->deleteValue(exec); }
+    void putValue(ExecState *exec, const Value &w) { rep->dispatchPutValue(exec, w); }
+    bool deleteValue(ExecState *exec) { return rep->dispatchDeleteValue(exec); }
 
     /**
      * Checks if we can do a lossless conversion to UInt32.
      */
-    bool toUInt32(unsigned& i) const { return rep->toUInt32(i); }
+    bool toUInt32(unsigned& i) const { return rep->dispatchToUInt32(i); }
 
   protected:
     ValueImp *rep;
@@ -412,6 +428,11 @@ namespace KJS {
     explicit Number(NumberImp *v);
   };
 
+  inline Value ValueImp::dispatchGetValue(ExecState *exec) const {
+    // FIXNUM: need special case for fixnums here 
+    return this->getValue(exec);
+  }
+
 }; // namespace
 
 #endif // _KJS_VALUE_H_

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list