Chromium Code Reviews| 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 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1468 CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, r3, r0, r4, | 1468 CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, r3, r0, r4, |
| 1469 name, &miss); | 1469 name, &miss); |
| 1470 | 1470 |
| 1471 if (argc == 0) { | 1471 if (argc == 0) { |
| 1472 // Nothing to do, just return the length. | 1472 // Nothing to do, just return the length. |
| 1473 __ ldr(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 1473 __ ldr(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
| 1474 __ Drop(argc + 1); | 1474 __ Drop(argc + 1); |
| 1475 __ Ret(); | 1475 __ Ret(); |
| 1476 } else { | 1476 } else { |
| 1477 Label call_builtin; | 1477 Label call_builtin; |
| 1478 Register elements = r3; | |
| 1479 Register end_elements = r5; | |
| 1480 // Get the elements array of the object. | |
| 1481 __ ldr(elements, FieldMemOperand(receiver, JSArray::kElementsOffset)); | |
| 1482 | |
| 1483 // Check that the elements are in fast mode and writable. | |
| 1484 __ CheckMap(elements, | |
| 1485 r0, | |
| 1486 Heap::kFixedArrayMapRootIndex, | |
| 1487 &call_builtin, | |
| 1488 DONT_DO_SMI_CHECK); | |
| 1489 | 1478 |
| 1490 if (argc == 1) { // Otherwise fall through to call the builtin. | 1479 if (argc == 1) { // Otherwise fall through to call the builtin. |
| 1491 Label attempt_to_grow_elements; | 1480 Label attempt_to_grow_elements; |
| 1492 | 1481 |
| 1482 Register elements = r6; | |
| 1483 Register end_elements = r5; | |
| 1484 // Get the elements array of the object. | |
| 1485 __ ldr(elements, FieldMemOperand(receiver, JSArray::kElementsOffset)); | |
| 1486 | |
| 1487 // Check that the elements are in fast mode and writable. | |
| 1488 __ CheckMap(elements, | |
| 1489 r0, | |
| 1490 Heap::kFixedArrayMapRootIndex, | |
| 1491 &call_builtin, | |
| 1492 DONT_DO_SMI_CHECK); | |
| 1493 | |
| 1494 | |
| 1493 // Get the array's length into r0 and calculate new length. | 1495 // Get the array's length into r0 and calculate new length. |
| 1494 __ ldr(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 1496 __ ldr(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
| 1495 STATIC_ASSERT(kSmiTagSize == 1); | 1497 STATIC_ASSERT(kSmiTagSize == 1); |
| 1496 STATIC_ASSERT(kSmiTag == 0); | 1498 STATIC_ASSERT(kSmiTag == 0); |
| 1497 __ add(r0, r0, Operand(Smi::FromInt(argc))); | 1499 __ add(r0, r0, Operand(Smi::FromInt(argc))); |
| 1498 | 1500 |
| 1499 // Get the element's length. | 1501 // Get the element's length. |
| 1500 __ ldr(r4, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 1502 __ ldr(r4, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
| 1501 | 1503 |
| 1502 // Check if we could survive without allocation. | 1504 // Check if we could survive without allocation. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1519 const int kEndElementsOffset = | 1521 const int kEndElementsOffset = |
| 1520 FixedArray::kHeaderSize - kHeapObjectTag - argc * kPointerSize; | 1522 FixedArray::kHeaderSize - kHeapObjectTag - argc * kPointerSize; |
| 1521 __ str(r4, MemOperand(end_elements, kEndElementsOffset, PreIndex)); | 1523 __ str(r4, MemOperand(end_elements, kEndElementsOffset, PreIndex)); |
| 1522 | 1524 |
| 1523 // Check for a smi. | 1525 // Check for a smi. |
| 1524 __ Drop(argc + 1); | 1526 __ Drop(argc + 1); |
| 1525 __ Ret(); | 1527 __ Ret(); |
| 1526 | 1528 |
| 1527 __ bind(&with_write_barrier); | 1529 __ bind(&with_write_barrier); |
| 1528 | 1530 |
| 1529 __ ldr(r6, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 1531 __ ldr(r3, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 1530 __ CheckFastObjectElements(r6, r6, &call_builtin); | 1532 |
| 1533 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { | |
| 1534 Label fast_object, not_fast_object; | |
| 1535 __ CheckFastObjectElements(r3, r7, ¬_fast_object); | |
| 1536 __ jmp(&fast_object); | |
| 1537 // In case of fast smi-only, convert to fast object, otherwise bail out. | |
| 1538 __ bind(¬_fast_object); | |
| 1539 __ CheckFastSmiOnlyElements(r3, r7, &call_builtin); | |
| 1540 // edx: receiver | |
| 1541 // r3: map | |
| 1542 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, | |
| 1543 FAST_ELEMENTS, | |
| 1544 r3, | |
| 1545 r7, | |
| 1546 &call_builtin); | |
| 1547 __ mov(r2, r1); | |
|
Jakob Kummerow
2012/02/08 16:24:55
nit: s/r1/receiver/
| |
| 1548 ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm()); | |
| 1549 __ bind(&fast_object); | |
| 1550 } else { | |
| 1551 __ CheckFastObjectElements(r3, r3, &call_builtin); | |
| 1552 } | |
| 1531 | 1553 |
| 1532 // Save new length. | 1554 // Save new length. |
| 1533 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 1555 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
| 1534 | 1556 |
| 1535 // Push the element. | 1557 // Push the element. |
| 1536 // We may need a register containing the address end_elements below, | 1558 // We may need a register containing the address end_elements below, |
| 1537 // so write back the value in end_elements. | 1559 // so write back the value in end_elements. |
| 1538 __ add(end_elements, elements, | 1560 __ add(end_elements, elements, |
| 1539 Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize)); | 1561 Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 1540 __ str(r4, MemOperand(end_elements, kEndElementsOffset, PreIndex)); | 1562 __ str(r4, MemOperand(end_elements, kEndElementsOffset, PreIndex)); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 1571 ExternalReference::new_space_allocation_top_address(isolate); | 1593 ExternalReference::new_space_allocation_top_address(isolate); |
| 1572 ExternalReference new_space_allocation_limit = | 1594 ExternalReference new_space_allocation_limit = |
| 1573 ExternalReference::new_space_allocation_limit_address(isolate); | 1595 ExternalReference::new_space_allocation_limit_address(isolate); |
| 1574 | 1596 |
| 1575 const int kAllocationDelta = 4; | 1597 const int kAllocationDelta = 4; |
| 1576 // Load top and check if it is the end of elements. | 1598 // Load top and check if it is the end of elements. |
| 1577 __ add(end_elements, elements, | 1599 __ add(end_elements, elements, |
| 1578 Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize)); | 1600 Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 1579 __ add(end_elements, end_elements, Operand(kEndElementsOffset)); | 1601 __ add(end_elements, end_elements, Operand(kEndElementsOffset)); |
| 1580 __ mov(r7, Operand(new_space_allocation_top)); | 1602 __ mov(r7, Operand(new_space_allocation_top)); |
| 1581 __ ldr(r6, MemOperand(r7)); | 1603 __ ldr(r3, MemOperand(r7)); |
| 1582 __ cmp(end_elements, r6); | 1604 __ cmp(end_elements, r3); |
| 1583 __ b(ne, &call_builtin); | 1605 __ b(ne, &call_builtin); |
| 1584 | 1606 |
| 1585 __ mov(r9, Operand(new_space_allocation_limit)); | 1607 __ mov(r9, Operand(new_space_allocation_limit)); |
| 1586 __ ldr(r9, MemOperand(r9)); | 1608 __ ldr(r9, MemOperand(r9)); |
| 1587 __ add(r6, r6, Operand(kAllocationDelta * kPointerSize)); | 1609 __ add(r3, r3, Operand(kAllocationDelta * kPointerSize)); |
| 1588 __ cmp(r6, r9); | 1610 __ cmp(r3, r9); |
| 1589 __ b(hi, &call_builtin); | 1611 __ b(hi, &call_builtin); |
| 1590 | 1612 |
| 1591 // We fit and could grow elements. | 1613 // We fit and could grow elements. |
| 1592 // Update new_space_allocation_top. | 1614 // Update new_space_allocation_top. |
| 1593 __ str(r6, MemOperand(r7)); | 1615 __ str(r3, MemOperand(r7)); |
| 1594 // Push the argument. | 1616 // Push the argument. |
| 1595 __ str(r2, MemOperand(end_elements)); | 1617 __ str(r2, MemOperand(end_elements)); |
| 1596 // Fill the rest with holes. | 1618 // Fill the rest with holes. |
| 1597 __ LoadRoot(r6, Heap::kTheHoleValueRootIndex); | 1619 __ LoadRoot(r3, Heap::kTheHoleValueRootIndex); |
| 1598 for (int i = 1; i < kAllocationDelta; i++) { | 1620 for (int i = 1; i < kAllocationDelta; i++) { |
| 1599 __ str(r6, MemOperand(end_elements, i * kPointerSize)); | 1621 __ str(r3, MemOperand(end_elements, i * kPointerSize)); |
| 1600 } | 1622 } |
| 1601 | 1623 |
| 1602 // Update elements' and array's sizes. | 1624 // Update elements' and array's sizes. |
| 1603 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 1625 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
| 1604 __ add(r4, r4, Operand(Smi::FromInt(kAllocationDelta))); | 1626 __ add(r4, r4, Operand(Smi::FromInt(kAllocationDelta))); |
| 1605 __ str(r4, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 1627 __ str(r4, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
| 1606 | 1628 |
| 1607 // Elements are in new space, so write barrier is not required. | 1629 // Elements are in new space, so write barrier is not required. |
| 1608 __ Drop(argc + 1); | 1630 __ Drop(argc + 1); |
| 1609 __ Ret(); | 1631 __ Ret(); |
| (...skipping 2636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4246 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 4268 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); |
| 4247 __ Jump(ic_miss, RelocInfo::CODE_TARGET); | 4269 __ Jump(ic_miss, RelocInfo::CODE_TARGET); |
| 4248 } | 4270 } |
| 4249 | 4271 |
| 4250 | 4272 |
| 4251 #undef __ | 4273 #undef __ |
| 4252 | 4274 |
| 4253 } } // namespace v8::internal | 4275 } } // namespace v8::internal |
| 4254 | 4276 |
| 4255 #endif // V8_TARGET_ARCH_ARM | 4277 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |