Changeset 90401 in webkit for trunk/Source/JavaScriptCore/runtime/Operations.h
- Timestamp:
- Jul 5, 2011, 12:01:41 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/Operations.h
r83751 r90401 335 335 } 336 336 337 // See ES5 11.8.1/11.8.2/11.8.5 for definition of leftFirst, this value ensures correct 338 // evaluation ordering for argument conversions for '<' and '>'. For '<' pass the value 339 // true, for leftFirst, for '>' pass the value false (and reverse operand order). 340 template<bool leftFirst> 337 341 ALWAYS_INLINE bool jsLess(CallFrame* callFrame, JSValue v1, JSValue v2) 338 342 { … … 351 355 JSValue p1; 352 356 JSValue p2; 353 bool wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 354 bool wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 357 bool wasNotString1; 358 bool wasNotString2; 359 if (leftFirst) { 360 wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 361 wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 362 } else { 363 wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 364 wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 365 } 355 366 356 367 if (wasNotString1 | wasNotString2) 357 368 return n1 < n2; 358 359 369 return asString(p1)->value(callFrame) < asString(p2)->value(callFrame); 360 370 } 361 371 362 inline bool jsLessEq(CallFrame* callFrame, JSValue v1, JSValue v2) 372 // See ES5 11.8.3/11.8.4/11.8.5 for definition of leftFirst, this value ensures correct 373 // evaluation ordering for argument conversions for '<=' and '=>'. For '<=' pass the 374 // value true, for leftFirst, for '=>' pass the value false (and reverse operand order). 375 template<bool leftFirst> 376 ALWAYS_INLINE bool jsLessEq(CallFrame* callFrame, JSValue v1, JSValue v2) 363 377 { 364 378 if (v1.isInt32() && v2.isInt32()) … … 376 390 JSValue p1; 377 391 JSValue p2; 378 bool wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 379 bool wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 392 bool wasNotString1; 393 bool wasNotString2; 394 if (leftFirst) { 395 wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 396 wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 397 } else { 398 wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 399 wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 400 } 380 401 381 402 if (wasNotString1 | wasNotString2) 382 403 return n1 <= n2; 383 384 404 return !(asString(p2)->value(callFrame) < asString(p1)->value(callFrame)); 385 405 }
Note:
See TracChangeset
for help on using the changeset viewer.