Changeset 1623 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Jul 21, 2002, 10:38:39 PM (23 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_object.cpp
r1024 r1623 361 361 Value jObj = thisObj.get(exec,UString::from(j)); 362 362 int cmp; 363 if ( useSortFunction ) 364 { 363 if (jObj.type() == UndefinedType) { 364 cmp = 1; 365 } else if (minObj.type() == UndefinedType) { 366 cmp = -1; 367 } else if (useSortFunction) { 365 368 List l; 366 369 l.append(jObj); … … 368 371 Object thisObj = exec->interpreter()->globalObject(); 369 372 cmp = sortFunction.call(exec,thisObj, l ).toInt32(exec); 370 } 371 else 373 } else { 372 374 cmp = (jObj.toString(exec) < minObj.toString(exec)) ? -1 : 1; 375 } 373 376 if ( cmp < 0 ) 374 377 { -
trunk/JavaScriptCore/kjs/function.cpp
r1326 r1623 2 2 /* 3 3 * This file is part of the KDE libraries 4 * Copyright (C) 1999-200 0Harri Porten ([email protected])4 * Copyright (C) 1999-2002 Harri Porten ([email protected]) 5 5 * Copyright (C) 2001 Peter Kelly ([email protected]) 6 6 * … … 32 32 33 33 #include <stdio.h> 34 #include <errno.h> 35 #include <stdlib.h> 34 36 #include <assert.h> 35 37 #include <string.h> … … 37 39 using namespace KJS; 38 40 39 // ----------------------------- -FunctionImp ----------------------------------41 // ----------------------------- FunctionImp ---------------------------------- 40 42 41 43 const ClassInfo FunctionImp::info = {"Function", &InternalFunctionImp::info, 0, 0}; … … 100 102 101 103 Object func(this); 102 intcont = dbg->callEvent(exec,sid,lineno,func,args);104 bool cont = dbg->callEvent(exec,sid,lineno,func,args); 103 105 if (!cont) { 104 106 dbg->imp()->abort(); … … 108 110 109 111 // enter a new execution context 110 ContextImp *ctx = new ContextImp(globalObj, exec, thisObj,111 codeType(),exec->context().imp(), this, args);112 ExecState *newExec = new ExecState(exec->interpreter(),ctx);113 newExec ->setException(exec->exception()); // could be null112 ContextImp ctx(globalObj, exec, thisObj, codeType(), 113 exec->context().imp(), this, args); 114 ExecState newExec(exec->interpreter(), &ctx); 115 newExec.setException(exec->exception()); // could be null 114 116 115 117 // In order to maintain our "arguments" property, we maintain a list of arguments … … 118 120 // Note: this does not appear to be part of the spec 119 121 if (codeType() == FunctionCode) { 120 assert(ctx ->activationObject().inherits(&ActivationImp::info));121 Object argsObj = static_cast<ActivationImp*>(ctx ->activationObject().imp())->argumentsObject();122 put( newExec,"arguments", argsObj, DontDelete|DontEnum|ReadOnly);123 pushArgs( newExec,argsObj);122 assert(ctx.activationObject().inherits(&ActivationImp::info)); 123 Object argsObj = static_cast<ActivationImp*>(ctx.activationObject().imp())->argumentsObject(); 124 put(&newExec, "arguments", argsObj, DontDelete|DontEnum|ReadOnly); 125 pushArgs(&newExec, argsObj); 124 126 } 125 127 126 128 // assign user supplied arguments to parameters 127 processParameters( newExec,args);129 processParameters(&newExec, args); 128 130 // add variable declarations (initialized to undefined) 129 processVarDecls( newExec);130 131 Completion comp = execute( newExec);131 processVarDecls(&newExec); 132 133 Completion comp = execute(&newExec); 132 134 133 135 // if an exception occured, propogate it back to the previous execution object 134 if (newExec ->hadException())135 exec->setException(newExec ->exception());136 if (newExec.hadException()) 137 exec->setException(newExec.exception()); 136 138 if (codeType() == FunctionCode) 137 popArgs(newExec); 138 delete newExec; 139 delete ctx; 139 popArgs(&newExec); 140 140 141 141 #ifdef KJS_VERBOSE … … 431 431 } 432 432 case ParseInt: { 433 String str = args[0].toString(exec);433 CString cstr = args[0].toString(exec).cstring(); 434 434 int radix = args[1].toInt32(exec); 435 if (radix == 0) 436 radix = 10; 437 else if (radix < 2 || radix > 36) { 435 436 char* endptr; 437 errno = 0; 438 long value = strtol(cstr.c_str(), &endptr, radix); 439 if (errno != 0 || endptr == cstr.c_str()) 438 440 res = Number(NaN); 439 return res;440 }441 /* TODO: use radix */442 // Can't use toULong(), we want to accept floating point values too443 double value = str.value().toDouble( true /*tolerant*/ );444 if ( isNaN(value) )445 res = Number(NaN);446 441 else 447 res = Number(static_cast<long>(value)); // remove floating-point part 448 break; 449 } 450 case ParseFloat: { 451 String str = args[0].toString(exec); 452 res = Number(str.value().toDouble( true /*tolerant*/ )); 453 break; 454 } 442 res = Number(value); 443 break; 444 } 445 case ParseFloat: 446 res = Number(args[0].toString(exec).toDouble( true /*tolerant*/ )); 447 break; 455 448 case IsNaN: 456 449 res = Boolean(isNaN(args[0].toNumber(exec))); 457 450 break; 458 451 case IsFinite: { 459 Numbern = args[0].toNumber(exec);460 res = Boolean(! n.isNaN() && !n.isInf());452 double n = args[0].toNumber(exec); 453 res = Boolean(!isNaN(n) && !isInf(n)); 461 454 break; 462 455 } … … 485 478 UString s, str = args[0].toString(exec); 486 479 int k = 0, len = str.size(); 480 UChar u; 487 481 while (k < len) { 488 482 const UChar *c = str.data() + k; 489 UChar u;490 483 if (*c == UChar('%') && k <= len - 6 && *(c+1) == UChar('u')) { 491 484 u = Lexer::convertUnicode((c+2)->unicode(), (c+3)->unicode(), -
trunk/JavaScriptCore/kjs/internal.cpp
r1371 r1623 2 2 /* 3 3 * This file is part of the KDE libraries 4 * Copyright (C) 1999-200 1Harri Porten ([email protected])4 * Copyright (C) 1999-2002 Harri Porten ([email protected]) 5 5 * Copyright (C) 2001 Peter Kelly ([email protected]) 6 6 * … … 837 837 838 838 // Constructors (Object, Array, etc.) 839 840 ObjectObjectImp *objectObj = new ObjectObjectImp(globExec,objProto,funcProto); 841 b_Object = Object(objectObj); 842 FunctionObjectImp *funcObj = new FunctionObjectImp(globExec,funcProto); 843 b_Function = Object(funcObj); 844 ArrayObjectImp *arrayObj = new ArrayObjectImp(globExec,funcProto,arrayProto); 845 b_Array = Object(arrayObj); 846 StringObjectImp *stringObj = new StringObjectImp(globExec,funcProto,stringProto); 847 b_String = Object(stringObj); 848 BooleanObjectImp *booleanObj = new BooleanObjectImp(globExec,funcProto,booleanProto); 849 b_Boolean = Object(booleanObj); 850 NumberObjectImp *numberObj = new NumberObjectImp(globExec,funcProto,numberProto); 851 b_Number = Object(numberObj); 852 DateObjectImp *dateObj = new DateObjectImp(globExec,funcProto,dateProto); 853 b_Date = Object(dateObj); 854 RegExpObjectImp *regexpObj = new RegExpObjectImp(globExec,regexpProto,funcProto); 855 b_RegExp = Object(regexpObj); 856 ErrorObjectImp *errorObj = new ErrorObjectImp(globExec,funcProto,errorProto); 857 b_Error = Object(errorObj); 839 b_Object = Object(new ObjectObjectImp(globExec, objProto, funcProto)); 840 b_Function = Object(new FunctionObjectImp(globExec, funcProto)); 841 b_Array = Object(new ArrayObjectImp(globExec, funcProto, arrayProto)); 842 b_String = Object(new StringObjectImp(globExec, funcProto, stringProto)); 843 b_Boolean = Object(new BooleanObjectImp(globExec, funcProto, booleanProto)); 844 b_Number = Object(new NumberObjectImp(globExec, funcProto, numberProto)); 845 b_Date = Object(new DateObjectImp(globExec, funcProto, dateProto)); 846 b_RegExp = Object(new RegExpObjectImp(globExec, funcProto, regexpProto)); 847 b_Error = Object(new ErrorObjectImp(globExec, funcProto, errorProto)); 858 848 859 849 // Error object prototypes … … 1017 1007 } 1018 1008 1019 // no program node means a syntax occurred1009 // no program node means a syntax error occurred 1020 1010 if (!progNode) { 1021 1011 Object err = Error::create(globExec,SyntaxError,errMsg.ascii(),errLine); -
trunk/JavaScriptCore/kjs/interpreter.cpp
r1024 r1623 300 300 301 301 #ifdef KJS_DEBUG_MEM 302 #include "lexer.h" 302 303 void Interpreter::finalCheck() 303 304 { … … 312 313 Node::finalCheck(); 313 314 Collector::finalCheck(); 315 Lexer::globalClear(); 316 List::globalClear(); 317 UString::globalClear(); 314 318 } 315 319 #endif -
trunk/JavaScriptCore/kjs/lexer.cpp
r1024 r1623 91 91 return currLexer; 92 92 } 93 94 #ifdef KJS_DEBUG_MEM 95 void Lexer::globalClear() 96 { 97 delete currLexer; 98 currLexer = 0L; 99 } 100 #endif 93 101 94 102 void Lexer::setCode(const UChar *c, unsigned int len) -
trunk/JavaScriptCore/kjs/lexer.h
r1024 r1623 112 112 static bool isDecimalDigit(unsigned short c); 113 113 114 #ifdef KJS_DEBUG_MEM 115 /** 116 * Clear statically allocated resources 117 */ 118 static void globalClear(); 119 #endif 114 120 private: 115 121 -
trunk/JavaScriptCore/kjs/math_object.cpp
r1024 r1623 141 141 Value MathFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args) 142 142 { 143 Value v = args[0]; 144 Number n = v.toNumber(exec); 145 double arg = n.value(); 146 147 Value v2 = args[1]; 148 Number n2 = v2.toNumber(exec); 149 double arg2 = n2.value(); 143 double arg = args[0].toNumber(exec); 144 double arg2 = args[1].toNumber(exec); 150 145 double result; 151 146 … … 241 236 if (isNaN(arg)) 242 237 result = arg; 243 if (isInf(arg) || isInf(-arg))238 else if (isInf(arg) || isInf(-arg)) 244 239 result = arg; 245 240 else if (arg == -0.5) -
trunk/JavaScriptCore/kjs/nodes.cpp
r1338 r1623 2 2 /* 3 3 * This file is part of the KDE libraries 4 * Copyright (C) 1999-200 1Harri Porten ([email protected])4 * Copyright (C) 1999-2002 Harri Porten ([email protected]) 5 5 * Copyright (C) 2001 Peter Kelly ([email protected]) 6 6 * … … 74 74 75 75 #ifdef KJS_DEBUG_MEM 76 std::list<Node *> Node::s_nodes;76 std::list<Node *> * Node::s_nodes = 0L; 77 77 #endif 78 78 // ------------------------------ Node ----------------------------------------- … … 83 83 refcount = 0; 84 84 #ifdef KJS_DEBUG_MEM 85 s_nodes.push_back( this ); 85 if (!s_nodes) 86 s_nodes = new std::list<Node *>; 87 s_nodes->push_back(this); 86 88 #endif 87 89 } … … 90 92 { 91 93 #ifdef KJS_DEBUG_MEM 92 s_nodes .remove( this );94 s_nodes->remove( this ); 93 95 #endif 94 96 } … … 97 99 void Node::finalCheck() 98 100 { 99 #ifdef APPLE_CHANGES100 101 fprintf( stderr, "Node::finalCheck(): list count : %d\n", (int)s_nodes.size() ); 101 #else102 fprintf( stderr, "Node::finalCheck(): list count : %d\n", s_nodes.size() );103 #endif104 std::list<Node *>::iterator it = s_nodes.begin();105 for ( uint i = 0; it != s_nodes.end() ; ++it, ++i )106 102 fprintf( stderr, "[%d] Still having node %p (%s) (refcount %d)\n", i, (void*)*it, typeid( **it ).name(), (*it)->refcount ); 103 delete s_nodes; 104 s_nodes = 0L; 107 105 } 108 106 #endif … … 747 745 } 748 746 747 #if KJS_MAX_STACK > 0 748 static int depth = 0; // sum of all concurrent interpreters 749 if (++depth > KJS_MAX_STACK) { 750 #ifndef NDEBUG 751 printInfo(exec, "Exceeded maximum function call depth", v, line); 752 #endif 753 return throwError(exec, RangeError, "Exceeded maximum call stack size."); 754 } 755 #endif 756 749 757 Value thisVal; 750 758 if (e.type() == ReferenceType) … … 770 778 Object thisObj = Object::dynamicCast(thisVal); 771 779 Value result = func.call(exec,thisObj, argList); 780 781 #if KJS_MAX_STACK > 0 782 --depth; 783 #endif 772 784 773 785 return result; … … 3140 3152 KJS_CHECKEXCEPTION 3141 3153 3142 #ifdef APPLE_CHANGES3143 3154 Completion c1 = element->execute(exec); 3144 3155 KJS_CHECKEXCEPTION; … … 3157 3168 3158 3169 return c1; 3159 #else3160 if (!elements)3161 return element->execute(exec);3162 3163 Completion c1 = elements->execute(exec);3164 KJS_CHECKEXCEPTION3165 if (c1.complType() != Normal)3166 return c1;3167 3168 Completion c2 = element->execute(exec);3169 KJS_CHECKEXCEPTION3170 3171 // The spec says to return c2 here, but it seems that mozilla returns c1 if3172 // c2 doesn't have a value3173 if (c2.complType() == Normal && c2.value().isNull())3174 return c1;3175 else3176 return c2;3177 #endif3178 3170 } 3179 3171 … … 3181 3173 void SourceElementsNode::processFuncDecl(ExecState *exec) 3182 3174 { 3183 #ifdef APPLE_CHANGES3184 3175 for (SourceElementsNode *node = this; node; node = node->elements) { 3185 3176 node->element->processFuncDecl(exec); 3186 3177 } 3187 #else3188 if (elements)3189 elements->processFuncDecl(exec);3190 3191 element->processFuncDecl(exec);3192 #endif3193 3178 } 3194 3179 3195 3180 void SourceElementsNode::processVarDecls(ExecState *exec) 3196 3181 { 3197 #ifdef APPLE_CHANGES3198 3182 for (SourceElementsNode *node = this; node; node = node->elements) { 3199 3183 node->element->processVarDecls(exec); 3200 3184 } 3201 #else3202 if (elements)3203 elements->processVarDecls(exec);3204 3205 element->processVarDecls(exec);3206 #endif3207 3185 } 3208 3186 -
trunk/JavaScriptCore/kjs/nodes.h
r1024 r1623 102 102 #ifdef KJS_DEBUG_MEM 103 103 // List of all nodes, for debugging purposes. Don't remove! 104 static std::list<Node *> s_nodes;104 static std::list<Node *> *s_nodes; 105 105 #endif 106 106 // disallow assignment -
trunk/JavaScriptCore/kjs/object.h
r1024 r1623 28 28 // Objects 29 29 30 // maximum global call stack size. Protects against accidental or 31 // malicious infinite recursions. Define to -1 if you want no limit. 32 #define KJS_MAX_STACK 1000 33 30 34 #include "value.h" 31 35 #include "types.h" -
trunk/JavaScriptCore/kjs/operations.cpp
r1326 r1623 245 245 Value KJS::mult(ExecState *exec, const Value &v1, const Value &v2, char oper) 246 246 { 247 Numbern1 = v1.toNumber(exec);248 Numbern2 = v2.toNumber(exec);247 double n1 = v1.toNumber(exec); 248 double n2 = v2.toNumber(exec); 249 249 250 250 double result; 251 251 252 252 if (oper == '*') 253 result = n1 .value() * n2.value();253 result = n1 * n2; 254 254 else if (oper == '/') 255 result = n1 .value() / n2.value();255 result = n1 / n2; 256 256 else 257 result = fmod(n1 .value(), n2.value());257 result = fmod(n1, n2); 258 258 259 259 return Number(result); -
trunk/JavaScriptCore/kjs/regexp.cpp
r1326 r1623 29 29 30 30 RegExp::RegExp(const UString &p, int f) 31 : pattern(p), fl ags(f)31 : pattern(p), flgs(f) 32 32 { 33 33 #ifdef HAVE_PCREPOSIX … … 36 36 int errorOffset; 37 37 38 if (fl ags & IgnoreCase)38 if (flgs & IgnoreCase) 39 39 pcreflags |= PCRE_CASELESS; 40 40 41 if (fl ags & Multiline)41 if (flgs & Multiline) 42 42 pcreflags |= PCRE_MULTILINE; 43 43 -
trunk/JavaScriptCore/kjs/regexp.h
r1024 r1623 45 45 RegExp(const UString &p, int f = None); 46 46 ~RegExp(); 47 int flags() const { return flgs; } 47 48 UString match(const UString &s, int i = -1, int *pos = 0L, int **ovector = 0L); 48 49 // test is unused. The JS spec says that RegExp.test should use … … 52 53 private: 53 54 const UString &pattern; 54 int fl ags;55 int flgs; 55 56 56 57 #ifndef HAVE_PCREPOSIX -
trunk/JavaScriptCore/kjs/regexp_object.cpp
r1326 r1623 150 150 151 151 RegExpObjectImp::RegExpObjectImp(ExecState *exec, 152 RegExpPrototypeImp *regProto, 153 FunctionPrototypeImp *funcProto) 152 FunctionPrototypeImp *funcProto, 153 RegExpPrototypeImp *regProto) 154 154 155 : InternalFunctionImp(funcProto), lastOvector(0L), lastNrSubPatterns(0) 155 156 { … … 176 177 } 177 178 178 ValueRegExpObjectImp::arrayOfMatches(ExecState *exec, const UString &result) const179 Object RegExpObjectImp::arrayOfMatches(ExecState *exec, const UString &result) const 179 180 { 180 181 List list; … … 187 188 list.append(String(substring)); 188 189 } 189 return exec->interpreter()->builtinArray().construct(exec, list); 190 } 191 192 Value RegExpObjectImp::get(ExecState *, const UString &p) const 190 Object arr = exec->interpreter()->builtinArray().construct(exec, list); 191 arr.put(exec, "index", Number(lastOvector[0])); 192 arr.put(exec, "input", String(lastString)); 193 return arr; 194 } 195 196 Value RegExpObjectImp::get(ExecState *exec, const UString &p) const 193 197 { 194 198 if (p[0] == '$' && lastOvector) … … 206 210 } 207 211 } 208 return Undefined();212 return InternalFunctionImp::get(exec, p); 209 213 } 210 214 … … 217 221 Object RegExpObjectImp::construct(ExecState *exec, const List &args) 218 222 { 219 String p = args[0].toString(exec); 220 String f = args[1].toString(exec); 221 UString flags = f.value(); 223 String p = args.isEmpty() ? UString("") : args[0].toString(exec); 224 UString flags = args[1].toString(exec); 222 225 223 226 RegExpPrototypeImp *proto = static_cast<RegExpPrototypeImp*>(exec->interpreter()->builtinRegExpPrototype().imp()); … … 234 237 dat->put(exec, "multiline", Boolean(multiline)); 235 238 236 dat->put(exec, "source", String(p.value()));239 dat->put(exec, "source", p); 237 240 dat->put(exec, "lastIndex", Number(0), DontDelete | DontEnum); 238 241 … … 255 258 256 259 // ECMA 15.10.3 257 Value RegExpObjectImp::call(ExecState */*exec*/, Object &/*thisObj*/, const List &/*args*/) 258 { 259 // TODO: implement constructor 260 return Undefined(); 261 } 260 Value RegExpObjectImp::call(ExecState *exec, Object &/*thisObj*/, 261 const List &args) 262 { 263 // TODO: handle RegExp argument case (15.10.3.1) 264 265 return construct(exec, args); 266 } -
trunk/JavaScriptCore/kjs/regexp_object.h
r1326 r1623 65 65 public: 66 66 RegExpObjectImp(ExecState *exec, 67 RegExpPrototypeImp *regProto,68 FunctionPrototypeImp *funcProto);67 FunctionPrototypeImp *funcProto, 68 RegExpPrototypeImp *regProto); 69 69 virtual ~RegExpObjectImp(); 70 70 virtual bool implementsConstruct() const; … … 76 76 int ** registerRegexp( const RegExp* re, const UString& s ); 77 77 void setSubPatterns(int num) { lastNrSubPatterns = num; } 78 ValuearrayOfMatches(ExecState *exec, const UString &result) const;78 Object arrayOfMatches(ExecState *exec, const UString &result) const; 79 79 private: 80 80 UString lastString; -
trunk/JavaScriptCore/kjs/string_object.cpp
r1326 r1623 58 58 replace StringProtoFuncImp::Replace DontEnum|Function 2 59 59 search StringProtoFuncImp::Search DontEnum|Function 1 60 slice StringProtoFuncImp::Slice DontEnum|Function 061 split StringProtoFuncImp::Split DontEnum|Function 160 slice StringProtoFuncImp::Slice DontEnum|Function 2 61 split StringProtoFuncImp::Split DontEnum|Function 2 62 62 substr StringProtoFuncImp::Substr DontEnum|Function 2 63 63 substring StringProtoFuncImp::Substring DontEnum|Function 2 … … 197 197 case Search: { 198 198 u = s; 199 RegExp* reg = 0; 199 RegExp *reg, *tmpReg = 0; 200 RegExpImp *imp = 0; 200 201 if (a0.isA(ObjectType) && a0.toObject(exec).inherits(&RegExpImp::info)) 201 202 { 202 RegExpImp*imp = static_cast<RegExpImp *>( a0.toObject(exec).imp() );203 imp = static_cast<RegExpImp *>( a0.toObject(exec).imp() ); 203 204 reg = imp->regExp(); 204 205 } … … 209 210 * replaced with the result of the expression new RegExp(regexp). 210 211 */ 211 reg = new RegExp(a0.toString(exec), RegExp::None);212 reg = tmpReg = new RegExp(a0.toString(exec), RegExp::None); 212 213 } 213 214 RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->interpreter()->builtinRegExp().imp()); 214 int **ovector = regExpObj->registerRegexp( reg, u);215 int **ovector = regExpObj->registerRegexp(reg, u); 215 216 UString mstr = reg->match(u, -1, &pos, ovector); 216 regExpObj->setSubPatterns(reg->subPatterns());217 if (a0.isA(StringType))218 delete reg;219 217 if (id == Search) { 220 218 result = Number(pos); 221 break; 222 } 223 if (mstr.isNull()) 224 result = Null(); 225 else 226 result = regExpObj->arrayOfMatches(exec,mstr); 219 } else { 220 // Exec 221 if ((reg->flags() & RegExp::Global) == 0) { 222 // case without 'g' flag is handled like RegExp.prototype.exec 223 if (mstr.isNull()) 224 return Null(); // no match 225 regExpObj->setSubPatterns(reg->subPatterns()); 226 result = regExpObj->arrayOfMatches(exec,mstr); 227 } else { 228 // return array of matches 229 List list; 230 int lastIndex = 0; 231 while (pos >= 0) { 232 list.append(String(mstr)); 233 lastIndex = pos; 234 pos += mstr.isEmpty() ? 1 : mstr.size(); 235 delete [] *ovector; 236 mstr = reg->match(u, pos, &pos, ovector); 237 } 238 if (imp) 239 imp->put(exec, "lastIndex", Number(lastIndex), DontDelete|DontEnum); 240 result = exec->interpreter()->builtinArray().construct(exec, list); 241 } 242 } 243 delete tmpReg; 244 break; 227 245 } 228 break;229 246 case Replace: 230 247 u = s; … … 329 346 break; 330 347 } 331 int *ovector;332 int mpos;333 348 pos = 0; 334 while ( 1) {349 while (pos < u.size()) { 335 350 // TODO: back references 351 int mpos; 352 int *ovector = 0L; 336 353 UString mstr = reg.match(u, pos, &mpos, &ovector); 354 delete [] ovector; ovector = 0L; 337 355 if (mpos < 0) 338 356 break; … … 344 362 } 345 363 } 346 delete [] ovector;347 364 } else if (a0.type() != UndefinedType) { 348 365 u2 = a0.toString(exec); -
trunk/JavaScriptCore/kjs/string_object.lut.h
r901 r1623 16 16 { "concat", StringProtoFuncImp::Concat, DontEnum|Function, 1, &stringTableEntries[26] }, 17 17 { 0, 0, 0, 0, 0 }, 18 { "split", StringProtoFuncImp::Split, DontEnum|Function, 1, &stringTableEntries[28] },18 { "split", StringProtoFuncImp::Split, DontEnum|Function, 2, &stringTableEntries[28] }, 19 19 { "anchor", StringProtoFuncImp::Anchor, DontEnum|Function, 1, 0 }, 20 20 { "charCodeAt", StringProtoFuncImp::CharCodeAt, DontEnum|Function, 1, 0 }, … … 32 32 { "fontsize", StringProtoFuncImp::Fontsize, DontEnum|Function, 1, 0 }, 33 33 { "substr", StringProtoFuncImp::Substr, DontEnum|Function, 2, 0 }, 34 { "slice", StringProtoFuncImp::Slice, DontEnum|Function, 0, &stringTableEntries[30] },34 { "slice", StringProtoFuncImp::Slice, DontEnum|Function, 2, &stringTableEntries[30] }, 35 35 { "substring", StringProtoFuncImp::Substring, DontEnum|Function, 2, 0 }, 36 36 { "toLowerCase", StringProtoFuncImp::ToLowerCase, DontEnum|Function, 0, 0 }, -
trunk/JavaScriptCore/kjs/types.cpp
r1024 r1623 270 270 } 271 271 272 #ifdef KJS_DEBUG_MEM 273 void List::globalClear() 274 { 275 delete ListImp::emptyList; 276 ListImp::emptyList = 0L; 277 } 278 #endif 279 280 272 281 // ------------------------------ Completion ----------------------------------- 273 282 -
trunk/JavaScriptCore/kjs/types.h
r1024 r1623 230 230 */ 231 231 static const List empty(); 232 #ifdef KJS_DEBUG_MEM 233 static void globalClear(); 234 #endif 232 235 }; 233 236 -
trunk/JavaScriptCore/kjs/ustring.cpp
r1371 r1623 341 341 return statBuffer; 342 342 } 343 344 #ifdef KJS_DEBUG_MEM 345 void UString::globalClear() 346 { 347 delete [] statBuffer; 348 statBuffer = 0L; 349 } 350 #endif 343 351 344 352 UString &UString::operator=(const char *c) -
trunk/JavaScriptCore/kjs/ustring.h
r1549 r1623 403 403 */ 404 404 static UString null; 405 #ifdef KJS_DEBUG_MEM 406 /** 407 * Clear statically allocated resources. 408 */ 409 static void globalClear(); 410 #endif 405 411 private: 406 412 void attach(Rep *r); -
trunk/JavaScriptCore/kjs/value.cpp
r1326 r1623 40 40 using namespace KJS; 41 41 42 // ----------------------------- -ValueImp -------------------------------------42 // ----------------------------- ValueImp ------------------------------------- 43 43 44 44 #if APPLE_CHANGES … … 382 382 return Undefined(0); 383 383 384 return Undefined( static_cast<UndefinedImp*>(v.imp()));384 return Undefined(); 385 385 } 386 386 … … 414 414 return Null(0); 415 415 416 return Null( static_cast<NullImp*>(v.imp()));416 return Null(); 417 417 } 418 418 … … 542 542 int Number::intValue() const 543 543 { 544 assert(rep); 545 return (int)((NumberImp*)rep)->value(); 544 return int(value()); 546 545 } 547 546 548 547 bool Number::isNaN() const 549 548 { 550 return KJS::isNaN( ((NumberImp*)rep)->value());549 return KJS::isNaN(value()); 551 550 } 552 551 553 552 bool Number::isInf() const 554 553 { 555 return KJS::isInf( ((NumberImp*)rep)->value());556 } 557 554 return KJS::isInf(value()); 555 } 556
Note:
See TracChangeset
for help on using the changeset viewer.