| 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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 // NOTICE! This code is only reached after a smi-fast-case check, so | 576 // NOTICE! This code is only reached after a smi-fast-case check, so |
| 577 // it is certain that at least one operand isn't a smi. | 577 // it is certain that at least one operand isn't a smi. |
| 578 | 578 |
| 579 // Handle the case where the objects are identical. Either returns the answer | 579 // Handle the case where the objects are identical. Either returns the answer |
| 580 // or goes to slow. Only falls through if the objects were not identical. | 580 // or goes to slow. Only falls through if the objects were not identical. |
| 581 EmitIdenticalObjectComparison(masm, &slow, cc); | 581 EmitIdenticalObjectComparison(masm, &slow, cc); |
| 582 | 582 |
| 583 // If either is a Smi (we know that not both are), then they can only | 583 // If either is a Smi (we know that not both are), then they can only |
| 584 // be strictly equal if the other is a HeapNumber. | 584 // be strictly equal if the other is a HeapNumber. |
| 585 STATIC_ASSERT(kSmiTag == 0); | 585 STATIC_ASSERT(kSmiTag == 0); |
| 586 DCHECK_EQ(0, Smi::FromInt(0)); | 586 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0)); |
| 587 __ And(a6, lhs, Operand(rhs)); | 587 __ And(a6, lhs, Operand(rhs)); |
| 588 __ JumpIfNotSmi(a6, ¬_smis, a4); | 588 __ JumpIfNotSmi(a6, ¬_smis, a4); |
| 589 // One operand is a smi. EmitSmiNonsmiComparison generates code that can: | 589 // One operand is a smi. EmitSmiNonsmiComparison generates code that can: |
| 590 // 1) Return the answer. | 590 // 1) Return the answer. |
| 591 // 2) Go to slow. | 591 // 2) Go to slow. |
| 592 // 3) Fall through to both_loaded_as_doubles. | 592 // 3) Fall through to both_loaded_as_doubles. |
| 593 // 4) Jump to rhs_not_nan. | 593 // 4) Jump to rhs_not_nan. |
| 594 // In cases 3 and 4 we have found out we were dealing with a number-number | 594 // In cases 3 and 4 we have found out we were dealing with a number-number |
| 595 // comparison and the numbers have been loaded into f12 and f14 as doubles, | 595 // comparison and the numbers have been loaded into f12 and f14 as doubles, |
| 596 // or in GP registers (a0, a1, a2, a3) depending on the presence of the FPU. | 596 // or in GP registers (a0, a1, a2, a3) depending on the presence of the FPU. |
| (...skipping 861 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 __ ld(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset)); | 1463 __ ld(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
| 1464 __ ld(scratch, FieldMemOperand(scratch, Map::kPrototypeOffset)); | 1464 __ ld(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 __ Daddu(inline_site, inline_site, Operand(kDeltaToLoadBoolResult)); | 1478 __ Daddu(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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 __ bind(&skip_min); | 1707 __ bind(&skip_min); |
| 1709 | 1708 |
| 1710 __ bind(&try_allocate); | 1709 __ bind(&try_allocate); |
| 1711 | 1710 |
| 1712 // Compute the sizes of backing store, parameter map, and arguments object. | 1711 // Compute the sizes of backing store, parameter map, and arguments object. |
| 1713 // 1. Parameter map, has 2 extra words containing context and backing store. | 1712 // 1. Parameter map, has 2 extra words containing context and backing store. |
| 1714 const int kParameterMapHeaderSize = | 1713 const int kParameterMapHeaderSize = |
| 1715 FixedArray::kHeaderSize + 2 * kPointerSize; | 1714 FixedArray::kHeaderSize + 2 * kPointerSize; |
| 1716 // If there are no mapped parameters, we do not need the parameter_map. | 1715 // If there are no mapped parameters, we do not need the parameter_map. |
| 1717 Label param_map_size; | 1716 Label param_map_size; |
| 1718 DCHECK_EQ(0, Smi::FromInt(0)); | 1717 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0)); |
| 1719 __ Branch(USE_DELAY_SLOT, ¶m_map_size, eq, a1, Operand(zero_reg)); | 1718 __ Branch(USE_DELAY_SLOT, ¶m_map_size, eq, a1, Operand(zero_reg)); |
| 1720 __ mov(t1, zero_reg); // In delay slot: param map size = 0 when a1 == 0. | 1719 __ mov(t1, zero_reg); // In delay slot: param map size = 0 when a1 == 0. |
| 1721 __ SmiScale(t1, a1, kPointerSizeLog2); | 1720 __ SmiScale(t1, a1, kPointerSizeLog2); |
| 1722 __ daddiu(t1, t1, kParameterMapHeaderSize); | 1721 __ daddiu(t1, t1, kParameterMapHeaderSize); |
| 1723 __ bind(¶m_map_size); | 1722 __ bind(¶m_map_size); |
| 1724 | 1723 |
| 1725 // 2. Backing store. | 1724 // 2. Backing store. |
| 1726 __ SmiScale(t2, a2, kPointerSizeLog2); | 1725 __ SmiScale(t2, a2, kPointerSizeLog2); |
| 1727 __ Daddu(t1, t1, Operand(t2)); | 1726 __ Daddu(t1, t1, Operand(t2)); |
| 1728 __ Daddu(t1, t1, Operand(FixedArray::kHeaderSize)); | 1727 __ Daddu(t1, t1, Operand(FixedArray::kHeaderSize)); |
| (...skipping 3462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5191 kStackUnwindSpace, kInvalidStackOffset, | 5190 kStackUnwindSpace, kInvalidStackOffset, |
| 5192 MemOperand(fp, 6 * kPointerSize), NULL); | 5191 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5193 } | 5192 } |
| 5194 | 5193 |
| 5195 | 5194 |
| 5196 #undef __ | 5195 #undef __ |
| 5197 | 5196 |
| 5198 } } // namespace v8::internal | 5197 } } // namespace v8::internal |
| 5199 | 5198 |
| 5200 #endif // V8_TARGET_ARCH_MIPS64 | 5199 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |