Changeset 32286 in webkit
- Timestamp:
- Apr 20, 2008, 10:16:28 PM (17 years ago)
- Location:
- branches/squirrelfish/JavaScriptCore
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/squirrelfish/JavaScriptCore/ChangeLog
r32285 r32286 1 2008-04-20 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 Removed Machine.cpp from AllInOneFile.cpp, and manually inlined a few 6 things that used to be inlined automatically. 7 8 1.9% speedup on SunSpider. 9 10 My hope is that we'll face fewer surprises in Machine.cpp codegen, now 11 that GCC is making fewer decisions. The speedup seems to confirm that. 12 1 13 2008-04-20 Oliver Hunt <oliver@apple.com> 2 14 -
branches/squirrelfish/JavaScriptCore/JavaScriptCore.exp
r32188 r32286 89 89 __ZN3KJS11Interpreter8evaluateEPNS_9ExecStateERKNS_7UStringEiPKtiPNS_7JSValueE 90 90 __ZN3KJS11Interpreter8evaluateEPNS_9ExecStateERKNS_7UStringEiS5_PNS_7JSValueE 91 __ZN3KJS11JSImmediate4typeEPKNS_7JSValueE92 91 __ZN3KJS11JSImmediate8toObjectEPKNS_7JSValueEPNS_9ExecStateE 93 92 __ZN3KJS11JSImmediate8toStringEPKNS_7JSValueE … … 202 201 __ZN3KJS8jsStringEPKc 203 202 __ZN3KJS8jsStringERKNS_7UStringE 203 __ZN3KJS9Collector12heapAllocateILNS0_8HeapTypeE1EEEPvm 204 204 __ZN3KJS9Collector15recordExtraCostEm 205 205 __ZN3KJS9Collector17globalObjectCountEv … … 278 278 __ZNK3KJS8JSObject21getPropertyAttributesERKNS_10IdentifierERj 279 279 __ZNK3KJS8JSObject21implementsHasInstanceEv 280 __ZNK3KJS8JSObject3getEPNS_9ExecStateERKNS_10IdentifierE281 __ZNK3KJS8JSObject3getEPNS_9ExecStateEj282 280 __ZNK3KJS8JSObject4typeEv 283 281 __ZNK3KJS8JSObject8toNumberEPNS_9ExecStateE … … 297 295 __ZTVN3KJS19InternalFunctionImpE 298 296 __ZTVN3KJS8JSObjectE 297 __ZTVN3KJS9NumberImpE 299 298 _jscore_collector_introspection 300 299 _jscore_fastmalloc_introspection -
branches/squirrelfish/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r32196 r32286 102 102 14DA81900D99FD2000B0A4FB /* JSActivation.h in Headers */ = {isa = PBXBuildFile; fileRef = 14DA818E0D99FD2000B0A4FB /* JSActivation.h */; }; 103 103 14DE0D690D02431400AACCA2 /* JSGlobalObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DE0D680D02431400AACCA2 /* JSGlobalObject.cpp */; }; 104 14E0FF120DBAAED00007C0AB /* Machine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 149B15E70D81F986009CB8C7 /* Machine.cpp */; }; 104 105 14F252570D08DD8D004ECFFF /* JSVariableObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F252560D08DD8D004ECFFF /* JSVariableObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; 105 106 14F252610D08DF2F004ECFFF /* JSVariableObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14F252600D08DF2F004ECFFF /* JSVariableObject.cpp */; }; … … 1505 1506 14BD5A320A3E91F600BAF59C /* JSValueRef.cpp in Sources */, 1506 1507 14F252610D08DF2F004ECFFF /* JSVariableObject.cpp in Sources */, 1508 14E0FF120DBAAED00007C0AB /* Machine.cpp in Sources */, 1507 1509 E1EF79AA0CE97BA60088D500 /* UTF8.cpp in Sources */, 1508 1510 930754C108B0F68000AB3056 /* pcre_compile.cpp in Sources */, -
branches/squirrelfish/JavaScriptCore/VM/Machine.cpp
r32283 r32286 37 37 #include "JSLock.h" 38 38 #include "JSPropertyNameIterator.h" 39 #include "Parser.h" 39 40 #include "Register.h" 40 41 #include "internal.h" -
branches/squirrelfish/JavaScriptCore/kjs/AllInOneFile.cpp
r32137 r32286 71 71 #include "wtf/FastMalloc.cpp" 72 72 #include "wtf/TCSystemAlloc.cpp" 73 #include "VM/Machine.cpp"74 73 #include "VM/CodeGenerator.cpp" 75 74 #include "VM/RegisterFile.cpp" -
branches/squirrelfish/JavaScriptCore/kjs/JSImmediate.cpp
r32157 r32286 64 64 } 65 65 66 JSType JSImmediate::type(const JSValue *v)67 {68 ASSERT(isImmediate(v));69 70 uintptr_t tag = getTag(v);71 if (tag == UndefinedType)72 return v == jsUndefined() ? UndefinedType : NullType;73 return static_cast<JSType>(tag);74 }75 76 66 } // namespace KJS -
branches/squirrelfish/JavaScriptCore/kjs/JSImmediate.h
r32103 r32286 279 279 } 280 280 281 ALWAYS_INLINE JSType JSImmediate::type(const JSValue* v) 282 { 283 ASSERT(isImmediate(v)); 284 285 uintptr_t tag = getTag(v); 286 if (tag == UndefinedType) 287 return v == undefinedImmediate() ? UndefinedType : NullType; 288 return static_cast<JSType>(tag); 289 } 290 281 291 } // namespace KJS 282 292 -
branches/squirrelfish/JavaScriptCore/kjs/collector.cpp
r31787 r32286 286 286 287 287 return newCell; 288 }289 290 void* Collector::allocate(size_t s)291 {292 return heapAllocate<PrimaryHeap>(s);293 }294 295 void* Collector::allocateNumber(size_t s)296 {297 return heapAllocate<NumberHeap>(s);298 288 } 299 289 -
branches/squirrelfish/JavaScriptCore/kjs/collector.h
r32073 r32286 36 36 class Collector { 37 37 public: 38 static void* allocate(size_t s); 39 static void* allocateNumber(size_t s); 38 class Thread; 39 enum HeapType { PrimaryHeap, NumberHeap }; 40 41 static void* allocate(size_t s) 42 { 43 return heapAllocate<PrimaryHeap>(s); 44 } 45 46 static void* allocateNumber(size_t s) 47 { 48 return heapAllocate<NumberHeap>(s); 49 } 50 40 51 static bool collect(); 41 52 static bool isBusy(); // true if an allocation or collection is in progress … … 57 68 static HashCountedSet<const char*>* protectedObjectTypeCounts(); 58 69 59 class Thread;60 70 static void registerThread(); 61 71 … … 64 74 static bool isCellMarked(const JSCell*); 65 75 static void markCell(JSCell*); 66 67 enum HeapType { PrimaryHeap, NumberHeap };68 76 69 77 static void markStackObjectsConservatively(void* start, void* end); -
branches/squirrelfish/JavaScriptCore/kjs/internal.cpp
r32188 r32286 92 92 // ------------------------------ NumberImp ------------------------------------ 93 93 94 JSType NumberImp::type() const 95 { 96 return NumberType; 97 } 98 94 99 JSValue* NumberImp::toPrimitive(ExecState*, JSType) const 95 100 { -
branches/squirrelfish/JavaScriptCore/kjs/internal.h
r32188 r32286 65 65 }; 66 66 67 class NumberImp : public JSCell {68 friend class ConstantValues;69 friend JSValue *jsNumberCell(double);70 public:71 double value() const { return val; }72 73 virtual JSType type() const { return NumberType; }74 75 virtual JSValue* toPrimitive(ExecState*, JSType preferred = UnspecifiedType) const;76 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*& value);77 virtual bool toBoolean(ExecState *exec) const;78 virtual double toNumber(ExecState *exec) const;79 virtual double toNumber(ExecState* exec, Instruction* normalExitPC, Instruction* exceptionExitPC, Instruction*& resultPC) const;80 virtual UString toString(ExecState *exec) const;81 virtual JSObject *toObject(ExecState *exec) const;82 83 void* operator new(size_t size)84 {85 return Collector::allocateNumber(size);86 }87 private:88 NumberImp(double v) : val(v) { }89 90 virtual bool getUInt32(uint32_t&) const;91 virtual bool getTruncatedInt32(int32_t&) const;92 virtual bool getTruncatedUInt32(uint32_t&) const;93 94 double val;95 };96 97 98 67 // --------------------------------------------------------------------------- 99 68 // Evaluation -
branches/squirrelfish/JavaScriptCore/kjs/object.cpp
r32188 r32286 165 165 return ci->className; 166 166 return "Object"; 167 }168 169 JSValue *JSObject::get(ExecState *exec, const Identifier &propertyName) const170 {171 PropertySlot slot;172 173 if (const_cast<JSObject *>(this)->getPropertySlot(exec, propertyName, slot))174 return slot.getValue(exec, const_cast<JSObject *>(this), propertyName);175 176 return jsUndefined();177 }178 179 JSValue *JSObject::get(ExecState *exec, unsigned propertyName) const180 {181 PropertySlot slot;182 if (const_cast<JSObject *>(this)->getPropertySlot(exec, propertyName, slot))183 return slot.getValue(exec, const_cast<JSObject *>(this), propertyName);184 185 return jsUndefined();186 }187 188 bool JSObject::getPropertySlot(ExecState *exec, unsigned propertyName, PropertySlot& slot)189 {190 JSObject *imp = this;191 192 while (true) {193 if (imp->getOwnPropertySlot(exec, propertyName, slot))194 return true;195 196 JSValue *proto = imp->_proto;197 if (!proto->isObject())198 break;199 200 imp = static_cast<JSObject *>(proto);201 }202 203 return false;204 167 } 205 168 … … 306 269 } 307 270 308 // ECMA 8.6.2.4309 271 bool JSObject::hasProperty(ExecState *exec, const Identifier &propertyName) const 310 272 { -
branches/squirrelfish/JavaScriptCore/kjs/object.h
r32188 r32286 518 518 } 519 519 520 inline JSValue *JSObject::get(ExecState *exec, const Identifier &propertyName) const 521 { 522 PropertySlot slot; 523 524 if (const_cast<JSObject *>(this)->getPropertySlot(exec, propertyName, slot)) 525 return slot.getValue(exec, const_cast<JSObject *>(this), propertyName); 526 527 return jsUndefined(); 528 } 529 530 inline JSValue *JSObject::get(ExecState *exec, unsigned propertyName) const 531 { 532 PropertySlot slot; 533 if (const_cast<JSObject *>(this)->getPropertySlot(exec, propertyName, slot)) 534 return slot.getValue(exec, const_cast<JSObject *>(this), propertyName); 535 536 return jsUndefined(); 537 } 538 520 539 // It may seem crazy to inline a function this large but it makes a big difference 521 540 // since this is function very hot in variable lookup … … 533 552 object = static_cast<JSObject *>(proto); 534 553 } 554 } 555 556 inline bool JSObject::getPropertySlot(ExecState *exec, unsigned propertyName, PropertySlot& slot) 557 { 558 JSObject *imp = this; 559 560 while (true) { 561 if (imp->getOwnPropertySlot(exec, propertyName, slot)) 562 return true; 563 564 JSValue *proto = imp->_proto; 565 if (!proto->isObject()) 566 break; 567 568 imp = static_cast<JSObject *>(proto); 569 } 570 571 return false; 535 572 } 536 573 -
branches/squirrelfish/JavaScriptCore/kjs/value.cpp
r32158 r32286 233 233 } 234 234 235 // This method includes a PIC branch to set up the NumberImp's vtable, so we quarantine236 // it in a separate function to keep the normal case speedy.237 JSValue *jsNumberCell(double d)238 {239 return new NumberImp(d);240 }241 242 235 } // namespace KJS -
branches/squirrelfish/JavaScriptCore/kjs/value.h
r32188 r32286 181 181 }; 182 182 183 JSValue *jsNumberCell(double); 183 class NumberImp : public JSCell { 184 friend JSValue* jsNumberCell(double); 185 186 public: 187 double value() const { return val; } 188 189 virtual JSType type() const; 190 191 virtual JSValue* toPrimitive(ExecState*, JSType preferred = UnspecifiedType) const; 192 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*& value); 193 virtual bool toBoolean(ExecState* exec) const; 194 virtual double toNumber(ExecState* exec) const; 195 virtual double toNumber(ExecState* exec, Instruction* normalExitPC, Instruction* exceptionExitPC, Instruction*& resultPC) const; 196 virtual UString toString(ExecState* exec) const; 197 virtual JSObject* toObject(ExecState* exec) const; 198 199 void* operator new(size_t size) 200 { 201 return Collector::allocateNumber(size); 202 } 203 204 private: 205 NumberImp(double v) : val(v) { } 206 207 virtual bool getUInt32(uint32_t&) const; 208 virtual bool getTruncatedInt32(int32_t&) const; 209 virtual bool getTruncatedUInt32(uint32_t&) const; 210 211 double val; 212 }; 184 213 185 214 JSCell *jsString(const UString&); // returns empty string if passed null string … … 193 222 extern const double NaN; 194 223 extern const double Inf; 224 225 // Beware marking this function ALWAYS_INLINE: It takes a PIC branch, so 226 // inlining it may not always be a win. 227 inline JSValue* jsNumberCell(double d) 228 { 229 return new NumberImp(d); 230 } 195 231 196 232 ALWAYS_INLINE JSValue *jsUndefined()
Note:
See TracChangeset
for help on using the changeset viewer.