| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 | 1471 |
| 1472 // Get the elements array of the object. | 1472 // Get the elements array of the object. |
| 1473 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); | 1473 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); |
| 1474 | 1474 |
| 1475 // Check that the elements are in fast mode and writable. | 1475 // Check that the elements are in fast mode and writable. |
| 1476 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), | 1476 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), |
| 1477 Immediate(Factory::fixed_array_map())); | 1477 Immediate(Factory::fixed_array_map())); |
| 1478 __ j(not_equal, &call_builtin); | 1478 __ j(not_equal, &call_builtin); |
| 1479 | 1479 |
| 1480 if (argc == 1) { // Otherwise fall through to call builtin. | 1480 if (argc == 1) { // Otherwise fall through to call builtin. |
| 1481 Label exit, with_write_barrier, attempt_to_grow_elements; | 1481 Label exit, attempt_to_grow_elements; |
| 1482 #ifndef BASELINE_GC |
| 1483 Label with_write_barrier; |
| 1484 #endif |
| 1482 | 1485 |
| 1483 // Get the array's length into eax and calculate new length. | 1486 // Get the array's length into eax and calculate new length. |
| 1484 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); | 1487 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); |
| 1485 STATIC_ASSERT(kSmiTagSize == 1); | 1488 STATIC_ASSERT(kSmiTagSize == 1); |
| 1486 STATIC_ASSERT(kSmiTag == 0); | 1489 STATIC_ASSERT(kSmiTag == 0); |
| 1487 __ add(Operand(eax), Immediate(Smi::FromInt(argc))); | 1490 __ add(Operand(eax), Immediate(Smi::FromInt(argc))); |
| 1488 | 1491 |
| 1489 // Get the element's length into ecx. | 1492 // Get the element's length into ecx. |
| 1490 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); | 1493 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); |
| 1491 | 1494 |
| 1492 // Check if we could survive without allocation. | 1495 // Check if we could survive without allocation. |
| 1493 __ cmp(eax, Operand(ecx)); | 1496 __ cmp(eax, Operand(ecx)); |
| 1494 __ j(greater, &attempt_to_grow_elements); | 1497 __ j(greater, &attempt_to_grow_elements); |
| 1495 | 1498 |
| 1496 // Save new length. | 1499 // Save new length. |
| 1497 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); | 1500 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); |
| 1498 | 1501 |
| 1499 // Push the element. | 1502 // Push the element. |
| 1500 __ lea(edx, FieldOperand(ebx, | 1503 __ lea(edx, FieldOperand(ebx, |
| 1501 eax, times_half_pointer_size, | 1504 eax, times_half_pointer_size, |
| 1502 FixedArray::kHeaderSize - argc * kPointerSize)); | 1505 FixedArray::kHeaderSize - argc * kPointerSize)); |
| 1503 __ mov(ecx, Operand(esp, argc * kPointerSize)); | 1506 __ mov(ecx, Operand(esp, argc * kPointerSize)); |
| 1504 __ mov(Operand(edx, 0), ecx); | 1507 __ mov(Operand(edx, 0), ecx); |
| 1505 | 1508 |
| 1509 #ifndef BASELINE_GC |
| 1506 // Check if value is a smi. | 1510 // Check if value is a smi. |
| 1507 __ test(ecx, Immediate(kSmiTagMask)); | 1511 __ test(ecx, Immediate(kSmiTagMask)); |
| 1508 __ j(not_zero, &with_write_barrier); | 1512 __ j(not_zero, &with_write_barrier); |
| 1513 #endif |
| 1509 | 1514 |
| 1510 __ bind(&exit); | 1515 __ bind(&exit); |
| 1511 __ ret((argc + 1) * kPointerSize); | 1516 __ ret((argc + 1) * kPointerSize); |
| 1512 | 1517 |
| 1518 #ifndef BASELINE_GC |
| 1513 __ bind(&with_write_barrier); | 1519 __ bind(&with_write_barrier); |
| 1514 | 1520 |
| 1515 __ InNewSpace(ebx, ecx, equal, &exit); | 1521 __ InNewSpace(ebx, ecx, equal, &exit); |
| 1516 | 1522 |
| 1517 __ RecordWriteHelper(ebx, edx, ecx); | 1523 __ RecordWriteHelper(ebx, edx, ecx); |
| 1518 __ ret((argc + 1) * kPointerSize); | 1524 __ ret((argc + 1) * kPointerSize); |
| 1525 #endif |
| 1519 | 1526 |
| 1520 __ bind(&attempt_to_grow_elements); | 1527 __ bind(&attempt_to_grow_elements); |
| 1521 if (!FLAG_inline_new) { | 1528 if (!FLAG_inline_new) { |
| 1522 __ jmp(&call_builtin); | 1529 __ jmp(&call_builtin); |
| 1523 } | 1530 } |
| 1524 | 1531 |
| 1525 ExternalReference new_space_allocation_top = | 1532 ExternalReference new_space_allocation_top = |
| 1526 ExternalReference::new_space_allocation_top_address(); | 1533 ExternalReference::new_space_allocation_top_address(); |
| 1527 ExternalReference new_space_allocation_limit = | 1534 ExternalReference new_space_allocation_limit = |
| 1528 ExternalReference::new_space_allocation_limit_address(); | 1535 ExternalReference::new_space_allocation_limit_address(); |
| (...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3282 // Return the generated code. | 3289 // Return the generated code. |
| 3283 return GetCode(); | 3290 return GetCode(); |
| 3284 } | 3291 } |
| 3285 | 3292 |
| 3286 | 3293 |
| 3287 #undef __ | 3294 #undef __ |
| 3288 | 3295 |
| 3289 } } // namespace v8::internal | 3296 } } // namespace v8::internal |
| 3290 | 3297 |
| 3291 #endif // V8_TARGET_ARCH_IA32 | 3298 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |