Chromium Code Reviews| 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 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1457 // Get the elements array of the object. | 1457 // Get the elements array of the object. |
| 1458 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); | 1458 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset)); |
| 1459 | 1459 |
| 1460 // Check that the elements are in fast mode and writable. | 1460 // Check that the elements are in fast mode and writable. |
| 1461 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), | 1461 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), |
| 1462 Immediate(Factory::fixed_array_map())); | 1462 Immediate(Factory::fixed_array_map())); |
| 1463 __ j(not_equal, &call_builtin); | 1463 __ j(not_equal, &call_builtin); |
| 1464 | 1464 |
| 1465 if (argc == 1) { // Otherwise fall through to call builtin. | 1465 if (argc == 1) { // Otherwise fall through to call builtin. |
| 1466 Label exit, attempt_to_grow_elements; | 1466 Label exit, attempt_to_grow_elements; |
| 1467 Label with_write_barrier; | 1467 NearLabel with_write_barrier; |
| 1468 | 1468 |
| 1469 // Get the array's length into eax and calculate new length. | 1469 // Get the array's length into eax and calculate new length. |
| 1470 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); | 1470 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); |
| 1471 STATIC_ASSERT(kSmiTagSize == 1); | 1471 STATIC_ASSERT(kSmiTagSize == 1); |
| 1472 STATIC_ASSERT(kSmiTag == 0); | 1472 STATIC_ASSERT(kSmiTag == 0); |
| 1473 __ add(Operand(eax), Immediate(Smi::FromInt(argc))); | 1473 __ add(Operand(eax), Immediate(Smi::FromInt(argc))); |
| 1474 | 1474 |
| 1475 // Get the element's length into ecx. | 1475 // Get the element's length into ecx. |
| 1476 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); | 1476 __ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset)); |
| 1477 | 1477 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1491 | 1491 |
| 1492 // Check if value is a smi. | 1492 // Check if value is a smi. |
| 1493 __ test(ecx, Immediate(kSmiTagMask)); | 1493 __ test(ecx, Immediate(kSmiTagMask)); |
| 1494 __ j(not_zero, &with_write_barrier); | 1494 __ j(not_zero, &with_write_barrier); |
| 1495 | 1495 |
| 1496 __ bind(&exit); | 1496 __ bind(&exit); |
| 1497 __ ret((argc + 1) * kPointerSize); | 1497 __ ret((argc + 1) * kPointerSize); |
| 1498 | 1498 |
| 1499 __ bind(&with_write_barrier); | 1499 __ bind(&with_write_barrier); |
| 1500 | 1500 |
| 1501 __ IncrementalMarkingRecordWrite(ebx, | 1501 __ RecordWrite(ebx, edx, ecx, |
| 1502 ecx, | 1502 EMIT_REMEMBERED_SET, kDontSaveFPRegs, OMIT_SMI_CHECK); |
|
Vyacheslav Egorov (Chromium)
2011/04/06 11:46:40
strange formatting
Erik Corry
2011/04/06 12:31:28
Done.
| |
| 1503 edx, | |
| 1504 OMIT_SMI_CHECK, | |
| 1505 PRESERVE_OBJECT, | |
| 1506 DESTROY_VALUE, | |
| 1507 PRESERVE_SCRATCH); | |
| 1508 | 1503 |
| 1509 __ InNewSpace(ebx, ecx, equal, &exit); | |
| 1510 | |
| 1511 __ RecordWriteHelper(ebx, edx, ecx, kDontSaveFPRegs); | |
| 1512 __ ret((argc + 1) * kPointerSize); | 1504 __ ret((argc + 1) * kPointerSize); |
| 1513 | 1505 |
| 1514 __ bind(&attempt_to_grow_elements); | 1506 __ bind(&attempt_to_grow_elements); |
| 1515 if (!FLAG_inline_new) { | 1507 if (!FLAG_inline_new) { |
| 1516 __ jmp(&call_builtin); | 1508 __ jmp(&call_builtin); |
| 1517 } | 1509 } |
| 1518 | 1510 |
| 1519 ExternalReference new_space_allocation_top = | 1511 ExternalReference new_space_allocation_top = |
| 1520 ExternalReference::new_space_allocation_top_address(); | 1512 ExternalReference::new_space_allocation_top_address(); |
| 1521 ExternalReference new_space_allocation_limit = | 1513 ExternalReference new_space_allocation_limit = |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1540 __ mov(ecx, Operand(esp, argc * kPointerSize)); | 1532 __ mov(ecx, Operand(esp, argc * kPointerSize)); |
| 1541 | 1533 |
| 1542 // Push the argument... | 1534 // Push the argument... |
| 1543 __ mov(Operand(edx, 0), ecx); | 1535 __ mov(Operand(edx, 0), ecx); |
| 1544 // ... and fill the rest with holes. | 1536 // ... and fill the rest with holes. |
| 1545 for (int i = 1; i < kAllocationDelta; i++) { | 1537 for (int i = 1; i < kAllocationDelta; i++) { |
| 1546 __ mov(Operand(edx, i * kPointerSize), | 1538 __ mov(Operand(edx, i * kPointerSize), |
| 1547 Immediate(Factory::the_hole_value())); | 1539 Immediate(Factory::the_hole_value())); |
| 1548 } | 1540 } |
| 1549 | 1541 |
| 1550 __ IncrementalMarkingRecordWrite(ebx, | 1542 // We know the hole is in old space, so we don't need to update the |
| 1551 ecx, | 1543 // remembered set. We also know that the hole is marked black by the |
| 1552 edx, | 1544 // incremental marker, so we can omit the incremental marking record |
| 1553 INLINE_SMI_CHECK, | 1545 // write too. |
|
Vyacheslav Egorov (Chromium)
2011/04/06 11:46:40
this was not a record write for hole, it's record
Erik Corry
2011/04/06 12:31:28
Oops. Nice catch. Fixed. And comment added. Th
| |
| 1554 PRESERVE_OBJECT, | |
| 1555 DESTROY_VALUE, | |
| 1556 DESTROY_SCRATCH); | |
| 1557 | 1546 |
| 1558 // Restore receiver to edx as finish sequence assumes it's here. | 1547 // Restore receiver to edx as finish sequence assumes it's here. |
| 1559 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 1548 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
| 1560 | 1549 |
| 1561 // Increment element's and array's sizes. | 1550 // Increment element's and array's sizes. |
| 1562 __ add(FieldOperand(ebx, FixedArray::kLengthOffset), | 1551 __ add(FieldOperand(ebx, FixedArray::kLengthOffset), |
| 1563 Immediate(Smi::FromInt(kAllocationDelta))); | 1552 Immediate(Smi::FromInt(kAllocationDelta))); |
| 1564 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); | 1553 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); |
| 1565 | 1554 |
| 1566 // Elements are in new space, so write barrier is not required. | 1555 // Elements are in new space, so write barrier is not required. |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2614 __ cmp(cell_operand, Factory::the_hole_value()); | 2603 __ cmp(cell_operand, Factory::the_hole_value()); |
| 2615 __ j(equal, &miss); | 2604 __ j(equal, &miss); |
| 2616 | 2605 |
| 2617 // Store the value in the cell. | 2606 // Store the value in the cell. |
| 2618 __ mov(cell_operand, eax); | 2607 __ mov(cell_operand, eax); |
| 2619 Label done; | 2608 Label done; |
| 2620 __ test(eax, Immediate(kSmiTagMask)); | 2609 __ test(eax, Immediate(kSmiTagMask)); |
| 2621 __ j(zero, &done); | 2610 __ j(zero, &done); |
| 2622 | 2611 |
| 2623 __ mov(ecx, eax); | 2612 __ mov(ecx, eax); |
| 2624 __ IncrementalMarkingRecordWrite(ebx, | 2613 // Cells are always in the remembered set. |
| 2625 ecx, | 2614 __ RecordWrite(ebx, edx, ecx, OMIT_REMEMBERED_SET, kDontSaveFPRegs); |
| 2626 edx, | |
| 2627 INLINE_SMI_CHECK, | |
| 2628 DESTROY_OBJECT, | |
| 2629 DESTROY_VALUE, | |
| 2630 DESTROY_SCRATCH); | |
| 2631 | 2615 |
| 2632 // Return the value (register eax). | 2616 // Return the value (register eax). |
| 2633 __ bind(&done); | 2617 __ bind(&done); |
| 2634 | 2618 |
| 2635 // Return the value (register eax). | 2619 // Return the value (register eax). |
| 2636 __ IncrementCounter(&Counters::named_store_global_inline, 1); | 2620 __ IncrementCounter(&Counters::named_store_global_inline, 1); |
| 2637 __ ret(0); | 2621 __ ret(0); |
| 2638 | 2622 |
| 2639 // Handle store cache miss. | 2623 // Handle store cache miss. |
| 2640 __ bind(&miss); | 2624 __ bind(&miss); |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3681 | 3665 |
| 3682 return GetCode(flags); | 3666 return GetCode(flags); |
| 3683 } | 3667 } |
| 3684 | 3668 |
| 3685 | 3669 |
| 3686 #undef __ | 3670 #undef __ |
| 3687 | 3671 |
| 3688 } } // namespace v8::internal | 3672 } } // namespace v8::internal |
| 3689 | 3673 |
| 3690 #endif // V8_TARGET_ARCH_IA32 | 3674 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |