|
Lines 154-160
static JSValue getProperty(ExecState* exec, JSObject* obj, unsigned index)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec1
|
| 154 |
static void putProperty(ExecState* exec, JSObject* obj, const Identifier& propertyName, JSValue value) |
154 |
static void putProperty(ExecState* exec, JSObject* obj, const Identifier& propertyName, JSValue value) |
| 155 |
{ |
155 |
{ |
| 156 |
PutPropertySlot slot; |
156 |
PutPropertySlot slot; |
| 157 |
obj->put(exec, propertyName, value, slot); |
157 |
obj->putVirtual(exec, propertyName, value, slot); |
| 158 |
} |
158 |
} |
| 159 |
|
159 |
|
| 160 |
static unsigned argumentClampedIndexFromStartOrEnd(ExecState* exec, int argument, unsigned length, unsigned undefinedValue = 0) |
160 |
static unsigned argumentClampedIndexFromStartOrEnd(ExecState* exec, int argument, unsigned length, unsigned undefinedValue = 0) |
|
Lines 357-367
EncodedJSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec2
|
| 357 |
JSObject* curObject = curArg.toObject(exec); |
357 |
JSObject* curObject = curArg.toObject(exec); |
| 358 |
for (unsigned k = 0; k < length; ++k) { |
358 |
for (unsigned k = 0; k < length; ++k) { |
| 359 |
if (JSValue v = getProperty(exec, curObject, k)) |
359 |
if (JSValue v = getProperty(exec, curObject, k)) |
| 360 |
arr->put(exec, n, v); |
360 |
arr->putVirtual(exec, n, v); |
| 361 |
n++; |
361 |
n++; |
| 362 |
} |
362 |
} |
| 363 |
} else { |
363 |
} else { |
| 364 |
arr->put(exec, n, curArg); |
364 |
arr->putVirtual(exec, n, curArg); |
| 365 |
n++; |
365 |
n++; |
| 366 |
} |
366 |
} |
| 367 |
if (i == argCount) |
367 |
if (i == argCount) |
|
Lines 415-425
EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec3
|
| 415 |
for (unsigned n = 0; n < exec->argumentCount(); n++) { |
415 |
for (unsigned n = 0; n < exec->argumentCount(); n++) { |
| 416 |
// Check for integer overflow; where safe we can do a fast put by index. |
416 |
// Check for integer overflow; where safe we can do a fast put by index. |
| 417 |
if (length + n >= length) |
417 |
if (length + n >= length) |
| 418 |
thisObj->put(exec, length + n, exec->argument(n)); |
418 |
thisObj->putVirtual(exec, length + n, exec->argument(n)); |
| 419 |
else { |
419 |
else { |
| 420 |
PutPropertySlot slot; |
420 |
PutPropertySlot slot; |
| 421 |
Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toString(exec)); |
421 |
Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toString(exec)); |
| 422 |
thisObj->put(exec, propertyName, exec->argument(n), slot); |
422 |
thisObj->putVirtual(exec, propertyName, exec->argument(n), slot); |
| 423 |
} |
423 |
} |
| 424 |
} |
424 |
} |
| 425 |
JSValue newLength(static_cast<int64_t>(length) + static_cast<int64_t>(exec->argumentCount())); |
425 |
JSValue newLength(static_cast<int64_t>(length) + static_cast<int64_t>(exec->argumentCount())); |
|
Lines 441-452
EncodedJSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec4
|
| 441 |
JSValue obj = getProperty(exec, thisObj, k); |
441 |
JSValue obj = getProperty(exec, thisObj, k); |
| 442 |
|
442 |
|
| 443 |
if (obj2) |
443 |
if (obj2) |
| 444 |
thisObj->put(exec, k, obj2); |
444 |
thisObj->putVirtual(exec, k, obj2); |
| 445 |
else |
445 |
else |
| 446 |
thisObj->deleteProperty(exec, k); |
446 |
thisObj->deleteProperty(exec, k); |
| 447 |
|
447 |
|
| 448 |
if (obj) |
448 |
if (obj) |
| 449 |
thisObj->put(exec, lk1, obj); |
449 |
thisObj->putVirtual(exec, lk1, obj); |
| 450 |
else |
450 |
else |
| 451 |
thisObj->deleteProperty(exec, lk1); |
451 |
thisObj->deleteProperty(exec, lk1); |
| 452 |
} |
452 |
} |
|
Lines 471-477
EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec5
|
| 471 |
else { |
471 |
else { |
| 472 |
for (unsigned k = 1; k < length; k++) { |
472 |
for (unsigned k = 1; k < length; k++) { |
| 473 |
if (JSValue obj = getProperty(exec, thisObj, k)) |
473 |
if (JSValue obj = getProperty(exec, thisObj, k)) |
| 474 |
thisObj->put(exec, k - 1, obj); |
474 |
thisObj->putVirtual(exec, k - 1, obj); |
| 475 |
else |
475 |
else |
| 476 |
thisObj->deleteProperty(exec, k - 1); |
476 |
thisObj->deleteProperty(exec, k - 1); |
| 477 |
} |
477 |
} |
|
Lines 500-506
EncodedJSValue JSC_HOST_CALL arrayProtoFuncSlice(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec6
|
| 500 |
unsigned n = 0; |
500 |
unsigned n = 0; |
| 501 |
for (unsigned k = begin; k < end; k++, n++) { |
501 |
for (unsigned k = begin; k < end; k++, n++) { |
| 502 |
if (JSValue v = getProperty(exec, thisObj, k)) |
502 |
if (JSValue v = getProperty(exec, thisObj, k)) |
| 503 |
resObj->put(exec, n, v); |
503 |
resObj->putVirtual(exec, n, v); |
| 504 |
} |
504 |
} |
| 505 |
resObj->setLength(n); |
505 |
resObj->setLength(n); |
| 506 |
return JSValue::encode(result); |
506 |
return JSValue::encode(result); |
|
Lines 559-566
EncodedJSValue JSC_HOST_CALL arrayProtoFuncSort(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec7
|
| 559 |
} |
559 |
} |
| 560 |
// Swap themin and i |
560 |
// Swap themin and i |
| 561 |
if (themin > i) { |
561 |
if (themin > i) { |
| 562 |
thisObj->put(exec, i, minObj); |
562 |
thisObj->putVirtual(exec, i, minObj); |
| 563 |
thisObj->put(exec, themin, iObj); |
563 |
thisObj->putVirtual(exec, themin, iObj); |
| 564 |
} |
564 |
} |
| 565 |
} |
565 |
} |
| 566 |
return JSValue::encode(thisObj); |
566 |
return JSValue::encode(thisObj); |
|
Lines 607-613
EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec8
|
| 607 |
else { |
607 |
else { |
| 608 |
for (unsigned k = begin; k < length - deleteCount; ++k) { |
608 |
for (unsigned k = begin; k < length - deleteCount; ++k) { |
| 609 |
if (JSValue v = getProperty(exec, thisObj, k + deleteCount)) |
609 |
if (JSValue v = getProperty(exec, thisObj, k + deleteCount)) |
| 610 |
thisObj->put(exec, k + additionalArgs, v); |
610 |
thisObj->putVirtual(exec, k + additionalArgs, v); |
| 611 |
else |
611 |
else |
| 612 |
thisObj->deleteProperty(exec, k + additionalArgs); |
612 |
thisObj->deleteProperty(exec, k + additionalArgs); |
| 613 |
} |
613 |
} |
|
Lines 620-626
EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec9
|
| 620 |
else { |
620 |
else { |
| 621 |
for (unsigned k = length - deleteCount; k > begin; --k) { |
621 |
for (unsigned k = length - deleteCount; k > begin; --k) { |
| 622 |
if (JSValue obj = getProperty(exec, thisObj, k + deleteCount - 1)) |
622 |
if (JSValue obj = getProperty(exec, thisObj, k + deleteCount - 1)) |
| 623 |
thisObj->put(exec, k + additionalArgs - 1, obj); |
623 |
thisObj->putVirtual(exec, k + additionalArgs - 1, obj); |
| 624 |
else |
624 |
else |
| 625 |
thisObj->deleteProperty(exec, k + additionalArgs - 1); |
625 |
thisObj->deleteProperty(exec, k + additionalArgs - 1); |
| 626 |
} |
626 |
} |
|
Lines 628-634
EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec10
|
| 628 |
} |
628 |
} |
| 629 |
} |
629 |
} |
| 630 |
for (unsigned k = 0; k < additionalArgs; ++k) |
630 |
for (unsigned k = 0; k < additionalArgs; ++k) |
| 631 |
thisObj->put(exec, k + begin, exec->argument(k + 2)); |
631 |
thisObj->putVirtual(exec, k + begin, exec->argument(k + 2)); |
| 632 |
|
632 |
|
| 633 |
putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length - deleteCount + additionalArgs)); |
633 |
putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length - deleteCount + additionalArgs)); |
| 634 |
return JSValue::encode(result); |
634 |
return JSValue::encode(result); |
|
Lines 650-663
EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec11
|
| 650 |
else { |
650 |
else { |
| 651 |
for (unsigned k = length; k > 0; --k) { |
651 |
for (unsigned k = length; k > 0; --k) { |
| 652 |
if (JSValue v = getProperty(exec, thisObj, k - 1)) |
652 |
if (JSValue v = getProperty(exec, thisObj, k - 1)) |
| 653 |
thisObj->put(exec, k + nrArgs - 1, v); |
653 |
thisObj->putVirtual(exec, k + nrArgs - 1, v); |
| 654 |
else |
654 |
else |
| 655 |
thisObj->deleteProperty(exec, k + nrArgs - 1); |
655 |
thisObj->deleteProperty(exec, k + nrArgs - 1); |
| 656 |
} |
656 |
} |
| 657 |
} |
657 |
} |
| 658 |
} |
658 |
} |
| 659 |
for (unsigned k = 0; k < nrArgs; ++k) |
659 |
for (unsigned k = 0; k < nrArgs; ++k) |
| 660 |
thisObj->put(exec, k, exec->argument(k)); |
660 |
thisObj->putVirtual(exec, k, exec->argument(k)); |
| 661 |
JSValue result = jsNumber(length + nrArgs); |
661 |
JSValue result = jsNumber(length + nrArgs); |
| 662 |
putProperty(exec, thisObj, exec->propertyNames().length, result); |
662 |
putProperty(exec, thisObj, exec->propertyNames().length, result); |
| 663 |
return JSValue::encode(result); |
663 |
return JSValue::encode(result); |
|
Lines 696-702
EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec12
|
| 696 |
|
696 |
|
| 697 |
JSValue result = cachedCall.call(); |
697 |
JSValue result = cachedCall.call(); |
| 698 |
if (result.toBoolean(exec)) |
698 |
if (result.toBoolean(exec)) |
| 699 |
resultArray->put(exec, filterIndex++, v); |
699 |
resultArray->putVirtual(exec, filterIndex++, v); |
| 700 |
} |
700 |
} |
| 701 |
if (k == length) |
701 |
if (k == length) |
| 702 |
return JSValue::encode(resultArray); |
702 |
return JSValue::encode(resultArray); |
|
Lines 717-723
EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec13
|
| 717 |
|
717 |
|
| 718 |
JSValue result = call(exec, function, callType, callData, applyThis, eachArguments); |
718 |
JSValue result = call(exec, function, callType, callData, applyThis, eachArguments); |
| 719 |
if (result.toBoolean(exec)) |
719 |
if (result.toBoolean(exec)) |
| 720 |
resultArray->put(exec, filterIndex++, v); |
720 |
resultArray->putVirtual(exec, filterIndex++, v); |
| 721 |
} |
721 |
} |
| 722 |
return JSValue::encode(resultArray); |
722 |
return JSValue::encode(resultArray); |
| 723 |
} |
723 |
} |
|
Lines 752-758
EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec14
|
| 752 |
cachedCall.setArgument(1, jsNumber(k)); |
752 |
cachedCall.setArgument(1, jsNumber(k)); |
| 753 |
cachedCall.setArgument(2, thisObj); |
753 |
cachedCall.setArgument(2, thisObj); |
| 754 |
|
754 |
|
| 755 |
resultArray->JSArray::put(exec, k, cachedCall.call()); |
755 |
JSArray::put(resultArray, exec, k, cachedCall.call()); |
| 756 |
} |
756 |
} |
| 757 |
} |
757 |
} |
| 758 |
for (; k < length && !exec->hadException(); ++k) { |
758 |
for (; k < length && !exec->hadException(); ++k) { |
|
Lines 773-779
EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec)
a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec15
|
| 773 |
return JSValue::encode(jsUndefined()); |
773 |
return JSValue::encode(jsUndefined()); |
| 774 |
|
774 |
|
| 775 |
JSValue result = call(exec, function, callType, callData, applyThis, eachArguments); |
775 |
JSValue result = call(exec, function, callType, callData, applyThis, eachArguments); |
| 776 |
resultArray->put(exec, k, result); |
776 |
resultArray->putVirtual(exec, k, result); |
| 777 |
} |
777 |
} |
| 778 |
|
778 |
|
| 779 |
return JSValue::encode(resultArray); |
779 |
return JSValue::encode(resultArray); |