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 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 index.translate(holder), Representation::Tagged()); | 1549 index.translate(holder), Representation::Tagged()); |
1550 GenerateJumpFunction(object, a1, &miss); | 1550 GenerateJumpFunction(object, a1, &miss); |
1551 | 1551 |
1552 HandlerFrontendFooter(&miss); | 1552 HandlerFrontendFooter(&miss); |
1553 | 1553 |
1554 // Return the generated code. | 1554 // Return the generated code. |
1555 return GetCode(Code::FAST, name); | 1555 return GetCode(Code::FAST, name); |
1556 } | 1556 } |
1557 | 1557 |
1558 | 1558 |
| 1559 Handle<Code> CallStubCompiler::CompileArrayPopCall( |
| 1560 Handle<Object> object, |
| 1561 Handle<JSObject> holder, |
| 1562 Handle<Cell> cell, |
| 1563 Handle<JSFunction> function, |
| 1564 Handle<String> name, |
| 1565 Code::StubType type) { |
| 1566 // If object is not an array or is observed or sealed, bail out to regular |
| 1567 // call. |
| 1568 if (!object->IsJSArray() || |
| 1569 !cell.is_null() || |
| 1570 Handle<JSArray>::cast(object)->map()->is_observed() || |
| 1571 !Handle<JSArray>::cast(object)->map()->is_extensible()) { |
| 1572 return Handle<Code>::null(); |
| 1573 } |
| 1574 |
| 1575 Label miss, return_undefined, call_builtin; |
| 1576 Register receiver = a0; |
| 1577 Register scratch = a1; |
| 1578 Register elements = a3; |
| 1579 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); |
| 1580 |
| 1581 // Get the elements array of the object. |
| 1582 __ lw(elements, FieldMemOperand(receiver, JSArray::kElementsOffset)); |
| 1583 |
| 1584 // Check that the elements are in fast mode and writable. |
| 1585 __ CheckMap(elements, |
| 1586 scratch, |
| 1587 Heap::kFixedArrayMapRootIndex, |
| 1588 &call_builtin, |
| 1589 DONT_DO_SMI_CHECK); |
| 1590 |
| 1591 // Get the array's length into t0 and calculate new length. |
| 1592 __ lw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
| 1593 __ Subu(t0, t0, Operand(Smi::FromInt(1))); |
| 1594 __ Branch(&return_undefined, lt, t0, Operand(zero_reg)); |
| 1595 |
| 1596 // Get the last element. |
| 1597 __ LoadRoot(t2, Heap::kTheHoleValueRootIndex); |
| 1598 STATIC_ASSERT(kSmiTagSize == 1); |
| 1599 STATIC_ASSERT(kSmiTag == 0); |
| 1600 // We can't address the last element in one operation. Compute the more |
| 1601 // expensive shift first, and use an offset later on. |
| 1602 __ sll(t1, t0, kPointerSizeLog2 - kSmiTagSize); |
| 1603 __ Addu(elements, elements, t1); |
| 1604 __ lw(scratch, FieldMemOperand(elements, FixedArray::kHeaderSize)); |
| 1605 __ Branch(&call_builtin, eq, scratch, Operand(t2)); |
| 1606 |
| 1607 // Set the array's length. |
| 1608 __ sw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
| 1609 |
| 1610 // Fill with the hole. |
| 1611 __ sw(t2, FieldMemOperand(elements, FixedArray::kHeaderSize)); |
| 1612 const int argc = arguments().immediate(); |
| 1613 __ mov(v0, scratch); |
| 1614 __ DropAndRet(argc + 1); |
| 1615 |
| 1616 __ bind(&return_undefined); |
| 1617 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
| 1618 __ DropAndRet(argc + 1); |
| 1619 |
| 1620 __ bind(&call_builtin); |
| 1621 __ TailCallExternalReference( |
| 1622 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); |
| 1623 |
| 1624 HandlerFrontendFooter(&miss); |
| 1625 |
| 1626 // Return the generated code. |
| 1627 return GetCode(type, name); |
| 1628 } |
| 1629 |
| 1630 |
1559 Handle<Code> CallStubCompiler::CompileFastApiCall( | 1631 Handle<Code> CallStubCompiler::CompileFastApiCall( |
1560 const CallOptimization& optimization, | 1632 const CallOptimization& optimization, |
1561 Handle<Object> object, | 1633 Handle<Object> object, |
1562 Handle<JSObject> holder, | 1634 Handle<JSObject> holder, |
1563 Handle<Cell> cell, | 1635 Handle<Cell> cell, |
1564 Handle<JSFunction> function, | 1636 Handle<JSFunction> function, |
1565 Handle<String> name) { | 1637 Handle<String> name) { |
1566 | 1638 |
1567 Counters* counters = isolate()->counters(); | 1639 Counters* counters = isolate()->counters(); |
1568 | 1640 |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 // ----------------------------------- | 2227 // ----------------------------------- |
2156 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2228 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2157 } | 2229 } |
2158 | 2230 |
2159 | 2231 |
2160 #undef __ | 2232 #undef __ |
2161 | 2233 |
2162 } } // namespace v8::internal | 2234 } } // namespace v8::internal |
2163 | 2235 |
2164 #endif // V8_TARGET_ARCH_MIPS | 2236 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |