OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 // Pull out the length so that modifications to the length in the | 1046 // Pull out the length so that modifications to the length in the |
1047 // loop will not affect the looping and side effects are visible. | 1047 // loop will not affect the looping and side effects are visible. |
1048 var array = ToObject(this); | 1048 var array = ToObject(this); |
1049 var length = ToUint32(array.length); | 1049 var length = ToUint32(array.length); |
1050 | 1050 |
1051 if (!IS_SPEC_FUNCTION(f)) { | 1051 if (!IS_SPEC_FUNCTION(f)) { |
1052 throw MakeTypeError('called_non_callable', [ f ]); | 1052 throw MakeTypeError('called_non_callable', [ f ]); |
1053 } | 1053 } |
1054 if (IS_NULL_OR_UNDEFINED(receiver)) { | 1054 if (IS_NULL_OR_UNDEFINED(receiver)) { |
1055 receiver = %GetDefaultReceiver(f) || receiver; | 1055 receiver = %GetDefaultReceiver(f) || receiver; |
1056 } else if (!IS_SPEC_OBJECT(receiver)) { | 1056 } else if (!IS_SPEC_OBJECT(receiver) && %IsClassicModeFunction(f)) { |
1057 receiver = ToObject(receiver); | 1057 receiver = ToObject(receiver); |
1058 } | 1058 } |
1059 | 1059 |
1060 var result = new $Array(); | 1060 var result = new $Array(); |
1061 var accumulator = new InternalArray(); | 1061 var accumulator = new InternalArray(); |
1062 var accumulator_length = 0; | 1062 var accumulator_length = 0; |
1063 if (%DebugCallbackSupportsStepping(f)) { | 1063 if (%DebugCallbackSupportsStepping(f)) { |
1064 for (var i = 0; i < length; i++) { | 1064 for (var i = 0; i < length; i++) { |
1065 if (i in array) { | 1065 if (i in array) { |
1066 var element = array[i]; | 1066 var element = array[i]; |
(...skipping 30 matching lines...) Expand all Loading... |
1097 // Pull out the length so that modifications to the length in the | 1097 // Pull out the length so that modifications to the length in the |
1098 // loop will not affect the looping and side effects are visible. | 1098 // loop will not affect the looping and side effects are visible. |
1099 var array = ToObject(this); | 1099 var array = ToObject(this); |
1100 var length = TO_UINT32(array.length); | 1100 var length = TO_UINT32(array.length); |
1101 | 1101 |
1102 if (!IS_SPEC_FUNCTION(f)) { | 1102 if (!IS_SPEC_FUNCTION(f)) { |
1103 throw MakeTypeError('called_non_callable', [ f ]); | 1103 throw MakeTypeError('called_non_callable', [ f ]); |
1104 } | 1104 } |
1105 if (IS_NULL_OR_UNDEFINED(receiver)) { | 1105 if (IS_NULL_OR_UNDEFINED(receiver)) { |
1106 receiver = %GetDefaultReceiver(f) || receiver; | 1106 receiver = %GetDefaultReceiver(f) || receiver; |
1107 } else if (!IS_SPEC_OBJECT(receiver)) { | 1107 } else if (!IS_SPEC_OBJECT(receiver) && %IsClassicModeFunction(f)) { |
1108 receiver = ToObject(receiver); | 1108 receiver = ToObject(receiver); |
1109 } | 1109 } |
| 1110 |
1110 if (%DebugCallbackSupportsStepping(f)) { | 1111 if (%DebugCallbackSupportsStepping(f)) { |
1111 for (var i = 0; i < length; i++) { | 1112 for (var i = 0; i < length; i++) { |
1112 if (i in array) { | 1113 if (i in array) { |
1113 var element = array[i]; | 1114 var element = array[i]; |
1114 // Prepare break slots for debugger step in. | 1115 // Prepare break slots for debugger step in. |
1115 %DebugPrepareStepInIfStepping(f); | 1116 %DebugPrepareStepInIfStepping(f); |
1116 %_CallFunction(receiver, element, i, array, f); | 1117 %_CallFunction(receiver, element, i, array, f); |
1117 } | 1118 } |
1118 } | 1119 } |
1119 } else { | 1120 } else { |
(...skipping 20 matching lines...) Expand all Loading... |
1140 // Pull out the length so that modifications to the length in the | 1141 // Pull out the length so that modifications to the length in the |
1141 // loop will not affect the looping and side effects are visible. | 1142 // loop will not affect the looping and side effects are visible. |
1142 var array = ToObject(this); | 1143 var array = ToObject(this); |
1143 var length = TO_UINT32(array.length); | 1144 var length = TO_UINT32(array.length); |
1144 | 1145 |
1145 if (!IS_SPEC_FUNCTION(f)) { | 1146 if (!IS_SPEC_FUNCTION(f)) { |
1146 throw MakeTypeError('called_non_callable', [ f ]); | 1147 throw MakeTypeError('called_non_callable', [ f ]); |
1147 } | 1148 } |
1148 if (IS_NULL_OR_UNDEFINED(receiver)) { | 1149 if (IS_NULL_OR_UNDEFINED(receiver)) { |
1149 receiver = %GetDefaultReceiver(f) || receiver; | 1150 receiver = %GetDefaultReceiver(f) || receiver; |
1150 } else if (!IS_SPEC_OBJECT(receiver)) { | 1151 } else if (!IS_SPEC_OBJECT(receiver) && %IsClassicModeFunction(f)) { |
1151 receiver = ToObject(receiver); | 1152 receiver = ToObject(receiver); |
1152 } | 1153 } |
1153 | 1154 |
1154 if (%DebugCallbackSupportsStepping(f)) { | 1155 if (%DebugCallbackSupportsStepping(f)) { |
1155 for (var i = 0; i < length; i++) { | 1156 for (var i = 0; i < length; i++) { |
1156 if (i in array) { | 1157 if (i in array) { |
1157 var element = array[i]; | 1158 var element = array[i]; |
1158 // Prepare break slots for debugger step in. | 1159 // Prepare break slots for debugger step in. |
1159 %DebugPrepareStepInIfStepping(f); | 1160 %DebugPrepareStepInIfStepping(f); |
1160 if (%_CallFunction(receiver, element, i, array, f)) return true; | 1161 if (%_CallFunction(receiver, element, i, array, f)) return true; |
(...skipping 22 matching lines...) Expand all Loading... |
1183 // Pull out the length so that modifications to the length in the | 1184 // Pull out the length so that modifications to the length in the |
1184 // loop will not affect the looping and side effects are visible. | 1185 // loop will not affect the looping and side effects are visible. |
1185 var array = ToObject(this); | 1186 var array = ToObject(this); |
1186 var length = TO_UINT32(array.length); | 1187 var length = TO_UINT32(array.length); |
1187 | 1188 |
1188 if (!IS_SPEC_FUNCTION(f)) { | 1189 if (!IS_SPEC_FUNCTION(f)) { |
1189 throw MakeTypeError('called_non_callable', [ f ]); | 1190 throw MakeTypeError('called_non_callable', [ f ]); |
1190 } | 1191 } |
1191 if (IS_NULL_OR_UNDEFINED(receiver)) { | 1192 if (IS_NULL_OR_UNDEFINED(receiver)) { |
1192 receiver = %GetDefaultReceiver(f) || receiver; | 1193 receiver = %GetDefaultReceiver(f) || receiver; |
1193 } else if (!IS_SPEC_OBJECT(receiver)) { | 1194 } else if (!IS_SPEC_OBJECT(receiver) && %IsClassicModeFunction(f)) { |
1194 receiver = ToObject(receiver); | 1195 receiver = ToObject(receiver); |
1195 } | 1196 } |
1196 | 1197 |
1197 if (%DebugCallbackSupportsStepping(f)) { | 1198 if (%DebugCallbackSupportsStepping(f)) { |
1198 for (var i = 0; i < length; i++) { | 1199 for (var i = 0; i < length; i++) { |
1199 if (i in array) { | 1200 if (i in array) { |
1200 var element = array[i]; | 1201 var element = array[i]; |
1201 // Prepare break slots for debugger step in. | 1202 // Prepare break slots for debugger step in. |
1202 %DebugPrepareStepInIfStepping(f); | 1203 %DebugPrepareStepInIfStepping(f); |
1203 if (!%_CallFunction(receiver, element, i, array, f)) return false; | 1204 if (!%_CallFunction(receiver, element, i, array, f)) return false; |
(...skipping 21 matching lines...) Expand all Loading... |
1225 // Pull out the length so that modifications to the length in the | 1226 // Pull out the length so that modifications to the length in the |
1226 // loop will not affect the looping and side effects are visible. | 1227 // loop will not affect the looping and side effects are visible. |
1227 var array = ToObject(this); | 1228 var array = ToObject(this); |
1228 var length = TO_UINT32(array.length); | 1229 var length = TO_UINT32(array.length); |
1229 | 1230 |
1230 if (!IS_SPEC_FUNCTION(f)) { | 1231 if (!IS_SPEC_FUNCTION(f)) { |
1231 throw MakeTypeError('called_non_callable', [ f ]); | 1232 throw MakeTypeError('called_non_callable', [ f ]); |
1232 } | 1233 } |
1233 if (IS_NULL_OR_UNDEFINED(receiver)) { | 1234 if (IS_NULL_OR_UNDEFINED(receiver)) { |
1234 receiver = %GetDefaultReceiver(f) || receiver; | 1235 receiver = %GetDefaultReceiver(f) || receiver; |
1235 } else if (!IS_SPEC_OBJECT(receiver)) { | 1236 } else if (!IS_SPEC_OBJECT(receiver) && %IsClassicModeFunction(f)) { |
1236 receiver = ToObject(receiver); | 1237 receiver = ToObject(receiver); |
1237 } | 1238 } |
1238 | 1239 |
1239 var result = new $Array(); | 1240 var result = new $Array(); |
1240 var accumulator = new InternalArray(length); | 1241 var accumulator = new InternalArray(length); |
1241 if (%DebugCallbackSupportsStepping(f)) { | 1242 if (%DebugCallbackSupportsStepping(f)) { |
1242 for (var i = 0; i < length; i++) { | 1243 for (var i = 0; i < length; i++) { |
1243 if (i in array) { | 1244 if (i in array) { |
1244 var element = array[i]; | 1245 var element = array[i]; |
1245 // Prepare break slots for debugger step in. | 1246 // Prepare break slots for debugger step in. |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 )); | 1563 )); |
1563 | 1564 |
1564 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( | 1565 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( |
1565 "join", getFunction("join", ArrayJoin), | 1566 "join", getFunction("join", ArrayJoin), |
1566 "pop", getFunction("pop", ArrayPop), | 1567 "pop", getFunction("pop", ArrayPop), |
1567 "push", getFunction("push", ArrayPush) | 1568 "push", getFunction("push", ArrayPush) |
1568 )); | 1569 )); |
1569 } | 1570 } |
1570 | 1571 |
1571 SetUpArray(); | 1572 SetUpArray(); |
OLD | NEW |