Changeset 42567 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Apr 15, 2009, 7:12:23 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/ArrayPrototype.cpp
r42563 r42567 589 589 unsigned filterIndex = 0; 590 590 unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); 591 if (callType == CallTypeHost || !isJSArray(&exec->globalData(), thisObj) || !asArray(thisObj)->canGetIndex(length - 1)) { 592 for (unsigned k = 0; k < length && !exec->hadException(); ++k) { 593 PropertySlot slot(thisObj); 594 595 if (!thisObj->getPropertySlot(exec, k, slot)) 596 continue; 597 598 JSValuePtr v = slot.getValue(exec, k); 599 600 ArgList eachArguments; 601 602 eachArguments.append(v); 603 eachArguments.append(jsNumber(exec, k)); 604 eachArguments.append(thisObj); 605 606 JSValuePtr result = call(exec, function, callType, callData, applyThis, eachArguments); 607 608 if (result.toBoolean(exec)) 609 resultArray->put(exec, filterIndex++, v); 610 } 611 } else { 591 unsigned k = 0; 592 if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) { 612 593 JSFunction* f = asFunction(function); 613 594 JSArray* array = asArray(thisObj); 614 595 CachedCall cachedCall(exec, f, 3, exec->exceptionSlot()); 615 for (unsigned k = 0; k < length && !exec->hadException(); ++k) { 596 for (; k < length && !exec->hadException(); ++k) { 597 if (!array->canGetIndex(k)) 598 break; 616 599 JSValuePtr v = array->getIndex(k); 617 600 cachedCall.setThis(applyThis); … … 619 602 cachedCall.setArgument(1, jsNumber(exec, k)); 620 603 cachedCall.setArgument(2, thisObj); 621 604 622 605 JSValuePtr result = cachedCall.call(); 623 606 if (result.toBoolean(exec)) 624 607 resultArray->put(exec, filterIndex++, v); 625 608 } 609 if (k == length) 610 return resultArray; 611 } 612 for (; k < length && !exec->hadException(); ++k) { 613 PropertySlot slot(thisObj); 614 615 if (!thisObj->getPropertySlot(exec, k, slot)) 616 continue; 617 618 JSValuePtr v = slot.getValue(exec, k); 619 620 ArgList eachArguments; 621 622 eachArguments.append(v); 623 eachArguments.append(jsNumber(exec, k)); 624 eachArguments.append(thisObj); 625 626 JSValuePtr result = call(exec, function, callType, callData, applyThis, eachArguments); 627 628 if (result.toBoolean(exec)) 629 resultArray->put(exec, filterIndex++, v); 626 630 } 627 631 return resultArray;
Note:
See TracChangeset
for help on using the changeset viewer.