Changeset 33344
- Timestamp:
- 05/12/08 23:04:20 (6 months ago)
- Location:
- branches/squirrelfish
- Files:
-
- 2 added
- 8 modified
-
JavaScriptCore/API/JSValueRef.cpp (modified) (1 diff)
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/VM/Machine.cpp (modified) (4 diffs)
-
JavaScriptCore/kjs/array_object.cpp (modified) (2 diffs)
-
JavaScriptCore/kjs/nodes.cpp (modified) (4 diffs)
-
JavaScriptCore/kjs/operations.cpp (modified) (2 diffs)
-
JavaScriptCore/kjs/operations.h (modified) (1 diff)
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/js/exception-thrown-from-equal-expected.txt (added)
-
LayoutTests/fast/js/exception-thrown-from-equal.html (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/squirrelfish/JavaScriptCore/API/JSValueRef.cpp
r33038 r33344 135 135 bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b) 136 136 { 137 JSLock lock; 138 ExecState* exec = toJS(ctx); 137 UNUSED_PARAM(ctx); 138 139 JSLock lock; 139 140 JSValue* jsA = toJS(a); 140 141 JSValue* jsB = toJS(b); 141 142 142 bool result = strictEqual(exec, jsA, jsB); // can't throw because it doesn't perform value conversion 143 ASSERT(!exec->hadException()); 143 bool result = strictEqual(jsA, jsB); 144 144 return result; 145 145 } -
branches/squirrelfish/JavaScriptCore/ChangeLog
r33343 r33344 1 2008-05-05 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs. 6 7 SunSpider reports a .4% speedup. Not sure what that's about. 8 9 * VM/Machine.cpp: 10 (KJS::Machine::privateExecute): Check for exception return from equal, 11 since toPrimitive can throw. 12 13 * kjs/operations.cpp: 14 (KJS::strictEqual): In response to an error I made in an earlier version 15 of this patch, I changed strictEqual to make clear the fact that it 16 performs no conversions and can't throw, making it slightly more efficient 17 in the process. 18 1 19 2008-05-05 Maciej Stachowiak <mjs@apple.com> 2 20 -
branches/squirrelfish/JavaScriptCore/VM/Machine.cpp
r33343 r33344 831 831 int src1 = (++vPC)->u.operand; 832 832 int src2 = (++vPC)->u.operand; 833 r[dst].u.jsValue = jsBoolean(equal(exec, r[src1].u.jsValue, r[src2].u.jsValue)); 833 JSValue* result = jsBoolean(equal(exec, r[src1].u.jsValue, r[src2].u.jsValue)); 834 VM_CHECK_EXCEPTION(); 835 r[dst].u.jsValue = result; 834 836 835 837 ++vPC; … … 846 848 int src1 = (++vPC)->u.operand; 847 849 int src2 = (++vPC)->u.operand; 848 r[dst].u.jsValue = jsBoolean(!equal(exec, r[src1].u.jsValue, r[src2].u.jsValue)); 850 JSValue* result = jsBoolean(!equal(exec, r[src1].u.jsValue, r[src2].u.jsValue)); 851 VM_CHECK_EXCEPTION(); 852 r[dst].u.jsValue = result; 849 853 850 854 ++vPC; … … 861 865 int src1 = (++vPC)->u.operand; 862 866 int src2 = (++vPC)->u.operand; 863 r[dst].u.jsValue = jsBoolean(strictEqual( exec,r[src1].u.jsValue, r[src2].u.jsValue));864 867 r[dst].u.jsValue = jsBoolean(strictEqual(r[src1].u.jsValue, r[src2].u.jsValue)); 868 865 869 ++vPC; 866 870 NEXT_OPCODE; … … 876 880 int src1 = (++vPC)->u.operand; 877 881 int src2 = (++vPC)->u.operand; 878 r[dst].u.jsValue = jsBoolean(!strictEqual( exec,r[src1].u.jsValue, r[src2].u.jsValue));882 r[dst].u.jsValue = jsBoolean(!strictEqual(r[src1].u.jsValue, r[src2].u.jsValue)); 879 883 880 884 ++vPC; -
branches/squirrelfish/JavaScriptCore/kjs/array_object.cpp
r33188 r33344 675 675 if (!e) 676 676 continue; 677 if (strictEqual( exec,searchElement, e))677 if (strictEqual(searchElement, e)) 678 678 return jsNumber(index); 679 679 } … … 704 704 if (!e) 705 705 continue; 706 if (strictEqual( exec,searchElement, e))706 if (strictEqual(searchElement, e)) 707 707 return jsNumber(index); 708 708 } -
branches/squirrelfish/JavaScriptCore/kjs/nodes.cpp
r33342 r33344 3717 3717 KJS_CHECKEXCEPTIONBOOLEAN 3718 3718 3719 return strictEqual( exec,v1, v2);3719 return strictEqual(v1, v2); 3720 3720 } 3721 3721 … … 3751 3751 KJS_CHECKEXCEPTIONBOOLEAN 3752 3752 3753 return !strictEqual( exec,v1, v2);3753 return !strictEqual(v1, v2); 3754 3754 } 3755 3755 … … 5486 5486 JSValue* v = clause->evaluate(exec); 5487 5487 KJS_CHECKEXCEPTION 5488 if (strictEqual( exec,input, v)) {5488 if (strictEqual(input, v)) { 5489 5489 JSValue* res = clause->executeStatements(exec); 5490 5490 if (exec->completionType() != Normal) … … 5505 5505 JSValue* v = clause->evaluate(exec); 5506 5506 KJS_CHECKEXCEPTION 5507 if (strictEqual( exec,input, v)) {5507 if (strictEqual(input, v)) { 5508 5508 JSValue* res = clause->executeStatements(exec); 5509 5509 if (exec->completionType() != Normal) -
branches/squirrelfish/JavaScriptCore/kjs/operations.cpp
r33199 r33344 99 99 } 100 100 101 bool strictEqual( ExecState *exec, JSValue *v1, JSValue *v2)101 bool strictEqual(JSValue* v1, JSValue* v2) 102 102 { 103 103 JSType t1 = v1->type(); … … 106 106 if (t1 != t2) 107 107 return false; 108 if (t1 == UndefinedType || t1 == NullType) 109 return true; 110 if (t1 == NumberType) { 111 double n1 = v1->toNumber(exec); 112 double n2 = v2->toNumber(exec); 113 if (n1 == n2) 114 return true; 115 return false; 116 } else if (t1 == StringType) 117 return v1->toString(exec) == v2->toString(exec); 118 else if (t2 == BooleanType) 119 return v1->toBoolean(exec) == v2->toBoolean(exec); 108 109 if (t1 == NumberType) 110 return v1->getNumber() == v2->getNumber(); 120 111 121 if (v1 == v2) 122 return true; 123 /* TODO: joined objects */ 112 if (t1 == StringType) 113 return static_cast<StringImp*>(v1)->value() == static_cast<StringImp*>(v2)->value(); 124 114 125 return false;115 return v1 == v2; // covers object, boolean, null, and undefined types 126 116 } 127 117 -
branches/squirrelfish/JavaScriptCore/kjs/operations.h
r33199 r33344 30 30 31 31 bool equal(ExecState *exec, JSValue *v1, JSValue *v2); 32 bool strictEqual( ExecState *exec, JSValue *v1, JSValue *v2);32 bool strictEqual(JSValue*, JSValue*); 33 33 JSValue* throwOutOfMemoryError(ExecState*); 34 34 } -
branches/squirrelfish/LayoutTests/ChangeLog
r33334 r33344 1 2008-05-05 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 Layout test for exceptions thrown from equality comparisons. 6 7 * fast/js/exception-thrown-from-equal-expected.txt: Added. 8 * fast/js/exception-thrown-from-equal.html: Added. 9 1 10 2008-05-04 Oliver Hunt <oliver@apple.com> 2 11