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


The following commit has been merged in the debian/unstable branch:
commit a3e1b2189a8fb67f9e0d205b2fdf164d76b23d8c
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 16 19:07:48 2002 +0000

    	Final step of the Reference change. Completely separate Reference
    	from Value, and eliminate ReferenceImp.
    
    	18% speedup on cvs-js-performance test.
    
            * kjs/internal.cpp, kjs/internal.h: Remove ReferenceImp.
            * kjs/nodes.cpp:
            (Node::evaluateReference): Use Reference::makeValueReference(),
    	not ConstReference.
            * kjs/reference.cpp:
            (Reference::Reference): New implementation, handles both regular
    	and value references.
            (Reference::makeValueReference): Incorporate functionality of ConstReference
    	into this class.
            (Reference::getBase): New implementation (incorporates error vase
    	for value references).
    	(Reference::getPropertyName): New implementation (incorporates error case
    	for value references).
            (Reference::putValue): New implementation (incorporates error case
    	for value references).
            (Reference::deleteValue): New implementation (incorporates error case
    	for value references).
            (Reference::getValue): New implementation (incorporates special case
    	for value references).
            (Reference::isMutable): New implementation.
    	* kjs/reference.h: New implementation that merges ReferenceImp
    	into the stack object.
            * kjs/value.h, kjs/value.cpp: Removed all reference-related method.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1850 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 71bbf2f..4d14079 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,34 @@
+2002-08-16  Maciej Stachowiak  <mjs at apple.com>
+
+	Final step of the Reference change. Completely separate Reference
+	from Value, and eliminate ReferenceImp.
+
+	18% speedup on cvs-js-performance test.
+
+        * kjs/internal.cpp, kjs/internal.h: Remove ReferenceImp.
+        * kjs/nodes.cpp:
+        (Node::evaluateReference): Use Reference::makeValueReference(),
+	not ConstReference.
+        * kjs/reference.cpp:
+        (Reference::Reference): New implementation, handles both regular
+	and value references.
+        (Reference::makeValueReference): Incorporate functionality of ConstReference
+	into this class.
+        (Reference::getBase): New implementation (incorporates error vase
+	for value references).
+	(Reference::getPropertyName): New implementation (incorporates error case
+	for value references).
+        (Reference::putValue): New implementation (incorporates error case
+	for value references).
+        (Reference::deleteValue): New implementation (incorporates error case
+	for value references).
+        (Reference::getValue): New implementation (incorporates special case
+	for value references).
+        (Reference::isMutable): New implementation.
+	* kjs/reference.h: New implementation that merges ReferenceImp
+	into the stack object.
+        * kjs/value.h, kjs/value.cpp: Removed all reference-related method.
+
 2002-08-16  Darin Adler  <darin at apple.com>
 
 	- fixed 3026184 -- Hang going to http://aa.com/ while executing JavaScript
@@ -18,6 +49,28 @@
 
 2002-08-16  Maciej Stachowiak  <mjs at apple.com>
 
+        * JavaScriptCore.pbproj/project.pbxproj:
+        * kjs/internal.cpp:
+        * kjs/internal.h:
+        * kjs/nodes.cpp:
+        (Node::evaluateReference):
+        * kjs/reference.cpp:
+        (Reference::Reference):
+        (Reference::makeValueReference):
+        (Reference::getBase):
+        (Reference::getPropertyName):
+        (Reference::getValue):
+        (Reference::putValue):
+        (Reference::deleteValue):
+        (Reference::isMutable):
+        * kjs/reference.h:
+        * kjs/reference_list.h:
+        * kjs/value.cpp:
+        (ValueImp::dispatchToUInt32):
+        * kjs/value.h:
+
+2002-08-16  Maciej Stachowiak  <mjs at apple.com>
+
 	Next step: reimplement ReferenceList from scratch, and store it as
 	an actual Reference object, so ReferenceList no longer depends on
 	Reference being a Value or having a ReferenceImp. A resizing
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index 71bbf2f..4d14079 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,3 +1,34 @@
+2002-08-16  Maciej Stachowiak  <mjs at apple.com>
+
+	Final step of the Reference change. Completely separate Reference
+	from Value, and eliminate ReferenceImp.
+
+	18% speedup on cvs-js-performance test.
+
+        * kjs/internal.cpp, kjs/internal.h: Remove ReferenceImp.
+        * kjs/nodes.cpp:
+        (Node::evaluateReference): Use Reference::makeValueReference(),
+	not ConstReference.
+        * kjs/reference.cpp:
+        (Reference::Reference): New implementation, handles both regular
+	and value references.
+        (Reference::makeValueReference): Incorporate functionality of ConstReference
+	into this class.
+        (Reference::getBase): New implementation (incorporates error vase
+	for value references).
+	(Reference::getPropertyName): New implementation (incorporates error case
+	for value references).
+        (Reference::putValue): New implementation (incorporates error case
+	for value references).
+        (Reference::deleteValue): New implementation (incorporates error case
+	for value references).
+        (Reference::getValue): New implementation (incorporates special case
+	for value references).
+        (Reference::isMutable): New implementation.
+	* kjs/reference.h: New implementation that merges ReferenceImp
+	into the stack object.
+        * kjs/value.h, kjs/value.cpp: Removed all reference-related method.
+
 2002-08-16  Darin Adler  <darin at apple.com>
 
 	- fixed 3026184 -- Hang going to http://aa.com/ while executing JavaScript
@@ -18,6 +49,28 @@
 
 2002-08-16  Maciej Stachowiak  <mjs at apple.com>
 
+        * JavaScriptCore.pbproj/project.pbxproj:
+        * kjs/internal.cpp:
+        * kjs/internal.h:
+        * kjs/nodes.cpp:
+        (Node::evaluateReference):
+        * kjs/reference.cpp:
+        (Reference::Reference):
+        (Reference::makeValueReference):
+        (Reference::getBase):
+        (Reference::getPropertyName):
+        (Reference::getValue):
+        (Reference::putValue):
+        (Reference::deleteValue):
+        (Reference::isMutable):
+        * kjs/reference.h:
+        * kjs/reference_list.h:
+        * kjs/value.cpp:
+        (ValueImp::dispatchToUInt32):
+        * kjs/value.h:
+
+2002-08-16  Maciej Stachowiak  <mjs at apple.com>
+
 	Next step: reimplement ReferenceList from scratch, and store it as
 	an actual Reference object, so ReferenceList no longer depends on
 	Reference being a Value or having a ReferenceImp. A resizing
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 71bbf2f..4d14079 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,34 @@
+2002-08-16  Maciej Stachowiak  <mjs at apple.com>
+
+	Final step of the Reference change. Completely separate Reference
+	from Value, and eliminate ReferenceImp.
+
+	18% speedup on cvs-js-performance test.
+
+        * kjs/internal.cpp, kjs/internal.h: Remove ReferenceImp.
+        * kjs/nodes.cpp:
+        (Node::evaluateReference): Use Reference::makeValueReference(),
+	not ConstReference.
+        * kjs/reference.cpp:
+        (Reference::Reference): New implementation, handles both regular
+	and value references.
+        (Reference::makeValueReference): Incorporate functionality of ConstReference
+	into this class.
+        (Reference::getBase): New implementation (incorporates error vase
+	for value references).
+	(Reference::getPropertyName): New implementation (incorporates error case
+	for value references).
+        (Reference::putValue): New implementation (incorporates error case
+	for value references).
+        (Reference::deleteValue): New implementation (incorporates error case
+	for value references).
+        (Reference::getValue): New implementation (incorporates special case
+	for value references).
+        (Reference::isMutable): New implementation.
+	* kjs/reference.h: New implementation that merges ReferenceImp
+	into the stack object.
+        * kjs/value.h, kjs/value.cpp: Removed all reference-related method.
+
 2002-08-16  Darin Adler  <darin at apple.com>
 
 	- fixed 3026184 -- Hang going to http://aa.com/ while executing JavaScript
@@ -18,6 +49,28 @@
 
 2002-08-16  Maciej Stachowiak  <mjs at apple.com>
 
+        * JavaScriptCore.pbproj/project.pbxproj:
+        * kjs/internal.cpp:
+        * kjs/internal.h:
+        * kjs/nodes.cpp:
+        (Node::evaluateReference):
+        * kjs/reference.cpp:
+        (Reference::Reference):
+        (Reference::makeValueReference):
+        (Reference::getBase):
+        (Reference::getPropertyName):
+        (Reference::getValue):
+        (Reference::putValue):
+        (Reference::deleteValue):
+        (Reference::isMutable):
+        * kjs/reference.h:
+        * kjs/reference_list.h:
+        * kjs/value.cpp:
+        (ValueImp::dispatchToUInt32):
+        * kjs/value.h:
+
+2002-08-16  Maciej Stachowiak  <mjs at apple.com>
+
 	Next step: reimplement ReferenceList from scratch, and store it as
 	an actual Reference object, so ReferenceList no longer depends on
 	Reference being a Value or having a ReferenceImp. A resizing
diff --git a/JavaScriptCore/JavaScriptCore.pbproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.pbproj/project.pbxproj
index 9ff6293..cfad1d3 100644
--- a/JavaScriptCore/JavaScriptCore.pbproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.pbproj/project.pbxproj
@@ -474,6 +474,9 @@
 			fileRef = F5341390030CEEB1018BE7F3;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F5341393030CEEB1018BE7F3 = {
@@ -495,6 +498,9 @@
 			fileRef = F5341394030CF5F8018BE7F3;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
 			};
 		};
 		F54F0800030CD22001B5C2EB = {
diff --git a/JavaScriptCore/kjs/internal.cpp b/JavaScriptCore/kjs/internal.cpp
index 73f2886..bf02e4e 100644
--- a/JavaScriptCore/kjs/internal.cpp
+++ b/JavaScriptCore/kjs/internal.cpp
@@ -254,119 +254,6 @@ bool NumberImp::toUInt32(unsigned& uint32) const
   return (double)uint32 == val;
 }
 
-// ------------------------------ ReferenceImp ---------------------------------
-
-ReferenceImp::ReferenceImp(const Value& v, unsigned p)
-  : base(v.imp()), propertyNameIsNumber(true), propertyNameAsNumber(p)
-{
-}
-
-ReferenceImp::ReferenceImp(const Value& v, const UString& p)
-  : base(v.imp()), propertyNameIsNumber(false), prop(p)
-{
-}
-
-void ReferenceImp::mark()
-{
-  ValueImp::mark();
-  if (base && !base->marked())
-    base->mark();
-}
-
-Value ReferenceImp::toPrimitive(ExecState */*exec*/, Type /*preferredType*/) const
-{
-  // invalid for Reference
-  assert(false);
-  return Value();
-}
-
-bool ReferenceImp::toBoolean(ExecState */*exec*/) const
-{
-  // invalid for Reference
-  assert(false);
-  return false;
-}
-
-double ReferenceImp::toNumber(ExecState */*exec*/) const
-{
-  // invalid for Reference
-  assert(false);
-  return 0;
-}
-
-UString ReferenceImp::toString(ExecState */*exec*/) const
-{
-  // invalid for Reference
-  assert(false);
-  return UString::null;
-}
-
-Object ReferenceImp::toObject(ExecState */*exec*/) const
-{
-  // invalid for Reference
-  assert(false);
-  return Object();
-}
-
-UString ReferenceImp::getPropertyName(ExecState *) const
-{
-  if (propertyNameIsNumber && prop.isNull())
-    prop = UString::from(propertyNameAsNumber);
-  return prop;
-}
-
-Value ReferenceImp::getValue(ExecState *exec) const
-{
-  Value o = getBase(exec);
-
-  if (o.isNull() || o.type() == NullType) {
-    UString m = I18N_NOOP("Can't find variable: ") + getPropertyName(exec);
-    Object err = Error::create(exec, ReferenceError, m.ascii());
-    exec->setException(err);
-    return err;
-  }
-
-  if (o.type() != ObjectType) {
-    UString m = I18N_NOOP("Base is not an object");
-    Object err = Error::create(exec, ReferenceError, m.ascii());
-    exec->setException(err);
-    return err;
-  }
-
-  if (propertyNameIsNumber)
-    return static_cast<ObjectImp*>(o.imp())->get(exec,propertyNameAsNumber);
-  return static_cast<ObjectImp*>(o.imp())->get(exec,prop);
-}
-
-void ReferenceImp::putValue(ExecState *exec, const Value& w)
-{
-#ifdef KJS_VERBOSE
-  printInfo(exec,(UString("setting property ")+getPropertyName(exec)).cstring().c_str(),w);
-#endif
-  Value o = getBase(exec);
-  if (o.type() == NullType)
-    o = exec->interpreter()->globalObject();
-
-  if (propertyNameIsNumber)
-    return static_cast<ObjectImp*>(o.imp())->put(exec,propertyNameAsNumber, w);
-  return static_cast<ObjectImp*>(o.imp())->put(exec,prop, w);
-}
-
-bool ReferenceImp::deleteValue(ExecState *exec)
-{
-  Value b = getBase(exec);
-
-  // The spec doesn't mention what to do if the base is null... just return true
-  if (b.type() != ObjectType) {
-    assert(b.type() == NullType);
-    return true;
-  }
-
-  if (propertyNameIsNumber)
-    return static_cast<ObjectImp*>(b.imp())->deleteProperty(exec,propertyNameAsNumber);
-  return static_cast<ObjectImp*>(b.imp())->deleteProperty(exec,prop);
-}
-
 // ------------------------------ LabelStack -----------------------------------
 
 LabelStack::LabelStack(const LabelStack &other)
diff --git a/JavaScriptCore/kjs/internal.h b/JavaScriptCore/kjs/internal.h
index f2e92a1..0da3e96 100644
--- a/JavaScriptCore/kjs/internal.h
+++ b/JavaScriptCore/kjs/internal.h
@@ -142,35 +142,6 @@ namespace KJS {
   //                            Internal type impls
   // ---------------------------------------------------------------------------
 
-  class ReferenceImp : public ValueImp {
-  public:
-    ReferenceImp(const Value& v, const UString& p);
-    ReferenceImp(const Value& v, unsigned p);
-    virtual void mark();
-
-    Value toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;
-    bool toBoolean(ExecState *exec) const;
-    double toNumber(ExecState *exec) const;
-    UString toString(ExecState *exec) const;
-    Object toObject(ExecState *exec) const;
-
-    Value getBase(ExecState *) const { return Value(base); }
-    UString getPropertyName(ExecState *) const;
-    Value getValue(ExecState *exec) const;
-    void putValue(ExecState *exec, const Value& w);
-    bool deleteValue(ExecState *exec);
-
-    Type type() const { return ReferenceType; }
-
-  private:
-    ValueImp *base;
-    bool propertyNameIsNumber;
-    unsigned propertyNameAsNumber;
-    mutable UString prop;
-  };
-  
-  inline Reference::Reference(ReferenceImp *imp) : Value(imp) { }
-
   class CompletionImp : public ValueImp {
   public:
     Type type() const { return CompletionType; }
diff --git a/JavaScriptCore/kjs/nodes.cpp b/JavaScriptCore/kjs/nodes.cpp
index 652802d..d6bd3e6 100644
--- a/JavaScriptCore/kjs/nodes.cpp
+++ b/JavaScriptCore/kjs/nodes.cpp
@@ -68,9 +68,9 @@ using namespace KJS;
 
 #define KJS_CHECKEXCEPTIONREFERENCE \
   if (exec->hadException()) \
-    return ConstReference(UndefinedImp::staticUndefined);; \
+    return Reference::makeValueReference(Undefined());; \
   if (Collector::outOfMemory()) \
-    return ConstReference(UndefinedImp::staticUndefined); // will be picked up by KJS_CHECKEXCEPTION
+    return Reference::makeValueReference(Undefined()); // will be picked up by KJS_CHECKEXCEPTION
 
 #define KJS_CHECKEXCEPTIONLIST \
   if (exec->hadException()) \
@@ -105,7 +105,7 @@ Reference Node::evaluateReference(ExecState *exec)
 {
   Value v = evaluate(exec);
   KJS_CHECKEXCEPTIONREFERENCE
-  return ConstReference(v.imp());
+  return Reference::makeValueReference(v);
 }
 
 #ifdef KJS_DEBUG_MEM
diff --git a/JavaScriptCore/kjs/reference.cpp b/JavaScriptCore/kjs/reference.cpp
index c9dac90..fe4fabd 100644
--- a/JavaScriptCore/kjs/reference.cpp
+++ b/JavaScriptCore/kjs/reference.cpp
@@ -28,34 +28,143 @@ using namespace KJS;
 // ------------------------------ Reference ------------------------------------
 
 Reference::Reference(const Object& b, const UString& p)
-  : Value(new ReferenceImp(b,p))
+  : base(b),
+    baseIsValue(false),
+    propertyNameIsNumber(false),
+    prop(p)
 {
 }
 
 Reference::Reference(const Object& b, unsigned p)
-  : Value(new ReferenceImp(b,p))
+  : base(b),
+    propertyNameAsNumber(p),
+    baseIsValue(false),
+    propertyNameIsNumber(true)
 {
 }
 
 Reference::Reference(const Null& b, const UString& p)
-  : Value(new ReferenceImp(b,p))
+  : base(b),
+    baseIsValue(false),
+    propertyNameIsNumber(false),
+    prop(p)
 {
 }
 
 Reference::Reference(const Null& b, unsigned p)
-  : Value(new ReferenceImp(b,p))
+  : base(b),
+    propertyNameAsNumber(p),
+    baseIsValue(false),
+    propertyNameIsNumber(true)
 {
 }
 
-Reference Reference::dynamicCast(const Value &v)
+Reference Reference::makeValueReference(const Value& v)
 {
-  if (v.isNull() || v.type() != ReferenceType)
-    return 0;
+  Reference valueRef;
+  valueRef.base = v;
+  valueRef.baseIsValue = true;
+  return valueRef;
+}
+
+Reference::Reference()
+{
+}
+
+Value Reference::getBase(ExecState *exec) const
+{
+  if (baseIsValue) {
+    Object err = Error::create(exec, ReferenceError, I18N_NOOP("Invalid reference base"));
+    exec->setException(err);
+    return err;
+  }
+
+  return base;
+}
+
+UString Reference::getPropertyName(ExecState *exec) const
+{
+  if (baseIsValue) {
+    // the spec wants a runtime error here. But getValue() and putValue()
+    // will catch this case on their own earlier. When returning a Null
+    // string we should be on the safe side.
+    return UString();
+  }
 
-  return static_cast<ReferenceImp*>(v.imp());
+  if (propertyNameIsNumber && prop.isNull())
+    prop = UString::from(propertyNameAsNumber);
+  return prop;
 }
 
-ConstReference::ConstReference(ValueImp *v) : 
-  Reference((ReferenceImp *)v) 
+Value Reference::getValue(ExecState *exec) const 
 {
+  if (baseIsValue) {
+    return base;
+  }
+
+  Value o = getBase(exec);
+
+  if (o.isNull() || o.type() == NullType) {
+    UString m = I18N_NOOP("Can't find variable: ") + getPropertyName(exec);
+    Object err = Error::create(exec, ReferenceError, m.ascii());
+    exec->setException(err);
+    return err;
+  }
+
+  if (o.type() != ObjectType) {
+    UString m = I18N_NOOP("Base is not an object");
+    Object err = Error::create(exec, ReferenceError, m.ascii());
+    exec->setException(err);
+    return err;
+  }
+
+  if (propertyNameIsNumber)
+    return static_cast<ObjectImp*>(o.imp())->get(exec,propertyNameAsNumber);
+  return static_cast<ObjectImp*>(o.imp())->get(exec,prop);
+}
+
+void Reference::putValue(ExecState *exec, const Value &w)
+{
+  if (baseIsValue) {
+    Object err = Error::create(exec,ReferenceError);
+    exec->setException(err);
+    return;
+  }
+
+#ifdef KJS_VERBOSE
+  printInfo(exec,(UString("setting property ")+getPropertyName(exec)).cstring().c_str(),w);
+#endif
+  Value o = getBase(exec);
+  if (o.type() == NullType)
+    o = exec->interpreter()->globalObject();
+
+  if (propertyNameIsNumber)
+    return static_cast<ObjectImp*>(o.imp())->put(exec,propertyNameAsNumber, w);
+  return static_cast<ObjectImp*>(o.imp())->put(exec,prop, w);
+}
+
+bool Reference::deleteValue(ExecState *exec)
+{
+  if (baseIsValue) {
+    Object err = Error::create(exec,ReferenceError);
+    exec->setException(err);
+    return false;
+  }
+
+  Value b = getBase(exec);
+
+  // The spec doesn't mention what to do if the base is null... just return true
+  if (b.type() != ObjectType) {
+    assert(b.type() == NullType);
+    return true;
+  }
+
+  if (propertyNameIsNumber)
+    return static_cast<ObjectImp*>(b.imp())->deleteProperty(exec,propertyNameAsNumber);
+  return static_cast<ObjectImp*>(b.imp())->deleteProperty(exec,prop);
+}
+
+bool Reference::isMutable()
+{ 
+  return !baseIsValue;
 }
diff --git a/JavaScriptCore/kjs/reference.h b/JavaScriptCore/kjs/reference.h
index 47e99dd..5887ed1 100644
--- a/JavaScriptCore/kjs/reference.h
+++ b/JavaScriptCore/kjs/reference.h
@@ -35,51 +35,45 @@ namespace KJS {
     Reference(const Object& b, unsigned p);
     Reference(const Null& b, const UString& p);
     Reference(const Null& b, unsigned p);
-    Reference(ReferenceImp *v);
+    static Reference makeValueReference(const Value& v);
     
     /**
-     * Converts a Value into an Reference. If the value's type is not
-     * ReferenceType, a null object will be returned (i.e. one with it's
-     * internal pointer set to 0). If you do not know for sure whether the
-     * value is of type ReferenceType, you should check the @ref isNull()
-     * methods afterwards before calling any methods on the returned value.
-     *
-     * @return The value converted to an Reference
-     */
-    static Reference dynamicCast(const Value &v);
-
-    /**
      * Performs the GetBase type conversion operation on this value (ECMA 8.7)
      *
      * 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->dispatchGetBase(exec); }
+    Value getBase(ExecState *exec) const;
 
     /**
      * Performs the GetPropertyName type conversion operation on this value
      * (ECMA 8.7)
      */
-    UString getPropertyName(ExecState *exec) const { return rep->dispatchGetPropertyName(exec); }
+    UString getPropertyName(ExecState *exec) const;
 
     /**
      * Performs the GetValue type conversion operation on this value
      * (ECMA 8.7.1)
      */
-    Value getValue(ExecState *exec) const { return rep->dispatchGetValue(exec); }
+    Value getValue(ExecState *exec) const;
 
     /**
      * Performs the PutValue type conversion operation on this value
      * (ECMA 8.7.1)
      */
-    void putValue(ExecState *exec, const Value &w) { rep->dispatchPutValue(exec, w); }
-    bool deleteValue(ExecState *exec) { return rep->dispatchDeleteValue(exec); }
-    bool isMutable() { return type() == ReferenceType; }
-  };
+    void putValue(ExecState *exec, const Value &w);
+    bool deleteValue(ExecState *exec);
 
-  class ConstReference : public Reference {
-  public:
-    ConstReference(ValueImp *v);
+    bool isMutable();
+
+  private:
+    Reference();
+
+    Value base;
+    unsigned propertyNameAsNumber;
+    bool baseIsValue;
+    bool propertyNameIsNumber;
+    mutable UString prop;
   };
 }
 
diff --git a/JavaScriptCore/kjs/value.cpp b/JavaScriptCore/kjs/value.cpp
index 248130b..96e58d0 100644
--- a/JavaScriptCore/kjs/value.cpp
+++ b/JavaScriptCore/kjs/value.cpp
@@ -140,42 +140,6 @@ unsigned short ValueImp::toUInt16(ExecState *exec) const
   return static_cast<unsigned short>(d16);
 }
 
-// ECMA 8.7.1
-Value ValueImp::getBase(ExecState *exec) const
-{
-  Object err = Error::create(exec, ReferenceError, I18N_NOOP("Invalid reference base"));
-  exec->setException(err);
-  return err;
-}
-
-// ECMA 8.7.2
-UString ValueImp::getPropertyName(ExecState * /*exec*/) const
-{
-  // the spec wants a runtime error here. But getValue() and putValue()
-  // will catch this case on their own earlier. When returning a Null
-  // string we should be on the safe side.
-  return UString();
-}
-
-// ECMA 8.7.1
-Value ValueImp::getValue(ExecState *exec) const
-{
-  return Value(const_cast<ValueImp*>(this));
-}
-
-void ValueImp::putValue(ExecState *exec, const Value& w)
-{
-  Object err = Error::create(exec,ReferenceError);
-  exec->setException(err);
-}
-
-bool ValueImp::deleteValue(ExecState *exec)
-{
-  Object err = Error::create(exec,ReferenceError);
-  exec->setException(err);
-  return false;
-}
-
 // Dispatchers for virtual functions, to special-case simple numbers which
 // won't be real pointers.
 
@@ -233,35 +197,6 @@ bool ValueImp::dispatchToUInt32(unsigned& result) const
   return toUInt32(result);
 }
 
-Value ValueImp::dispatchGetBase(ExecState *exec) const
-{
-  if (SimpleNumber::is(this))
-    return ValueImp::getBase(exec);
-  return getBase(exec);
-}
-
-UString ValueImp::dispatchGetPropertyName(ExecState *exec) const
-{
-  if (SimpleNumber::is(this))
-    return ValueImp::getPropertyName(exec);
-  return getPropertyName(exec);
-}
-
-void ValueImp::dispatchPutValue(ExecState *exec, const Value& w)
-{
-  if (SimpleNumber::is(this))
-    ValueImp::putValue(exec, w);
-  putValue(exec, w);
-}
-
-bool ValueImp::dispatchDeleteValue(ExecState *exec)
-{
-  if (SimpleNumber::is(this))
-    return ValueImp::deleteValue(exec);
-  return deleteValue(exec);
-}
-
-
 // ------------------------------ Value ----------------------------------------
 
 Value::Value(ValueImp *v)
diff --git a/JavaScriptCore/kjs/value.h b/JavaScriptCore/kjs/value.h
index d90149a..d00e460 100644
--- a/JavaScriptCore/kjs/value.h
+++ b/JavaScriptCore/kjs/value.h
@@ -77,7 +77,6 @@ namespace KJS {
     StringType      = 4,
     NumberType      = 5,
     ObjectType      = 6,
-    ReferenceType   = 7,
     ListType        = 8,
     CompletionType  = 9
   };
@@ -125,11 +124,6 @@ namespace KJS {
     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:
@@ -144,14 +138,6 @@ namespace KJS {
     virtual Object toObject(ExecState *exec) const = 0;
     virtual bool toUInt32(unsigned&) const;
 
-    // Reference operations
-
-    virtual Value getBase(ExecState *exec) const;
-    virtual UString getPropertyName(ExecState *exec) const;
-    virtual Value getValue(ExecState *exec) const;
-    virtual void putValue(ExecState *exec, const Value& w);
-    virtual bool deleteValue(ExecState *exec);
-    
     enum {
       VI_MARKED = 1,
       VI_GCALLOWED = 2,
@@ -402,13 +388,6 @@ namespace KJS {
     explicit Number(NumberImp *v);
   };
 
-  inline Value ValueImp::dispatchGetValue(ExecState *exec) const
-  {
-    if (SimpleNumber::is(this))
-        return Value(const_cast<ValueImp*>(this));
-    return getValue(exec);
-  }
-
 }; // namespace
 
 #endif // _KJS_VALUE_H_

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list