OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 // NOTICE! This code is only reached after a smi-fast-case check, so | 581 // NOTICE! This code is only reached after a smi-fast-case check, so |
582 // it is certain that at least one operand isn't a smi. | 582 // it is certain that at least one operand isn't a smi. |
583 | 583 |
584 // Handle the case where the objects are identical. Either returns the answer | 584 // Handle the case where the objects are identical. Either returns the answer |
585 // or goes to slow. Only falls through if the objects were not identical. | 585 // or goes to slow. Only falls through if the objects were not identical. |
586 EmitIdenticalObjectComparison(masm, &slow, cc); | 586 EmitIdenticalObjectComparison(masm, &slow, cc); |
587 | 587 |
588 // If either is a Smi (we know that not both are), then they can only | 588 // If either is a Smi (we know that not both are), then they can only |
589 // be strictly equal if the other is a HeapNumber. | 589 // be strictly equal if the other is a HeapNumber. |
590 STATIC_ASSERT(kSmiTag == 0); | 590 STATIC_ASSERT(kSmiTag == 0); |
591 DCHECK_EQ(0, Smi::FromInt(0)); | 591 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0)); |
592 __ And(t2, lhs, Operand(rhs)); | 592 __ And(t2, lhs, Operand(rhs)); |
593 __ JumpIfNotSmi(t2, ¬_smis, t0); | 593 __ JumpIfNotSmi(t2, ¬_smis, t0); |
594 // One operand is a smi. EmitSmiNonsmiComparison generates code that can: | 594 // One operand is a smi. EmitSmiNonsmiComparison generates code that can: |
595 // 1) Return the answer. | 595 // 1) Return the answer. |
596 // 2) Go to slow. | 596 // 2) Go to slow. |
597 // 3) Fall through to both_loaded_as_doubles. | 597 // 3) Fall through to both_loaded_as_doubles. |
598 // 4) Jump to rhs_not_nan. | 598 // 4) Jump to rhs_not_nan. |
599 // In cases 3 and 4 we have found out we were dealing with a number-number | 599 // In cases 3 and 4 we have found out we were dealing with a number-number |
600 // comparison and the numbers have been loaded into f12 and f14 as doubles, | 600 // comparison and the numbers have been loaded into f12 and f14 as doubles, |
601 // or in GP registers (a0, a1, a2, a3) depending on the presence of the FPU. | 601 // or in GP registers (a0, a1, a2, a3) depending on the presence of the FPU. |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 // Loop through the prototype chain looking for the function prototype. | 1458 // Loop through the prototype chain looking for the function prototype. |
1459 __ LoadRoot(scratch2, Heap::kNullValueRootIndex); | 1459 __ LoadRoot(scratch2, Heap::kNullValueRootIndex); |
1460 __ bind(&loop); | 1460 __ bind(&loop); |
1461 __ Branch(&is_instance, eq, scratch, Operand(prototype)); | 1461 __ Branch(&is_instance, eq, scratch, Operand(prototype)); |
1462 __ Branch(&is_not_instance, eq, scratch, Operand(scratch2)); | 1462 __ Branch(&is_not_instance, eq, scratch, Operand(scratch2)); |
1463 __ lw(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset)); | 1463 __ lw(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
1464 __ lw(scratch, FieldMemOperand(scratch, Map::kPrototypeOffset)); | 1464 __ lw(scratch, FieldMemOperand(scratch, Map::kPrototypeOffset)); |
1465 __ Branch(&loop); | 1465 __ Branch(&loop); |
1466 | 1466 |
1467 __ bind(&is_instance); | 1467 __ bind(&is_instance); |
1468 DCHECK(Smi::FromInt(0) == 0); | 1468 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0)); |
1469 if (!HasCallSiteInlineCheck()) { | 1469 if (!HasCallSiteInlineCheck()) { |
1470 __ mov(v0, zero_reg); | 1470 __ mov(v0, zero_reg); |
1471 __ StoreRoot(v0, Heap::kInstanceofCacheAnswerRootIndex); | 1471 __ StoreRoot(v0, Heap::kInstanceofCacheAnswerRootIndex); |
1472 if (ReturnTrueFalseObject()) { | 1472 if (ReturnTrueFalseObject()) { |
1473 __ LoadRoot(v0, Heap::kTrueValueRootIndex); | 1473 __ LoadRoot(v0, Heap::kTrueValueRootIndex); |
1474 } | 1474 } |
1475 } else { | 1475 } else { |
1476 // Patch the call site to return true. | 1476 // Patch the call site to return true. |
1477 __ LoadRoot(v0, Heap::kTrueValueRootIndex); | 1477 __ LoadRoot(v0, Heap::kTrueValueRootIndex); |
1478 __ Addu(inline_site, inline_site, Operand(kDeltaToLoadBoolResult)); | 1478 __ Addu(inline_site, inline_site, Operand(kDeltaToLoadBoolResult)); |
1479 // Get the boolean result location in scratch and patch it. | 1479 // Get the boolean result location in scratch and patch it. |
1480 __ PatchRelocatedValue(inline_site, scratch, v0); | 1480 __ PatchRelocatedValue(inline_site, scratch, v0); |
1481 | 1481 |
1482 if (!ReturnTrueFalseObject()) { | 1482 if (!ReturnTrueFalseObject()) { |
1483 DCHECK_EQ(Smi::FromInt(0), 0); | |
1484 __ mov(v0, zero_reg); | 1483 __ mov(v0, zero_reg); |
1485 } | 1484 } |
1486 } | 1485 } |
1487 __ DropAndRet(HasArgsInRegisters() ? 0 : 2); | 1486 __ DropAndRet(HasArgsInRegisters() ? 0 : 2); |
1488 | 1487 |
1489 __ bind(&is_not_instance); | 1488 __ bind(&is_not_instance); |
1490 if (!HasCallSiteInlineCheck()) { | 1489 if (!HasCallSiteInlineCheck()) { |
1491 __ li(v0, Operand(Smi::FromInt(1))); | 1490 __ li(v0, Operand(Smi::FromInt(1))); |
1492 __ StoreRoot(v0, Heap::kInstanceofCacheAnswerRootIndex); | 1491 __ StoreRoot(v0, Heap::kInstanceofCacheAnswerRootIndex); |
1493 if (ReturnTrueFalseObject()) { | 1492 if (ReturnTrueFalseObject()) { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 __ bind(&skip_min); | 1708 __ bind(&skip_min); |
1710 | 1709 |
1711 __ bind(&try_allocate); | 1710 __ bind(&try_allocate); |
1712 | 1711 |
1713 // Compute the sizes of backing store, parameter map, and arguments object. | 1712 // Compute the sizes of backing store, parameter map, and arguments object. |
1714 // 1. Parameter map, has 2 extra words containing context and backing store. | 1713 // 1. Parameter map, has 2 extra words containing context and backing store. |
1715 const int kParameterMapHeaderSize = | 1714 const int kParameterMapHeaderSize = |
1716 FixedArray::kHeaderSize + 2 * kPointerSize; | 1715 FixedArray::kHeaderSize + 2 * kPointerSize; |
1717 // If there are no mapped parameters, we do not need the parameter_map. | 1716 // If there are no mapped parameters, we do not need the parameter_map. |
1718 Label param_map_size; | 1717 Label param_map_size; |
1719 DCHECK_EQ(0, Smi::FromInt(0)); | 1718 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0)); |
1720 __ Branch(USE_DELAY_SLOT, ¶m_map_size, eq, a1, Operand(zero_reg)); | 1719 __ Branch(USE_DELAY_SLOT, ¶m_map_size, eq, a1, Operand(zero_reg)); |
1721 __ mov(t5, zero_reg); // In delay slot: param map size = 0 when a1 == 0. | 1720 __ mov(t5, zero_reg); // In delay slot: param map size = 0 when a1 == 0. |
1722 __ sll(t5, a1, 1); | 1721 __ sll(t5, a1, 1); |
1723 __ addiu(t5, t5, kParameterMapHeaderSize); | 1722 __ addiu(t5, t5, kParameterMapHeaderSize); |
1724 __ bind(¶m_map_size); | 1723 __ bind(¶m_map_size); |
1725 | 1724 |
1726 // 2. Backing store. | 1725 // 2. Backing store. |
1727 __ sll(t6, a2, 1); | 1726 __ sll(t6, a2, 1); |
1728 __ Addu(t5, t5, Operand(t6)); | 1727 __ Addu(t5, t5, Operand(t6)); |
1729 __ Addu(t5, t5, Operand(FixedArray::kHeaderSize)); | 1728 __ Addu(t5, t5, Operand(FixedArray::kHeaderSize)); |
(...skipping 3421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5151 kStackUnwindSpace, kInvalidStackOffset, | 5150 kStackUnwindSpace, kInvalidStackOffset, |
5152 MemOperand(fp, 6 * kPointerSize), NULL); | 5151 MemOperand(fp, 6 * kPointerSize), NULL); |
5153 } | 5152 } |
5154 | 5153 |
5155 | 5154 |
5156 #undef __ | 5155 #undef __ |
5157 | 5156 |
5158 } } // namespace v8::internal | 5157 } } // namespace v8::internal |
5159 | 5158 |
5160 #endif // V8_TARGET_ARCH_MIPS | 5159 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |