Changeset 222563 in webkit for trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
- Timestamp:
- Sep 27, 2017, 11:37:41 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r222473 r222563 870 870 NativeCallFrameTracer tracer(vm, exec); 871 871 872 array->push (exec, JSValue::decode(encodedValue));872 array->pushInline(exec, JSValue::decode(encodedValue)); 873 873 return JSValue::encode(jsNumber(array->length())); 874 874 } … … 879 879 NativeCallFrameTracer tracer(vm, exec); 880 880 881 array->push(exec, JSValue(JSValue::EncodeAsDouble, value)); 881 array->pushInline(exec, JSValue(JSValue::EncodeAsDouble, value)); 882 return JSValue::encode(jsNumber(array->length())); 883 } 884 885 EncodedJSValue JIT_OPERATION operationArrayPushMultiple(ExecState* exec, JSArray* array, void* buffer, int32_t elementCount) 886 { 887 VM& vm = exec->vm(); 888 NativeCallFrameTracer tracer(&vm, exec); 889 auto scope = DECLARE_THROW_SCOPE(vm); 890 891 // We assume that multiple JSArray::push calls with ArrayWithInt32/ArrayWithContiguous do not cause JS traps. 892 // If it can cause any JS interactions, we can call the caller JS function of this function and overwrite the 893 // content of ScratchBuffer. If the IndexingType is now ArrayWithInt32/ArrayWithContiguous, we can ensure 894 // that there is no indexed accessors in this object and its prototype chain. 895 // 896 // ArrayWithArrayStorage is also OK. It can have indexed accessors. But if you define an indexed accessor, the array's length 897 // becomes larger than that index. So Array#push never overlaps with this accessor. So accessors are never called unless 898 // the IndexingType is ArrayWithSlowPutArrayStorage which could have an indexed accessor in a prototype chain. 899 RELEASE_ASSERT(!shouldUseSlowPut(array->indexingType())); 900 901 EncodedJSValue* values = static_cast<EncodedJSValue*>(buffer); 902 for (int32_t i = 0; i < elementCount; ++i) { 903 array->pushInline(exec, JSValue::decode(values[i])); 904 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 905 } 906 return JSValue::encode(jsNumber(array->length())); 907 } 908 909 EncodedJSValue JIT_OPERATION operationArrayPushDoubleMultiple(ExecState* exec, JSArray* array, void* buffer, int32_t elementCount) 910 { 911 VM& vm = exec->vm(); 912 NativeCallFrameTracer tracer(&vm, exec); 913 auto scope = DECLARE_THROW_SCOPE(vm); 914 915 // We assume that multiple JSArray::push calls with ArrayWithDouble do not cause JS traps. 916 // If it can cause any JS interactions, we can call the caller JS function of this function and overwrite the 917 // content of ScratchBuffer. If the IndexingType is now ArrayWithDouble, we can ensure 918 // that there is no indexed accessors in this object and its prototype chain. 919 ASSERT(array->indexingType() == ArrayWithDouble); 920 921 double* values = static_cast<double*>(buffer); 922 for (int32_t i = 0; i < elementCount; ++i) { 923 array->pushInline(exec, JSValue(JSValue::EncodeAsDouble, values[i])); 924 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 925 } 882 926 return JSValue::encode(jsNumber(array->length())); 883 927 }
Note:
See TracChangeset
for help on using the changeset viewer.