| 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 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 Label no_parameter_map; | 1268 Label no_parameter_map; |
| 1269 __ test(ebx, ebx); | 1269 __ test(ebx, ebx); |
| 1270 __ j(zero, &no_parameter_map, Label::kNear); | 1270 __ j(zero, &no_parameter_map, Label::kNear); |
| 1271 __ lea(ebx, Operand(ebx, times_2, kParameterMapHeaderSize)); | 1271 __ lea(ebx, Operand(ebx, times_2, kParameterMapHeaderSize)); |
| 1272 __ bind(&no_parameter_map); | 1272 __ bind(&no_parameter_map); |
| 1273 | 1273 |
| 1274 // 2. Backing store. | 1274 // 2. Backing store. |
| 1275 __ lea(ebx, Operand(ebx, ecx, times_2, FixedArray::kHeaderSize)); | 1275 __ lea(ebx, Operand(ebx, ecx, times_2, FixedArray::kHeaderSize)); |
| 1276 | 1276 |
| 1277 // 3. Arguments object. | 1277 // 3. Arguments object. |
| 1278 __ add(ebx, Immediate(Heap::kArgumentsObjectSize)); | 1278 __ add(ebx, Immediate(Heap::kSloppyArgumentsObjectSize)); |
| 1279 | 1279 |
| 1280 // Do the allocation of all three objects in one go. | 1280 // Do the allocation of all three objects in one go. |
| 1281 __ Allocate(ebx, eax, edx, edi, &runtime, TAG_OBJECT); | 1281 __ Allocate(ebx, eax, edx, edi, &runtime, TAG_OBJECT); |
| 1282 | 1282 |
| 1283 // eax = address of new object(s) (tagged) | 1283 // eax = address of new object(s) (tagged) |
| 1284 // ecx = argument count (tagged) | 1284 // ecx = argument count (tagged) |
| 1285 // esp[0] = mapped parameter count (tagged) | 1285 // esp[0] = mapped parameter count (tagged) |
| 1286 // esp[8] = parameter count (tagged) | 1286 // esp[8] = parameter count (tagged) |
| 1287 // esp[12] = address of receiver argument | 1287 // esp[12] = address of receiver argument |
| 1288 // Get the arguments boilerplate from the current native context into edi. | 1288 // Get the arguments boilerplate from the current native context into edi. |
| 1289 Label has_mapped_parameters, copy; | 1289 Label has_mapped_parameters, copy; |
| 1290 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 1290 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 1291 __ mov(edi, FieldOperand(edi, GlobalObject::kNativeContextOffset)); | 1291 __ mov(edi, FieldOperand(edi, GlobalObject::kNativeContextOffset)); |
| 1292 __ mov(ebx, Operand(esp, 0 * kPointerSize)); | 1292 __ mov(ebx, Operand(esp, 0 * kPointerSize)); |
| 1293 __ test(ebx, ebx); | 1293 __ test(ebx, ebx); |
| 1294 __ j(not_zero, &has_mapped_parameters, Label::kNear); | 1294 __ j(not_zero, &has_mapped_parameters, Label::kNear); |
| 1295 __ mov(edi, Operand(edi, | 1295 __ mov(edi, Operand(edi, |
| 1296 Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX))); | 1296 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_BOILERPLATE_INDEX))); |
| 1297 __ jmp(©, Label::kNear); | 1297 __ jmp(©, Label::kNear); |
| 1298 | 1298 |
| 1299 __ bind(&has_mapped_parameters); | 1299 __ bind(&has_mapped_parameters); |
| 1300 __ mov(edi, Operand(edi, | 1300 __ mov(edi, Operand(edi, |
| 1301 Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX))); | 1301 Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX))); |
| 1302 __ bind(©); | 1302 __ bind(©); |
| 1303 | 1303 |
| 1304 // eax = address of new object (tagged) | 1304 // eax = address of new object (tagged) |
| 1305 // ebx = mapped parameter count (tagged) | 1305 // ebx = mapped parameter count (tagged) |
| 1306 // ecx = argument count (tagged) | 1306 // ecx = argument count (tagged) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1323 | 1323 |
| 1324 // Use the length (smi tagged) and set that as an in-object property too. | 1324 // Use the length (smi tagged) and set that as an in-object property too. |
| 1325 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 1325 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
| 1326 __ mov(FieldOperand(eax, JSObject::kHeaderSize + | 1326 __ mov(FieldOperand(eax, JSObject::kHeaderSize + |
| 1327 Heap::kArgumentsLengthIndex * kPointerSize), | 1327 Heap::kArgumentsLengthIndex * kPointerSize), |
| 1328 ecx); | 1328 ecx); |
| 1329 | 1329 |
| 1330 // Set up the elements pointer in the allocated arguments object. | 1330 // Set up the elements pointer in the allocated arguments object. |
| 1331 // If we allocated a parameter map, edi will point there, otherwise to the | 1331 // If we allocated a parameter map, edi will point there, otherwise to the |
| 1332 // backing store. | 1332 // backing store. |
| 1333 __ lea(edi, Operand(eax, Heap::kArgumentsObjectSize)); | 1333 __ lea(edi, Operand(eax, Heap::kSloppyArgumentsObjectSize)); |
| 1334 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi); | 1334 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi); |
| 1335 | 1335 |
| 1336 // eax = address of new object (tagged) | 1336 // eax = address of new object (tagged) |
| 1337 // ebx = mapped parameter count (tagged) | 1337 // ebx = mapped parameter count (tagged) |
| 1338 // ecx = argument count (tagged) | 1338 // ecx = argument count (tagged) |
| 1339 // edi = address of parameter map or backing store (tagged) | 1339 // edi = address of parameter map or backing store (tagged) |
| 1340 // esp[0] = mapped parameter count (tagged) | 1340 // esp[0] = mapped parameter count (tagged) |
| 1341 // esp[8] = parameter count (tagged) | 1341 // esp[8] = parameter count (tagged) |
| 1342 // esp[12] = address of receiver argument | 1342 // esp[12] = address of receiver argument |
| 1343 // Free a register. | 1343 // Free a register. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 __ mov(Operand(esp, 2 * kPointerSize), edx); | 1468 __ mov(Operand(esp, 2 * kPointerSize), edx); |
| 1469 | 1469 |
| 1470 // Try the new space allocation. Start out with computing the size of | 1470 // Try the new space allocation. Start out with computing the size of |
| 1471 // the arguments object and the elements array. | 1471 // the arguments object and the elements array. |
| 1472 Label add_arguments_object; | 1472 Label add_arguments_object; |
| 1473 __ bind(&try_allocate); | 1473 __ bind(&try_allocate); |
| 1474 __ test(ecx, ecx); | 1474 __ test(ecx, ecx); |
| 1475 __ j(zero, &add_arguments_object, Label::kNear); | 1475 __ j(zero, &add_arguments_object, Label::kNear); |
| 1476 __ lea(ecx, Operand(ecx, times_2, FixedArray::kHeaderSize)); | 1476 __ lea(ecx, Operand(ecx, times_2, FixedArray::kHeaderSize)); |
| 1477 __ bind(&add_arguments_object); | 1477 __ bind(&add_arguments_object); |
| 1478 __ add(ecx, Immediate(Heap::kArgumentsObjectSizeStrict)); | 1478 __ add(ecx, Immediate(Heap::kStrictArgumentsObjectSize)); |
| 1479 | 1479 |
| 1480 // Do the allocation of both objects in one go. | 1480 // Do the allocation of both objects in one go. |
| 1481 __ Allocate(ecx, eax, edx, ebx, &runtime, TAG_OBJECT); | 1481 __ Allocate(ecx, eax, edx, ebx, &runtime, TAG_OBJECT); |
| 1482 | 1482 |
| 1483 // Get the arguments boilerplate from the current native context. | 1483 // Get the arguments boilerplate from the current native context. |
| 1484 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 1484 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 1485 __ mov(edi, FieldOperand(edi, GlobalObject::kNativeContextOffset)); | 1485 __ mov(edi, FieldOperand(edi, GlobalObject::kNativeContextOffset)); |
| 1486 const int offset = | 1486 const int offset = |
| 1487 Context::SlotOffset(Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX); | 1487 Context::SlotOffset(Context::STRICT_ARGUMENTS_BOILERPLATE_INDEX); |
| 1488 __ mov(edi, Operand(edi, offset)); | 1488 __ mov(edi, Operand(edi, offset)); |
| 1489 | 1489 |
| 1490 // Copy the JS object part. | 1490 // Copy the JS object part. |
| 1491 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { | 1491 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { |
| 1492 __ mov(ebx, FieldOperand(edi, i)); | 1492 __ mov(ebx, FieldOperand(edi, i)); |
| 1493 __ mov(FieldOperand(eax, i), ebx); | 1493 __ mov(FieldOperand(eax, i), ebx); |
| 1494 } | 1494 } |
| 1495 | 1495 |
| 1496 // Get the length (smi tagged) and set that as an in-object property too. | 1496 // Get the length (smi tagged) and set that as an in-object property too. |
| 1497 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 1497 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
| 1498 __ mov(ecx, Operand(esp, 1 * kPointerSize)); | 1498 __ mov(ecx, Operand(esp, 1 * kPointerSize)); |
| 1499 __ mov(FieldOperand(eax, JSObject::kHeaderSize + | 1499 __ mov(FieldOperand(eax, JSObject::kHeaderSize + |
| 1500 Heap::kArgumentsLengthIndex * kPointerSize), | 1500 Heap::kArgumentsLengthIndex * kPointerSize), |
| 1501 ecx); | 1501 ecx); |
| 1502 | 1502 |
| 1503 // If there are no actual arguments, we're done. | 1503 // If there are no actual arguments, we're done. |
| 1504 Label done; | 1504 Label done; |
| 1505 __ test(ecx, ecx); | 1505 __ test(ecx, ecx); |
| 1506 __ j(zero, &done, Label::kNear); | 1506 __ j(zero, &done, Label::kNear); |
| 1507 | 1507 |
| 1508 // Get the parameters pointer from the stack. | 1508 // Get the parameters pointer from the stack. |
| 1509 __ mov(edx, Operand(esp, 2 * kPointerSize)); | 1509 __ mov(edx, Operand(esp, 2 * kPointerSize)); |
| 1510 | 1510 |
| 1511 // Set up the elements pointer in the allocated arguments object and | 1511 // Set up the elements pointer in the allocated arguments object and |
| 1512 // initialize the header in the elements fixed array. | 1512 // initialize the header in the elements fixed array. |
| 1513 __ lea(edi, Operand(eax, Heap::kArgumentsObjectSizeStrict)); | 1513 __ lea(edi, Operand(eax, Heap::kStrictArgumentsObjectSize)); |
| 1514 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi); | 1514 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi); |
| 1515 __ mov(FieldOperand(edi, FixedArray::kMapOffset), | 1515 __ mov(FieldOperand(edi, FixedArray::kMapOffset), |
| 1516 Immediate(isolate->factory()->fixed_array_map())); | 1516 Immediate(isolate->factory()->fixed_array_map())); |
| 1517 | 1517 |
| 1518 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx); | 1518 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx); |
| 1519 // Untag the length for the loop below. | 1519 // Untag the length for the loop below. |
| 1520 __ SmiUntag(ecx); | 1520 __ SmiUntag(ecx); |
| 1521 | 1521 |
| 1522 // Copy the fixed array slots. | 1522 // Copy the fixed array slots. |
| 1523 Label loop; | 1523 Label loop; |
| (...skipping 3934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5458 Operand(ebp, 7 * kPointerSize), | 5458 Operand(ebp, 7 * kPointerSize), |
| 5459 NULL); | 5459 NULL); |
| 5460 } | 5460 } |
| 5461 | 5461 |
| 5462 | 5462 |
| 5463 #undef __ | 5463 #undef __ |
| 5464 | 5464 |
| 5465 } } // namespace v8::internal | 5465 } } // namespace v8::internal |
| 5466 | 5466 |
| 5467 #endif // V8_TARGET_ARCH_IA32 | 5467 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |