| 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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 // Adjust for the number of properties stored in the object. Even in the | 811 // Adjust for the number of properties stored in the object. Even in the |
| 812 // face of a transition we can use the old map here because the size of the | 812 // face of a transition we can use the old map here because the size of the |
| 813 // object and the number of in-object properties is not going to change. | 813 // object and the number of in-object properties is not going to change. |
| 814 index -= object->map()->inobject_properties(); | 814 index -= object->map()->inobject_properties(); |
| 815 | 815 |
| 816 if (index < 0) { | 816 if (index < 0) { |
| 817 // Set the property straight into the object. | 817 // Set the property straight into the object. |
| 818 int offset = object->map()->instance_size() + (index * kPointerSize); | 818 int offset = object->map()->instance_size() + (index * kPointerSize); |
| 819 __ mov(FieldOperand(receiver_reg, offset), eax); | 819 __ mov(FieldOperand(receiver_reg, offset), eax); |
| 820 | 820 |
| 821 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | |
| 822 // Update the write barrier for the array address. | 821 // Update the write barrier for the array address. |
| 823 // Pass the value being stored in the now unused name_reg. | 822 // Pass the value being stored in the now unused name_reg. |
| 824 __ mov(name_reg, Operand(eax)); | 823 __ mov(name_reg, Operand(eax)); |
| 825 __ RecordWrite(receiver_reg, offset, name_reg, scratch); | 824 __ RecordWrite(receiver_reg, offset, name_reg, scratch, kDontSaveFPRegs); |
| 826 #endif | |
| 827 } else { | 825 } else { |
| 828 // Write to the properties array. | 826 // Write to the properties array. |
| 829 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 827 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
| 830 // Get the properties array (optimistically). | 828 // Get the properties array (optimistically). |
| 831 __ mov(scratch, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | 829 __ mov(scratch, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
| 832 __ mov(FieldOperand(scratch, offset), eax); | 830 __ mov(FieldOperand(scratch, offset), eax); |
| 833 | 831 |
| 834 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | |
| 835 // Update the write barrier for the array address. | 832 // Update the write barrier for the array address. |
| 836 // Pass the value being stored in the now unused name_reg. | 833 // Pass the value being stored in the now unused name_reg. |
| 837 __ mov(name_reg, Operand(eax)); | 834 __ mov(name_reg, Operand(eax)); |
| 838 __ RecordWrite(scratch, offset, name_reg, receiver_reg); | 835 __ RecordWrite(scratch, offset, name_reg, receiver_reg, kDontSaveFPRegs); |
| 839 #endif | |
| 840 } | 836 } |
| 841 | 837 |
| 842 // Return the value (register eax). | 838 // Return the value (register eax). |
| 843 __ ret(0); | 839 __ ret(0); |
| 844 } | 840 } |
| 845 | 841 |
| 846 | 842 |
| 847 // Generate code to check that a global property cell is empty. Create | 843 // Generate code to check that a global property cell is empty. Create |
| 848 // the property cell at compilation time if no cell exists for the | 844 // the property cell at compilation time if no cell exists for the |
| 849 // property. | 845 // property. |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1476 // Get the elements array of the object. | 1472 // Get the elements array of the object. |
| 1477 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); | 1473 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); |
| 1478 | 1474 |
| 1479 // Check that the elements are in fast mode and writable. | 1475 // Check that the elements are in fast mode and writable. |
| 1480 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), | 1476 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), |
| 1481 Immediate(Factory::fixed_array_map())); | 1477 Immediate(Factory::fixed_array_map())); |
| 1482 __ j(not_equal, &call_builtin); | 1478 __ j(not_equal, &call_builtin); |
| 1483 | 1479 |
| 1484 if (argc == 1) { // Otherwise fall through to call builtin. | 1480 if (argc == 1) { // Otherwise fall through to call builtin. |
| 1485 Label exit, attempt_to_grow_elements; | 1481 Label exit, attempt_to_grow_elements; |
| 1486 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | |
| 1487 Label with_write_barrier; | 1482 Label with_write_barrier; |
| 1488 #endif | |
| 1489 | 1483 |
| 1490 // Get the array's length into eax and calculate new length. | 1484 // Get the array's length into eax and calculate new length. |
| 1491 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); | 1485 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); |
| 1492 STATIC_ASSERT(kSmiTagSize == 1); | 1486 STATIC_ASSERT(kSmiTagSize == 1); |
| 1493 STATIC_ASSERT(kSmiTag == 0); | 1487 STATIC_ASSERT(kSmiTag == 0); |
| 1494 __ add(Operand(eax), Immediate(Smi::FromInt(argc))); | 1488 __ add(Operand(eax), Immediate(Smi::FromInt(argc))); |
| 1495 | 1489 |
| 1496 // Get the element's length into ecx. | 1490 // Get the element's length into ecx. |
| 1497 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); | 1491 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); |
| 1498 | 1492 |
| 1499 // Check if we could survive without allocation. | 1493 // Check if we could survive without allocation. |
| 1500 __ cmp(eax, Operand(ecx)); | 1494 __ cmp(eax, Operand(ecx)); |
| 1501 __ j(greater, &attempt_to_grow_elements); | 1495 __ j(greater, &attempt_to_grow_elements); |
| 1502 | 1496 |
| 1503 // Save new length. | 1497 // Save new length. |
| 1504 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); | 1498 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); |
| 1505 | 1499 |
| 1506 // Push the element. | 1500 // Push the element. |
| 1507 __ lea(edx, FieldOperand(ebx, | 1501 __ lea(edx, FieldOperand(ebx, |
| 1508 eax, times_half_pointer_size, | 1502 eax, times_half_pointer_size, |
| 1509 FixedArray::kHeaderSize - argc * kPointerSize)); | 1503 FixedArray::kHeaderSize - argc * kPointerSize)); |
| 1510 __ mov(ecx, Operand(esp, argc * kPointerSize)); | 1504 __ mov(ecx, Operand(esp, argc * kPointerSize)); |
| 1511 __ mov(Operand(edx, 0), ecx); | 1505 __ mov(Operand(edx, 0), ecx); |
| 1512 | 1506 |
| 1513 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | |
| 1514 // Check if value is a smi. | 1507 // Check if value is a smi. |
| 1515 __ test(ecx, Immediate(kSmiTagMask)); | 1508 __ test(ecx, Immediate(kSmiTagMask)); |
| 1516 __ j(not_zero, &with_write_barrier); | 1509 __ j(not_zero, &with_write_barrier); |
| 1517 #endif | |
| 1518 | 1510 |
| 1519 __ bind(&exit); | 1511 __ bind(&exit); |
| 1520 __ ret((argc + 1) * kPointerSize); | 1512 __ ret((argc + 1) * kPointerSize); |
| 1521 | 1513 |
| 1522 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | |
| 1523 __ bind(&with_write_barrier); | 1514 __ bind(&with_write_barrier); |
| 1524 | 1515 |
| 1525 __ InNewSpace(ebx, ecx, equal, &exit); | 1516 __ InNewSpace(ebx, ecx, equal, &exit); |
| 1526 | 1517 |
| 1527 __ RecordWriteHelper(ebx, edx, ecx); | 1518 __ RecordWriteHelper(ebx, edx, ecx, kDontSaveFPRegs); |
| 1528 __ ret((argc + 1) * kPointerSize); | 1519 __ ret((argc + 1) * kPointerSize); |
| 1529 #endif | |
| 1530 | 1520 |
| 1531 __ bind(&attempt_to_grow_elements); | 1521 __ bind(&attempt_to_grow_elements); |
| 1532 if (!FLAG_inline_new) { | 1522 if (!FLAG_inline_new) { |
| 1533 __ jmp(&call_builtin); | 1523 __ jmp(&call_builtin); |
| 1534 } | 1524 } |
| 1535 | 1525 |
| 1536 ExternalReference new_space_allocation_top = | 1526 ExternalReference new_space_allocation_top = |
| 1537 ExternalReference::new_space_allocation_top_address(); | 1527 ExternalReference::new_space_allocation_top_address(); |
| 1538 ExternalReference new_space_allocation_limit = | 1528 ExternalReference new_space_allocation_limit = |
| 1539 ExternalReference::new_space_allocation_limit_address(); | 1529 ExternalReference::new_space_allocation_limit_address(); |
| (...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2688 __ j(above_equal, &miss, not_taken); | 2678 __ j(above_equal, &miss, not_taken); |
| 2689 } else { | 2679 } else { |
| 2690 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // Compare smis. | 2680 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // Compare smis. |
| 2691 __ j(above_equal, &miss, not_taken); | 2681 __ j(above_equal, &miss, not_taken); |
| 2692 } | 2682 } |
| 2693 | 2683 |
| 2694 // Do the store and update the write barrier. Make sure to preserve | 2684 // Do the store and update the write barrier. Make sure to preserve |
| 2695 // the value in register eax. | 2685 // the value in register eax. |
| 2696 __ mov(edx, Operand(eax)); | 2686 __ mov(edx, Operand(eax)); |
| 2697 __ mov(FieldOperand(edi, ecx, times_2, FixedArray::kHeaderSize), eax); | 2687 __ mov(FieldOperand(edi, ecx, times_2, FixedArray::kHeaderSize), eax); |
| 2698 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | 2688 __ RecordWrite(edi, 0, edx, ecx, kDontSaveFPRegs); |
| 2699 __ RecordWrite(edi, 0, edx, ecx); | |
| 2700 #endif | |
| 2701 | 2689 |
| 2702 // Done. | 2690 // Done. |
| 2703 __ ret(0); | 2691 __ ret(0); |
| 2704 | 2692 |
| 2705 // Handle store cache miss. | 2693 // Handle store cache miss. |
| 2706 __ bind(&miss); | 2694 __ bind(&miss); |
| 2707 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); | 2695 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); |
| 2708 __ jmp(ic, RelocInfo::CODE_TARGET); | 2696 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 2709 | 2697 |
| 2710 // Return the generated code. | 2698 // Return the generated code. |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3296 // Return the generated code. | 3284 // Return the generated code. |
| 3297 return GetCode(); | 3285 return GetCode(); |
| 3298 } | 3286 } |
| 3299 | 3287 |
| 3300 | 3288 |
| 3301 #undef __ | 3289 #undef __ |
| 3302 | 3290 |
| 3303 } } // namespace v8::internal | 3291 } } // namespace v8::internal |
| 3304 | 3292 |
| 3305 #endif // V8_TARGET_ARCH_IA32 | 3293 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |