Changeset 29817 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Jan 27, 2008, 12:54:25 AM (17 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_object.cpp
r29508 r29817 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten ([email protected]) 3 * Copyright (C) 2003, 2007 Apple Inc. All rights reserved.3 * Copyright (C) 2003, 2007, 2008 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2003 Peter Kelly ([email protected]) 5 5 * Copyright (C) 2006 Alexey Proskuryakov ([email protected]) … … 721 721 // ------------------------------ ArrayObjectImp ------------------------------- 722 722 723 ArrayObjectImp::ArrayObjectImp(ExecState* exec, 724 FunctionPrototype* funcProto, 725 ArrayPrototype* arrayProto) 726 : InternalFunctionImp(funcProto) 723 ArrayObjectImp::ArrayObjectImp(ExecState* exec, FunctionPrototype* funcProto, ArrayPrototype* arrayProto) 724 : InternalFunctionImp(funcProto, arrayProto->classInfo()->className) 727 725 { 728 726 // ECMA 15.4.3.1 Array.prototype -
trunk/JavaScriptCore/kjs/bool_object.cpp
r29588 r29817 86 86 87 87 BooleanObjectImp::BooleanObjectImp(ExecState* exec, FunctionPrototype* functionPrototype, BooleanPrototype* booleanPrototype) 88 : InternalFunctionImp(functionPrototype )88 : InternalFunctionImp(functionPrototype, booleanPrototype->classInfo()->className) 89 89 { 90 90 putDirect(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly); -
trunk/JavaScriptCore/kjs/date_object.cpp
r29508 r29817 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten ([email protected]) 3 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 440 440 // TODO: MakeTime (15.9.11.1) etc. ? 441 441 442 DateObjectImp::DateObjectImp(ExecState *exec, 443 FunctionPrototype *funcProto, 444 DatePrototype *dateProto) 445 : InternalFunctionImp(funcProto) 442 DateObjectImp::DateObjectImp(ExecState* exec, FunctionPrototype* funcProto, DatePrototype* dateProto) 443 : InternalFunctionImp(funcProto, dateProto->classInfo()->className) 446 444 { 447 445 static const Identifier* parsePropertyName = new Identifier("parse"); -
trunk/JavaScriptCore/kjs/error_object.cpp
r29588 r29817 43 43 // ECMA 15.9.4 44 44 ErrorPrototype::ErrorPrototype(ExecState* exec, ObjectPrototype* objectPrototype, FunctionPrototype* functionPrototype) 45 : JSObject(objectPrototype)45 : ErrorInstance(objectPrototype) 46 46 { 47 47 // The constructor will be added later in ErrorObjectImp's constructor … … 72 72 73 73 ErrorObjectImp::ErrorObjectImp(ExecState* exec, FunctionPrototype* funcProto, ErrorPrototype* errorProto) 74 : InternalFunctionImp(funcProto )74 : InternalFunctionImp(funcProto, errorProto->classInfo()->className) 75 75 { 76 76 // ECMA 15.11.3.1 Error.prototype 77 77 putDirect(exec->propertyNames().prototype, errorProto, DontEnum|DontDelete|ReadOnly); 78 78 putDirect(exec->propertyNames().length, jsNumber(1), DontDelete|ReadOnly|DontEnum); 79 //putDirect(namePropertyName, jsString(n));80 79 } 81 80 … … 107 106 // ------------------------------ NativeErrorPrototype ---------------------- 108 107 109 NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, ErrorPrototype* errorProto, UString name, UStringmessage)108 NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, ErrorPrototype* errorProto, const UString& name, const UString& message) 110 109 : JSObject(errorProto) 111 110 { … … 118 117 const ClassInfo NativeErrorImp::info = { "Function", &InternalFunctionImp::info, 0 }; 119 118 120 NativeErrorImp::NativeErrorImp(ExecState* exec, FunctionPrototype* funcProto, JSObject* prot)121 : InternalFunctionImp(funcProto )119 NativeErrorImp::NativeErrorImp(ExecState* exec, FunctionPrototype* funcProto, NativeErrorPrototype* prot) 120 : InternalFunctionImp(funcProto, Identifier(prot->getDirect(exec->propertyNames().name)->getString())) 122 121 , proto(prot) 123 122 { -
trunk/JavaScriptCore/kjs/error_object.h
r29588 r29817 34 34 }; 35 35 36 class ErrorPrototype : public JSObject{36 class ErrorPrototype : public ErrorInstance { 37 37 public: 38 38 ErrorPrototype(ExecState*, ObjectPrototype*, FunctionPrototype*); … … 53 53 class NativeErrorPrototype : public JSObject { 54 54 public: 55 NativeErrorPrototype(ExecState*, ErrorPrototype*, UString name, UStringmessage);55 NativeErrorPrototype(ExecState*, ErrorPrototype*, const UString& name, const UString& message); 56 56 }; 57 57 58 58 class NativeErrorImp : public InternalFunctionImp { 59 59 public: 60 NativeErrorImp(ExecState*, FunctionPrototype*, JSObject*);60 NativeErrorImp(ExecState*, FunctionPrototype*, NativeErrorPrototype*); 61 61 62 62 virtual bool implementsConstruct() const; -
trunk/JavaScriptCore/kjs/function.h
r29588 r29817 2 2 /* 3 3 * Copyright (C) 1999-2000 Harri Porten ([email protected]) 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.4 * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2007 Cameron Zwarich ([email protected]) 6 6 * Copyright (C) 2007 Maks Orlovich … … 42 42 public: 43 43 InternalFunctionImp(); 44 InternalFunctionImp(FunctionPrototype*);45 44 InternalFunctionImp(FunctionPrototype*, const Identifier&); 46 45 -
trunk/JavaScriptCore/kjs/function_object.cpp
r29588 r29817 1 // -*- c-basic-offset: 2 -*-2 1 /* 3 * This file is part of the KDE libraries4 2 * Copyright (C) 1999-2001 Harri Porten ([email protected]) 5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 4 * 7 5 * This library is free software; you can redistribute it and/or … … 79 77 } 80 78 81 if (thisObj->inherits(&InternalFunctionImp::info) && !static_cast<InternalFunctionImp*>(thisObj)->functionName().isNull()) 82 return jsString("\nfunction " + static_cast<InternalFunctionImp*>(thisObj)->functionName().ustring() + "() {\n [native code]\n}\n"); 83 84 return jsString("[function]"); 79 return jsString("function " + static_cast<InternalFunctionImp*>(thisObj)->functionName().ustring() + "() {\n [native code]\n}"); 85 80 } 86 81 … … 137 132 138 133 FunctionObjectImp::FunctionObjectImp(ExecState* exec, FunctionPrototype* functionPrototype) 139 : InternalFunctionImp(functionPrototype )134 : InternalFunctionImp(functionPrototype, functionPrototype->classInfo()->className) 140 135 { 141 136 putDirect(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly); -
trunk/JavaScriptCore/kjs/internal.cpp
r28468 r29817 2 2 * Copyright (C) 1999-2002 Harri Porten ([email protected]) 3 3 * Copyright (C) 2001 Peter Kelly ([email protected]) 4 * Copyright (C) 2004, 2007 Apple Inc. All rights reserved.4 * Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 227 227 } 228 228 229 InternalFunctionImp::InternalFunctionImp(FunctionPrototype* funcProto)230 : JSObject(funcProto)231 {232 }233 234 229 InternalFunctionImp::InternalFunctionImp(FunctionPrototype* funcProto, const Identifier& name) 235 230 : JSObject(funcProto) -
trunk/JavaScriptCore/kjs/number_object.cpp
r29588 r29817 1 // -*- c-basic-offset: 2 -*-2 1 /* 3 2 * Copyright (C) 1999-2000,2003 Harri Porten ([email protected]) 4 * Copyright (C) 2007 Apple Inc. All rights reserved.3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 5 4 * 6 5 * This library is free software; you can redistribute it and/or … … 275 274 } 276 275 277 void fractionalPartToString(char* buf, int& i, const char* result, int resultLength, int fractionalDigits)276 static void fractionalPartToString(char* buf, int& i, const char* result, int resultLength, int fractionalDigits) 278 277 { 279 278 if (fractionalDigits <= 0) … … 296 295 } 297 296 298 void exponentialPartToString(char* buf, int& i, int decimalPoint)297 static void exponentialPartToString(char* buf, int& i, int decimalPoint) 299 298 { 300 299 buf[i++] = 'e'; … … 442 441 if (e == precision - 1) 443 442 return jsString(s + m); 444 elseif (e >= 0) {443 if (e >= 0) { 445 444 if (e + 1 < m.size()) 446 445 return jsString(s + m.substr(0, e + 1) + "." + m.substr(e + 1)); … … 464 463 */ 465 464 NumberObjectImp::NumberObjectImp(ExecState* exec, FunctionPrototype* funcProto, NumberPrototype* numberProto) 466 : InternalFunctionImp(funcProto )465 : InternalFunctionImp(funcProto, numberProto->classInfo()->className) 467 466 { 468 467 // Number.Prototype … … 482 481 // ECMA 15.7.3 483 482 switch (token) { 484 case NaNValue: 485 return jsNaN(); 486 case NegInfinity: 487 return jsNumberCell(-Inf); 488 case PosInfinity: 489 return jsNumberCell(Inf); 490 case MaxValue: 491 return jsNumberCell(1.7976931348623157E+308); 492 case MinValue: 493 return jsNumberCell(5E-324); 494 } 483 case NaNValue: 484 return jsNaN(); 485 case NegInfinity: 486 return jsNumberCell(-Inf); 487 case PosInfinity: 488 return jsNumberCell(Inf); 489 case MaxValue: 490 return jsNumberCell(1.7976931348623157E+308); 491 case MinValue: 492 return jsNumberCell(5E-324); 493 } 494 ASSERT_NOT_REACHED(); 495 495 return jsNull(); 496 496 } … … 507 507 NumberInstance* obj = new NumberInstance(proto); 508 508 509 // FIXME: Check args[0]->isUndefined() instead of args.isEmpty()? 509 510 double n = args.isEmpty() ? 0 : args[0]->toNumber(exec); 510 511 obj->setInternalValue(jsNumber(n)); … … 515 516 JSValue* NumberObjectImp::callAsFunction(ExecState* exec, JSObject*, const List& args) 516 517 { 517 double n = args.isEmpty() ? 0 : args[0]->toNumber(exec);518 return jsNumber( n);518 // FIXME: Check args[0]->isUndefined() instead of args.isEmpty()? 519 return jsNumber(args.isEmpty() ? 0 : args[0]->toNumber(exec)); 519 520 } 520 521 -
trunk/JavaScriptCore/kjs/object_object.cpp
r29588 r29817 177 177 178 178 ObjectObjectImp::ObjectObjectImp(ExecState* exec, ObjectPrototype* objProto, FunctionPrototype* funcProto) 179 : InternalFunctionImp(funcProto )179 : InternalFunctionImp(funcProto, "Object") 180 180 { 181 181 // ECMA 15.2.3.1 -
trunk/JavaScriptCore/kjs/regexp_object.cpp
r29592 r29817 286 286 287 287 RegExpObjectImp::RegExpObjectImp(ExecState* exec, FunctionPrototype* funcProto, RegExpPrototype* regProto) 288 : InternalFunctionImp(funcProto )288 : InternalFunctionImp(funcProto, "RegExp") 289 289 , d(new RegExpObjectImpPrivate) 290 290 { -
trunk/JavaScriptCore/kjs/string_object.cpp
r29537 r29817 2 2 /* 3 3 * Copyright (C) 1999-2001 Harri Porten ([email protected]) 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 988 988 // ------------------------------ StringObjectImp ------------------------------ 989 989 990 StringObjectImp::StringObjectImp(ExecState* exec, 991 FunctionPrototype* funcProto, 992 StringPrototype* stringProto) 993 : InternalFunctionImp(funcProto) 990 StringObjectImp::StringObjectImp(ExecState* exec, FunctionPrototype* funcProto, StringPrototype* stringProto) 991 : InternalFunctionImp(funcProto, stringProto->classInfo()->className) 994 992 { 995 993 // ECMA 15.5.3.1 String.prototype
Note:
See TracChangeset
for help on using the changeset viewer.