Changeset 33979 in webkit for trunk/JavaScriptCore/kjs/operations.cpp
- Timestamp:
- May 21, 2008, 6:20:45 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/operations.cpp
r29045 r33979 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 116 } 117 118 JSValue* throwOutOfMemoryError(ExecState* exec) 119 { 120 JSObject* error = Error::create(exec, GeneralError, "Out of memory"); 121 exec->setException(error); 122 return error; 126 123 } 127 124
Note:
See TracChangeset
for help on using the changeset viewer.