| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 AllocateJSArray(masm, | 1231 AllocateJSArray(masm, |
| 1232 edi, | 1232 edi, |
| 1233 eax, | 1233 eax, |
| 1234 ebx, | 1234 ebx, |
| 1235 ecx, | 1235 ecx, |
| 1236 edx, | 1236 edx, |
| 1237 edi, | 1237 edi, |
| 1238 false, | 1238 false, |
| 1239 &prepare_generic_code_call); | 1239 &prepare_generic_code_call); |
| 1240 __ IncrementCounter(counters->array_function_native(), 1); | 1240 __ IncrementCounter(counters->array_function_native(), 1); |
| 1241 __ mov(eax, ebx); | 1241 __ push(ebx); |
| 1242 __ pop(ebx); | 1242 __ mov(ebx, Operand(esp, kPointerSize)); |
| 1243 if (construct_call) { | |
| 1244 __ pop(edi); | |
| 1245 } | |
| 1246 __ push(eax); | |
| 1247 // eax: JSArray | |
| 1248 // ebx: argc | 1243 // ebx: argc |
| 1249 // edx: elements_array_end (untagged) | 1244 // edx: elements_array_end (untagged) |
| 1250 // esp[0]: JSArray | 1245 // esp[0]: JSArray |
| 1251 // esp[4]: return address | 1246 // esp[4]: argc |
| 1252 // esp[8]: last argument | 1247 // esp[8]: constructor (only if construct_call) |
| 1248 // esp[12]: return address |
| 1249 // esp[16]: last argument |
| 1253 | 1250 |
| 1254 // Location of the last argument | 1251 // Location of the last argument |
| 1255 __ lea(edi, Operand(esp, 2 * kPointerSize)); | 1252 int last_arg_offset = (construct_call ? 4 : 3) * kPointerSize; |
| 1253 __ lea(edi, Operand(esp, last_arg_offset)); |
| 1256 | 1254 |
| 1257 // Location of the first array element (Parameter fill_with_holes to | 1255 // Location of the first array element (Parameter fill_with_holes to |
| 1258 // AllocateJSArrayis false, so the FixedArray is returned in ecx). | 1256 // AllocateJSArray is false, so the FixedArray is returned in ecx). |
| 1259 __ lea(edx, Operand(ecx, FixedArray::kHeaderSize - kHeapObjectTag)); | 1257 __ lea(edx, Operand(ecx, FixedArray::kHeaderSize - kHeapObjectTag)); |
| 1260 | 1258 |
| 1259 Label has_non_smi_element; |
| 1260 |
| 1261 // ebx: argc | 1261 // ebx: argc |
| 1262 // edx: location of the first array element | 1262 // edx: location of the first array element |
| 1263 // edi: location of the last argument | 1263 // edi: location of the last argument |
| 1264 // esp[0]: JSArray | 1264 // esp[0]: JSArray |
| 1265 // esp[4]: return address | 1265 // esp[4]: argc |
| 1266 // esp[8]: last argument | 1266 // esp[8]: constructor (only if construct_call) |
| 1267 // esp[12]: return address |
| 1268 // esp[16]: last argument |
| 1267 Label loop, entry; | 1269 Label loop, entry; |
| 1268 __ mov(ecx, ebx); | 1270 __ mov(ecx, ebx); |
| 1269 __ jmp(&entry); | 1271 __ jmp(&entry); |
| 1270 __ bind(&loop); | 1272 __ bind(&loop); |
| 1271 __ mov(eax, Operand(edi, ecx, times_pointer_size, 0)); | 1273 __ mov(eax, Operand(edi, ecx, times_pointer_size, 0)); |
| 1274 if (FLAG_smi_only_arrays) { |
| 1275 __ JumpIfNotSmi(eax, &has_non_smi_element); |
| 1276 } |
| 1272 __ mov(Operand(edx, 0), eax); | 1277 __ mov(Operand(edx, 0), eax); |
| 1273 __ add(edx, Immediate(kPointerSize)); | 1278 __ add(edx, Immediate(kPointerSize)); |
| 1274 __ bind(&entry); | 1279 __ bind(&entry); |
| 1275 __ dec(ecx); | 1280 __ dec(ecx); |
| 1276 __ j(greater_equal, &loop); | 1281 __ j(greater_equal, &loop); |
| 1277 | 1282 |
| 1278 // Remove caller arguments from the stack and return. | 1283 // Remove caller arguments from the stack and return. |
| 1279 // ebx: argc | 1284 // ebx: argc |
| 1280 // esp[0]: JSArray | 1285 // esp[0]: JSArray |
| 1281 // esp[4]: return address | 1286 // esp[4]: argc |
| 1282 // esp[8]: last argument | 1287 // esp[8]: constructor (only if construct_call) |
| 1288 // esp[12]: return address |
| 1289 // esp[16]: last argument |
| 1290 __ mov(ecx, Operand(esp, last_arg_offset - kPointerSize)); |
| 1283 __ pop(eax); | 1291 __ pop(eax); |
| 1284 __ pop(ecx); | 1292 __ pop(ebx); |
| 1285 __ lea(esp, Operand(esp, ebx, times_pointer_size, 1 * kPointerSize)); | 1293 __ lea(esp, Operand(esp, ebx, times_pointer_size, |
| 1286 __ push(ecx); | 1294 last_arg_offset - kPointerSize)); |
| 1287 __ ret(0); | 1295 __ jmp(ecx); |
| 1296 |
| 1297 __ bind(&has_non_smi_element); |
| 1298 // Throw away the array that's only been partially constructed. |
| 1299 __ pop(eax); |
| 1288 | 1300 |
| 1289 // Restore argc and constructor before running the generic code. | 1301 // Restore argc and constructor before running the generic code. |
| 1290 __ bind(&prepare_generic_code_call); | 1302 __ bind(&prepare_generic_code_call); |
| 1291 __ pop(eax); | 1303 __ pop(eax); |
| 1292 if (construct_call) { | 1304 if (construct_call) { |
| 1293 __ pop(edi); | 1305 __ pop(edi); |
| 1294 } | 1306 } |
| 1295 __ jmp(call_generic_code); | 1307 __ jmp(call_generic_code); |
| 1296 } | 1308 } |
| 1297 | 1309 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1677 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1689 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1678 generator.Generate(); | 1690 generator.Generate(); |
| 1679 } | 1691 } |
| 1680 | 1692 |
| 1681 | 1693 |
| 1682 #undef __ | 1694 #undef __ |
| 1683 } | 1695 } |
| 1684 } // namespace v8::internal | 1696 } // namespace v8::internal |
| 1685 | 1697 |
| 1686 #endif // V8_TARGET_ARCH_IA32 | 1698 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |