Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1062)

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 5736008: Provide baseline for experimental GC implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
821 // Update the write barrier for the array address. 822 // Update the write barrier for the array address.
822 // Pass the value being stored in the now unused name_reg. 823 // Pass the value being stored in the now unused name_reg.
823 __ mov(name_reg, Operand(eax)); 824 __ mov(name_reg, Operand(eax));
824 __ RecordWrite(receiver_reg, offset, name_reg, scratch); 825 __ RecordWrite(receiver_reg, offset, name_reg, scratch);
826 #endif
825 } else { 827 } else {
826 // Write to the properties array. 828 // Write to the properties array.
827 int offset = index * kPointerSize + FixedArray::kHeaderSize; 829 int offset = index * kPointerSize + FixedArray::kHeaderSize;
828 // Get the properties array (optimistically). 830 // Get the properties array (optimistically).
829 __ mov(scratch, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); 831 __ mov(scratch, FieldOperand(receiver_reg, JSObject::kPropertiesOffset));
830 __ mov(FieldOperand(scratch, offset), eax); 832 __ mov(FieldOperand(scratch, offset), eax);
831 833
834 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
832 // Update the write barrier for the array address. 835 // Update the write barrier for the array address.
833 // Pass the value being stored in the now unused name_reg. 836 // Pass the value being stored in the now unused name_reg.
834 __ mov(name_reg, Operand(eax)); 837 __ mov(name_reg, Operand(eax));
835 __ RecordWrite(scratch, offset, name_reg, receiver_reg); 838 __ RecordWrite(scratch, offset, name_reg, receiver_reg);
839 #endif
836 } 840 }
837 841
838 // Return the value (register eax). 842 // Return the value (register eax).
839 __ ret(0); 843 __ ret(0);
840 } 844 }
841 845
842 846
843 // Generate code to check that a global property cell is empty. Create 847 // Generate code to check that a global property cell is empty. Create
844 // the property cell at compilation time if no cell exists for the 848 // the property cell at compilation time if no cell exists for the
845 // property. 849 // property.
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 1475
1472 // Get the elements array of the object. 1476 // Get the elements array of the object.
1473 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); 1477 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset));
1474 1478
1475 // Check that the elements are in fast mode and writable. 1479 // Check that the elements are in fast mode and writable.
1476 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), 1480 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
1477 Immediate(Factory::fixed_array_map())); 1481 Immediate(Factory::fixed_array_map()));
1478 __ j(not_equal, &call_builtin); 1482 __ j(not_equal, &call_builtin);
1479 1483
1480 if (argc == 1) { // Otherwise fall through to call builtin. 1484 if (argc == 1) { // Otherwise fall through to call builtin.
1481 Label exit, with_write_barrier, attempt_to_grow_elements; 1485 Label exit, attempt_to_grow_elements;
1486 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
1487 Label with_write_barrier;
1488 #endif
1482 1489
1483 // Get the array's length into eax and calculate new length. 1490 // Get the array's length into eax and calculate new length.
1484 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); 1491 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset));
1485 STATIC_ASSERT(kSmiTagSize == 1); 1492 STATIC_ASSERT(kSmiTagSize == 1);
1486 STATIC_ASSERT(kSmiTag == 0); 1493 STATIC_ASSERT(kSmiTag == 0);
1487 __ add(Operand(eax), Immediate(Smi::FromInt(argc))); 1494 __ add(Operand(eax), Immediate(Smi::FromInt(argc)));
1488 1495
1489 // Get the element's length into ecx. 1496 // Get the element's length into ecx.
1490 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); 1497 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset));
1491 1498
1492 // Check if we could survive without allocation. 1499 // Check if we could survive without allocation.
1493 __ cmp(eax, Operand(ecx)); 1500 __ cmp(eax, Operand(ecx));
1494 __ j(greater, &attempt_to_grow_elements); 1501 __ j(greater, &attempt_to_grow_elements);
1495 1502
1496 // Save new length. 1503 // Save new length.
1497 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); 1504 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax);
1498 1505
1499 // Push the element. 1506 // Push the element.
1500 __ lea(edx, FieldOperand(ebx, 1507 __ lea(edx, FieldOperand(ebx,
1501 eax, times_half_pointer_size, 1508 eax, times_half_pointer_size,
1502 FixedArray::kHeaderSize - argc * kPointerSize)); 1509 FixedArray::kHeaderSize - argc * kPointerSize));
1503 __ mov(ecx, Operand(esp, argc * kPointerSize)); 1510 __ mov(ecx, Operand(esp, argc * kPointerSize));
1504 __ mov(Operand(edx, 0), ecx); 1511 __ mov(Operand(edx, 0), ecx);
1505 1512
1513 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
1506 // Check if value is a smi. 1514 // Check if value is a smi.
1507 __ test(ecx, Immediate(kSmiTagMask)); 1515 __ test(ecx, Immediate(kSmiTagMask));
1508 __ j(not_zero, &with_write_barrier); 1516 __ j(not_zero, &with_write_barrier);
1517 #endif
1509 1518
1510 __ bind(&exit); 1519 __ bind(&exit);
1511 __ ret((argc + 1) * kPointerSize); 1520 __ ret((argc + 1) * kPointerSize);
1512 1521
1522 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
1513 __ bind(&with_write_barrier); 1523 __ bind(&with_write_barrier);
1514 1524
1515 __ InNewSpace(ebx, ecx, equal, &exit); 1525 __ InNewSpace(ebx, ecx, equal, &exit);
1516 1526
1517 __ RecordWriteHelper(ebx, edx, ecx); 1527 __ RecordWriteHelper(ebx, edx, ecx);
1518 __ ret((argc + 1) * kPointerSize); 1528 __ ret((argc + 1) * kPointerSize);
1529 #endif
1519 1530
1520 __ bind(&attempt_to_grow_elements); 1531 __ bind(&attempt_to_grow_elements);
1521 if (!FLAG_inline_new) { 1532 if (!FLAG_inline_new) {
1522 __ jmp(&call_builtin); 1533 __ jmp(&call_builtin);
1523 } 1534 }
1524 1535
1525 ExternalReference new_space_allocation_top = 1536 ExternalReference new_space_allocation_top =
1526 ExternalReference::new_space_allocation_top_address(); 1537 ExternalReference::new_space_allocation_top_address();
1527 ExternalReference new_space_allocation_limit = 1538 ExternalReference new_space_allocation_limit =
1528 ExternalReference::new_space_allocation_limit_address(); 1539 ExternalReference::new_space_allocation_limit_address();
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 __ j(above_equal, &miss, not_taken); 2687 __ j(above_equal, &miss, not_taken);
2677 } else { 2688 } else {
2678 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // Compare smis. 2689 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // Compare smis.
2679 __ j(above_equal, &miss, not_taken); 2690 __ j(above_equal, &miss, not_taken);
2680 } 2691 }
2681 2692
2682 // Do the store and update the write barrier. Make sure to preserve 2693 // Do the store and update the write barrier. Make sure to preserve
2683 // the value in register eax. 2694 // the value in register eax.
2684 __ mov(edx, Operand(eax)); 2695 __ mov(edx, Operand(eax));
2685 __ mov(FieldOperand(edi, ecx, times_2, FixedArray::kHeaderSize), eax); 2696 __ mov(FieldOperand(edi, ecx, times_2, FixedArray::kHeaderSize), eax);
2697 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
2686 __ RecordWrite(edi, 0, edx, ecx); 2698 __ RecordWrite(edi, 0, edx, ecx);
2699 #endif
2687 2700
2688 // Done. 2701 // Done.
2689 __ ret(0); 2702 __ ret(0);
2690 2703
2691 // Handle store cache miss. 2704 // Handle store cache miss.
2692 __ bind(&miss); 2705 __ bind(&miss);
2693 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); 2706 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss));
2694 __ jmp(ic, RelocInfo::CODE_TARGET); 2707 __ jmp(ic, RelocInfo::CODE_TARGET);
2695 2708
2696 // Return the generated code. 2709 // Return the generated code.
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
3282 // Return the generated code. 3295 // Return the generated code.
3283 return GetCode(); 3296 return GetCode();
3284 } 3297 }
3285 3298
3286 3299
3287 #undef __ 3300 #undef __
3288 3301
3289 } } // namespace v8::internal 3302 } } // namespace v8::internal
3290 3303
3291 #endif // V8_TARGET_ARCH_IA32 3304 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« src/globals.h ('K') | « src/ia32/macro-assembler-ia32.cc ('k') | src/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698