Commit c758b286 authored by darin's avatar darin

- decrease ref/deref -- 5% speedup in iBench

        * JavaScriptCore.pbproj/project.pbxproj: Added array_instance.h
        * kjs/array_instance.h: Added so it can be shared by function.h.

        * kjs/array_object.cpp:
        * kjs/array_object.h:
        * kjs/bool_object.cpp:
        * kjs/bool_object.h:
        * kjs/collector.cpp:
        * kjs/date_object.cpp:
        * kjs/date_object.h:
        * kjs/error_object.cpp:
        * kjs/function.cpp:
        * kjs/function.h:
        * kjs/function_object.cpp:
        * kjs/internal.cpp:
        * kjs/internal.h:
        * kjs/math_object.cpp:
        * kjs/nodes.cpp:
        * kjs/number_object.cpp:
        * kjs/object.cpp:
        * kjs/object.h:
        * kjs/object_object.cpp:
        * kjs/property_map.cpp:
        * kjs/reference.cpp:
        * kjs/reference.h:
        * kjs/regexp_object.cpp:
        * kjs/string_object.cpp:
        * kjs/string_object.h:
        * kjs/value.cpp:
        * kjs/value.h:
	Switched lots of interfaces so they don't require ref/deref.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 84a69979
2002-11-20 Darin Adler <darin@apple.com>
- decrease ref/deref -- 5% speedup in iBench
* JavaScriptCore.pbproj/project.pbxproj: Added array_instance.h
* kjs/array_instance.h: Added so it can be shared by function.h.
* kjs/array_object.cpp:
* kjs/array_object.h:
* kjs/bool_object.cpp:
* kjs/bool_object.h:
* kjs/collector.cpp:
* kjs/date_object.cpp:
* kjs/date_object.h:
* kjs/error_object.cpp:
* kjs/function.cpp:
* kjs/function.h:
* kjs/function_object.cpp:
* kjs/internal.cpp:
* kjs/internal.h:
* kjs/math_object.cpp:
* kjs/nodes.cpp:
* kjs/number_object.cpp:
* kjs/object.cpp:
* kjs/object.h:
* kjs/object_object.cpp:
* kjs/property_map.cpp:
* kjs/reference.cpp:
* kjs/reference.h:
* kjs/regexp_object.cpp:
* kjs/string_object.cpp:
* kjs/string_object.h:
* kjs/value.cpp:
* kjs/value.h:
Switched lots of interfaces so they don't require ref/deref.
2002-11-20 Maciej Stachowiak <mjs@apple.com>
Fixed the two most obvious problems with the new GC for another 6%
......
2002-11-20 Darin Adler <darin@apple.com>
- decrease ref/deref -- 5% speedup in iBench
* JavaScriptCore.pbproj/project.pbxproj: Added array_instance.h
* kjs/array_instance.h: Added so it can be shared by function.h.
* kjs/array_object.cpp:
* kjs/array_object.h:
* kjs/bool_object.cpp:
* kjs/bool_object.h:
* kjs/collector.cpp:
* kjs/date_object.cpp:
* kjs/date_object.h:
* kjs/error_object.cpp:
* kjs/function.cpp:
* kjs/function.h:
* kjs/function_object.cpp:
* kjs/internal.cpp:
* kjs/internal.h:
* kjs/math_object.cpp:
* kjs/nodes.cpp:
* kjs/number_object.cpp:
* kjs/object.cpp:
* kjs/object.h:
* kjs/object_object.cpp:
* kjs/property_map.cpp:
* kjs/reference.cpp:
* kjs/reference.h:
* kjs/regexp_object.cpp:
* kjs/string_object.cpp:
* kjs/string_object.h:
* kjs/value.cpp:
* kjs/value.h:
Switched lots of interfaces so they don't require ref/deref.
2002-11-20 Maciej Stachowiak <mjs@apple.com>
Fixed the two most obvious problems with the new GC for another 6%
......
2002-11-20 Darin Adler <darin@apple.com>
- decrease ref/deref -- 5% speedup in iBench
* JavaScriptCore.pbproj/project.pbxproj: Added array_instance.h
* kjs/array_instance.h: Added so it can be shared by function.h.
* kjs/array_object.cpp:
* kjs/array_object.h:
* kjs/bool_object.cpp:
* kjs/bool_object.h:
* kjs/collector.cpp:
* kjs/date_object.cpp:
* kjs/date_object.h:
* kjs/error_object.cpp:
* kjs/function.cpp:
* kjs/function.h:
* kjs/function_object.cpp:
* kjs/internal.cpp:
* kjs/internal.h:
* kjs/math_object.cpp:
* kjs/nodes.cpp:
* kjs/number_object.cpp:
* kjs/object.cpp:
* kjs/object.h:
* kjs/object_object.cpp:
* kjs/property_map.cpp:
* kjs/reference.cpp:
* kjs/reference.h:
* kjs/regexp_object.cpp:
* kjs/string_object.cpp:
* kjs/string_object.h:
* kjs/value.cpp:
* kjs/value.h:
Switched lots of interfaces so they don't require ref/deref.
2002-11-20 Maciej Stachowiak <mjs@apple.com>
Fixed the two most obvious problems with the new GC for another 6%
......
......@@ -223,6 +223,7 @@
F5341393030CEEB1018BE7F3,
F5BB2BC7030F772101FCFE1D,
933A349C038AE7C6008635CE,
938772E6038BFE19008635CE,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
......@@ -318,6 +319,7 @@
};
08FB77AEFE84172EC02AAC07 = {
children = (
938772E5038BFE19008635CE,
F692A84D0255597D01FF60F7,
F692A84E0255597D01FF60F7,
F692A84F0255597D01FF60F7,
......@@ -471,6 +473,18 @@
settings = {
};
};
938772E5038BFE19008635CE = {
fileEncoding = 4;
isa = PBXFileReference;
path = array_instance.h;
refType = 4;
};
938772E6038BFE19008635CE = {
fileRef = 938772E5038BFE19008635CE;
isa = PBXBuildFile;
settings = {
};
};
//930
//931
//932
......
// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef ARRAY_INSTANCE_H
#define ARRAY_INSTANCE_H
#include "object.h"
namespace KJS {
class ArrayInstanceImp : public ObjectImp {
public:
ArrayInstanceImp(ObjectImp *proto, unsigned initialLength);
ArrayInstanceImp(ObjectImp *proto, const List &initialValues);
~ArrayInstanceImp();
virtual Value get(ExecState *exec, const Identifier &propertyName) const;
virtual Value get(ExecState *exec, unsigned propertyName) const;
virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
virtual void put(ExecState *exec, unsigned propertyName, const Value &value, int attr = None);
virtual bool hasProperty(ExecState *exec, const Identifier &propertyName) const;
virtual bool hasProperty(ExecState *exec, unsigned propertyName) const;
virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
virtual bool deleteProperty(ExecState *exec, unsigned propertyName);
virtual void mark();
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
unsigned getLength() const { return length; }
void sort(ExecState *exec);
void sort(ExecState *exec, Object &compareFunction);
private:
void setLength(unsigned newLength);
unsigned pushUndefinedObjectsToEnd();
unsigned length;
unsigned capacity;
ValueImp **storage;
};
}; // namespace KJS
#endif
......@@ -39,7 +39,7 @@ using namespace KJS;
const ClassInfo ArrayInstanceImp::info = {"Array", 0, 0, 0};
ArrayInstanceImp::ArrayInstanceImp(const Object &proto, unsigned initialLength)
ArrayInstanceImp::ArrayInstanceImp(ObjectImp *proto, unsigned initialLength)
: ObjectImp(proto)
, length(initialLength)
, capacity(length)
......@@ -47,7 +47,7 @@ ArrayInstanceImp::ArrayInstanceImp(const Object &proto, unsigned initialLength)
{
}
ArrayInstanceImp::ArrayInstanceImp(const Object &proto, const List &list)
ArrayInstanceImp::ArrayInstanceImp(ObjectImp *proto, const List &list)
: ObjectImp(proto)
, length(list.size())
, capacity(length)
......@@ -289,7 +289,7 @@ const ClassInfo ArrayPrototypeImp::info = {"Array", &ArrayInstanceImp::info, &ar
// ECMA 15.4.4
ArrayPrototypeImp::ArrayPrototypeImp(ExecState *exec,
ObjectPrototypeImp *objProto)
: ArrayInstanceImp(Object(objProto), 0)
: ArrayInstanceImp(objProto, 0)
{
Value protect(this);
setInternalValue(Null());
......@@ -664,10 +664,10 @@ Object ArrayObjectImp::construct(ExecState *exec, const List &args)
{
// a single numeric argument denotes the array size (!)
if (args.size() == 1 && args[0].type() == NumberType)
return Object(new ArrayInstanceImp(exec->interpreter()->builtinArrayPrototype(), args[0].toUInt32(exec)));
return Object(new ArrayInstanceImp(exec->interpreter()->builtinArrayPrototype().imp(), args[0].toUInt32(exec)));
// otherwise the array is constructed with the arguments in it
return Object(new ArrayInstanceImp(exec->interpreter()->builtinArrayPrototype(), args));
return Object(new ArrayInstanceImp(exec->interpreter()->builtinArrayPrototype().imp(), args));
}
bool ArrayObjectImp::implementsCall() const
......@@ -681,4 +681,3 @@ Value ArrayObjectImp::call(ExecState *exec, Object &/*thisObj*/, const List &arg
// equivalent to 'new Array(....)'
return construct(exec,args);
}
......@@ -27,41 +27,6 @@
namespace KJS {
class ArrayInstanceImp : public ObjectImp {
public:
ArrayInstanceImp(const Object &proto, unsigned initialLength);
ArrayInstanceImp(const Object &proto, const List &initialValues);
~ArrayInstanceImp();
virtual Value get(ExecState *exec, const Identifier &propertyName) const;
virtual Value get(ExecState *exec, unsigned propertyName) const;
virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
virtual void put(ExecState *exec, unsigned propertyName, const Value &value, int attr = None);
virtual bool hasProperty(ExecState *exec, const Identifier &propertyName) const;
virtual bool hasProperty(ExecState *exec, unsigned propertyName) const;
virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
virtual bool deleteProperty(ExecState *exec, unsigned propertyName);
virtual void mark();
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
unsigned getLength() const { return length; }
void sort(ExecState *exec);
void sort(ExecState *exec, Object &compareFunction);
private:
void setLength(unsigned newLength);
unsigned pushUndefinedObjectsToEnd();
unsigned length;
unsigned capacity;
ValueImp **storage;
};
class ArrayPrototypeImp : public ArrayInstanceImp {
public:
ArrayPrototypeImp(ExecState *exec,
......
......@@ -35,7 +35,7 @@ using namespace KJS;
const ClassInfo BooleanInstanceImp::info = {"Boolean", 0, 0, 0};
BooleanInstanceImp::BooleanInstanceImp(const Object &proto)
BooleanInstanceImp::BooleanInstanceImp(ObjectImp *proto)
: ObjectImp(proto)
{
}
......@@ -47,13 +47,13 @@ BooleanInstanceImp::BooleanInstanceImp(const Object &proto)
BooleanPrototypeImp::BooleanPrototypeImp(ExecState *exec,
ObjectPrototypeImp *objectProto,
FunctionPrototypeImp *funcProto)
: BooleanInstanceImp(Object(objectProto))
: BooleanInstanceImp(objectProto)
{
Value protect(this);
// The constructor will be added later by InterpreterImp::InterpreterImp()
put(exec,toStringPropertyName, Object(new BooleanProtoFuncImp(exec,funcProto,BooleanProtoFuncImp::ToString,0)), DontEnum);
put(exec,valueOfPropertyName, Object(new BooleanProtoFuncImp(exec,funcProto,BooleanProtoFuncImp::ValueOf,0)), DontEnum);
putDirect(toStringPropertyName, new BooleanProtoFuncImp(exec,funcProto,BooleanProtoFuncImp::ToString,0), DontEnum);
putDirect(valueOfPropertyName, new BooleanProtoFuncImp(exec,funcProto,BooleanProtoFuncImp::ValueOf,0), DontEnum);
setInternalValue(Boolean(false));
}
......@@ -65,7 +65,7 @@ BooleanProtoFuncImp::BooleanProtoFuncImp(ExecState *exec,
: InternalFunctionImp(funcProto), id(i)
{
Value protect(this);
put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
......@@ -104,10 +104,10 @@ BooleanObjectImp::BooleanObjectImp(ExecState *exec, FunctionPrototypeImp *funcPr
: InternalFunctionImp(funcProto)
{
Value protect(this);
put(exec,prototypePropertyName, Object(booleanProto),DontEnum|DontDelete|ReadOnly);
putDirect(prototypePropertyName, booleanProto, DontEnum|DontDelete|ReadOnly);
// no. of arguments for constructor
put(exec,lengthPropertyName, Number(1), ReadOnly|DontDelete|DontEnum);
putDirect(lengthPropertyName, NumberImp::one(), ReadOnly|DontDelete|DontEnum);
}
......@@ -119,8 +119,7 @@ bool BooleanObjectImp::implementsConstruct() const
// ECMA 15.6.2
Object BooleanObjectImp::construct(ExecState *exec, const List &args)
{
Object proto = exec->interpreter()->builtinBooleanPrototype();
Object obj(new BooleanInstanceImp(proto));
Object obj(new BooleanInstanceImp(exec->interpreter()->builtinBooleanPrototype().imp()));
Boolean b;
if (args.size() > 0)
......
......@@ -29,7 +29,7 @@ namespace KJS {
class BooleanInstanceImp : public ObjectImp {
public:
BooleanInstanceImp(const Object &proto);
BooleanInstanceImp(ObjectImp *proto);
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
......
......@@ -99,6 +99,7 @@ void* Collector::allocate(size_t s)
void *newCell = malloc(s);
heap.oversizeCells[heap.usedOversizeCells] = (CollectorCell *)newCell;
heap.usedOversizeCells++;
heap.numLiveObjects++;
return (void *)newCell;
}
......@@ -140,6 +141,7 @@ void* Collector::allocate(size_t s)
if (cellPos < CELLS_PER_BLOCK) {
targetBlock->bitmap[wordInBitmap] |= (1 << bitInWord);
targetBlock->usedCells++;
heap.numLiveObjects++;
return (void *)(targetBlock->cells + cellPos);
}
}
......@@ -292,6 +294,7 @@ void Collector::finalCheck()
#endif
#if APPLE_CHANGES
int Collector::numInterpreters()
{
int count = 0;
......@@ -342,7 +345,7 @@ int Collector::numReferencedObjects()
ValueImp *imp = (ValueImp *)(heap.blocks[block]->cells + BITS_PER_WORD * wordInBitmap + bitInWord);
if ((word & (1 << bitInWord)) &&
imp->refcount == 0) {
imp->refcount != 0) {
++count;
}
}
......@@ -351,7 +354,7 @@ int Collector::numReferencedObjects()
for (int cell = 0; cell < heap.usedOversizeCells; cell++) {
ValueImp *imp = (ValueImp *)heap.oversizeCells[cell];
if (imp->refcount == 0) {
if (imp->refcount != 0) {
++count;
}
}
......@@ -359,6 +362,7 @@ int Collector::numReferencedObjects()
return count;
}
// FIXME: Rename. Root object classes are more useful than live object classes.
CFSetRef Collector::liveObjectClasses()
{
CFMutableSetRef classes = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
......@@ -369,7 +373,8 @@ CFSetRef Collector::liveObjectClasses()
for (int bitInWord = 0; bitInWord < BITS_PER_WORD; bitInWord++) {
ValueImp *imp = (ValueImp *)(heap.blocks[block]->cells + BITS_PER_WORD * wordInBitmap + bitInWord);
if (word & (1 << bitInWord)) {
if (word & (1 << bitInWord)
&& ((imp->_flags & ValueImp::VI_GCALLOWED) == 0 || imp->refcount != 0)) {
const char *mangled_name = typeid(*imp).name();
int status;
char *demangled_name = __cxxabiv1::__cxa_demangle (mangled_name, NULL, NULL, &status);
......@@ -385,18 +390,20 @@ CFSetRef Collector::liveObjectClasses()
for (int cell = 0; cell < heap.usedOversizeCells; cell++) {
ValueImp *imp = (ValueImp *)heap.oversizeCells[cell];
const char *mangled_name = typeid(*imp).name();
int status;
char *demangled_name = __cxxabiv1::__cxa_demangle (mangled_name, NULL, NULL, &status);
CFStringRef className = CFStringCreateWithCString(NULL, demangled_name, kCFStringEncodingASCII);
free(demangled_name);
CFSetAddValue(classes, className);
CFRelease(className);
if ((imp->_flags & ValueImp::VI_GCALLOWED) == 0 || imp->refcount != 0) {
const char *mangled_name = typeid(*imp).name();
int status;
char *demangled_name = __cxxabiv1::__cxa_demangle (mangled_name, NULL, NULL, &status);
CFStringRef className = CFStringCreateWithCString(NULL, demangled_name, kCFStringEncodingASCII);
free(demangled_name);
CFSetAddValue(classes, className);
CFRelease(className);
}
}
return classes;
}
#endif
#endif // APPLE_CHANGES
......@@ -209,7 +209,7 @@ using namespace KJS;
const ClassInfo DateInstanceImp::info = {"Date", 0, 0, 0};
DateInstanceImp::DateInstanceImp(const Object &proto)
DateInstanceImp::DateInstanceImp(ObjectImp *proto)
: ObjectImp(proto)
{
}
......@@ -271,10 +271,10 @@ const ClassInfo DatePrototypeImp::info = {"Date", 0, &dateTable, 0};
DatePrototypeImp::DatePrototypeImp(ExecState *,
ObjectPrototypeImp *objectProto)
: DateInstanceImp(Object(objectProto))
: DateInstanceImp(objectProto)
{
Value protect(this);
setInternalValue(Number(NaN));
setInternalValue(NumberImp::create(NaN));
// The constructor will be added later, after DateObjectImp has been built
}
......@@ -292,7 +292,7 @@ DateProtoFuncImp::DateProtoFuncImp(ExecState *exec, int i, int len)
// We use a negative ID to denote the "UTC" variant.
{
Value protect(this);
put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
bool DateProtoFuncImp::implementsCall() const
......@@ -523,14 +523,17 @@ DateObjectImp::DateObjectImp(ExecState *exec,
: InternalFunctionImp(funcProto)
{
Value protect(this);
// ECMA 15.9.4.1 Date.prototype
put(exec,prototypePropertyName, Object(dateProto), DontEnum|DontDelete|ReadOnly);
putDirect(prototypePropertyName, dateProto, DontEnum|DontDelete|ReadOnly);
put(exec,"parse", Object(new DateObjectFuncImp(exec,funcProto,DateObjectFuncImp::Parse, 1)), DontEnum);
put(exec,"UTC", Object(new DateObjectFuncImp(exec,funcProto,DateObjectFuncImp::UTC, 7)), DontEnum);
static const Identifier parsePropertyName("parse");
putDirect(parsePropertyName, new DateObjectFuncImp(exec,funcProto,DateObjectFuncImp::Parse, 1), DontEnum);
static const Identifier UTCPropertyName("UTC");
putDirect("UTC", new DateObjectFuncImp(exec,funcProto,DateObjectFuncImp::UTC, 7), DontEnum);
// no. of arguments for constructor
put(exec,lengthPropertyName, Number(7), ReadOnly|DontDelete|DontEnum);
putDirect(lengthPropertyName, 7, ReadOnly|DontDelete|DontEnum);
}
bool DateObjectImp::implementsConstruct() const
......@@ -601,7 +604,7 @@ Object DateObjectImp::construct(ExecState *exec, const List &args)
}
Object proto = exec->interpreter()->builtinDatePrototype();
Object ret(new DateInstanceImp(proto));
Object ret(new DateInstanceImp(proto.imp()));
ret.setInternalValue(timeClip(value));
return ret;
}
......@@ -636,7 +639,7 @@ DateObjectFuncImp::DateObjectFuncImp(ExecState *exec, FunctionPrototypeImp *func
: InternalFunctionImp(funcProto), id(i)
{
Value protect(this);
put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
bool DateObjectFuncImp::implementsCall() const
......
......@@ -31,7 +31,7 @@ namespace KJS {
class DateInstanceImp : public ObjectImp {
public:
DateInstanceImp(const Object &proto);
DateInstanceImp(ObjectImp *proto);
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
......
......@@ -35,7 +35,7 @@ using namespace KJS;
ErrorPrototypeImp::ErrorPrototypeImp(ExecState *exec,
ObjectPrototypeImp *objectProto,
FunctionPrototypeImp *funcProto)
: ObjectImp(Object(objectProto))
: ObjectImp(objectProto)
{
Value protect(this);
setInternalValue(Undefined());
......@@ -43,7 +43,7 @@ ErrorPrototypeImp::ErrorPrototypeImp(ExecState *exec,
put(exec, namePropertyName, String("Error"), DontEnum);
put(exec, messagePropertyName, String("Unknown error"), DontEnum);
put(exec, toStringPropertyName, Object(new ErrorProtoFuncImp(exec,funcProto)), DontEnum);
putDirect(toStringPropertyName, new ErrorProtoFuncImp(exec,funcProto), DontEnum);
}
// ------------------------------ ErrorProtoFuncImp ----------------------------
......@@ -52,7 +52,7 @@ ErrorProtoFuncImp::ErrorProtoFuncImp(ExecState *exec, FunctionPrototypeImp *func
: InternalFunctionImp(funcProto)
{
Value protect(this);
put(exec,lengthPropertyName,Number(0),DontDelete|ReadOnly|DontEnum);
putDirect(lengthPropertyName, NumberImp::zero(), DontDelete|ReadOnly|DontEnum);
}
bool ErrorProtoFuncImp::implementsCall() const
......@@ -86,8 +86,8 @@ ErrorObjectImp::ErrorObjectImp(ExecState *exec, FunctionPrototypeImp *funcProto,
{
Value protect(this);
// ECMA 15.11.3.1 Error.prototype
put(exec, prototypePropertyName, Object(errorProto), DontEnum|DontDelete|ReadOnly);
//put(exec, namePropertyName, String(n));
putDirect(prototypePropertyName, errorProto, DontEnum|DontDelete|ReadOnly);
//putDirect(namePropertyName, String(n));
}
bool ErrorObjectImp::implementsConstruct() const
......@@ -99,10 +99,11 @@ bool ErrorObjectImp::implementsConstruct() const
Object ErrorObjectImp::construct(ExecState *exec, const List &args)
{
Object proto = Object::dynamicCast(exec->interpreter()->builtinErrorPrototype());
Object obj(new ObjectImp(proto));
ObjectImp *imp = new ObjectImp(proto);
Object obj(imp);
if (!args.isEmpty() && args[0].type() != UndefinedType) {
obj.put(exec, messagePropertyName, String(args[0].toString(exec)));
imp->putDirect(messagePropertyName, new StringImp(args[0].toString(exec)));
}
return obj;
......@@ -124,12 +125,12 @@ Value ErrorObjectImp::call(ExecState *exec, Object &/*thisObj*/, const List &arg
NativeErrorPrototypeImp::NativeErrorPrototypeImp(ExecState *exec, ErrorPrototypeImp *errorProto,
ErrorType et, UString name, UString message)
: ObjectImp(Object(errorProto))
: ObjectImp(errorProto)
{
Value protect(this);
errType = et;
put(exec, namePropertyName, String(name));
put(exec, messagePropertyName, String(message));
putDirect(namePropertyName, new StringImp(name), 0);
putDirect(messagePropertyName, new StringImp(message), 0);
}
// ------------------------------ NativeErrorImp -------------------------------
......@@ -143,8 +144,8 @@ NativeErrorImp::NativeErrorImp(ExecState *exec, FunctionPrototypeImp *funcProto,
Value protect(this);
proto = static_cast<ObjectImp*>(prot.imp());
put(exec,lengthPropertyName,Number(1),DontDelete|ReadOnly|DontEnum); // ECMA 15.11.7.5
put(exec,prototypePropertyName,prot);
putDirect(lengthPropertyName, NumberImp::one(), DontDelete|ReadOnly|DontEnum); // ECMA 15.11.7.5
putDirect(prototypePropertyName, proto, 0);
}
bool NativeErrorImp::implementsConstruct() const
......@@ -154,9 +155,10 @@ bool NativeErrorImp::implementsConstruct() const
Object NativeErrorImp::construct(ExecState *exec, const List &args)