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 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3475 __ lbu(scratch1, MemOperand(scratch3)); | 3475 __ lbu(scratch1, MemOperand(scratch3)); |
3476 __ Addu(scratch3, right, index); | 3476 __ Addu(scratch3, right, index); |
3477 __ lbu(scratch2, MemOperand(scratch3)); | 3477 __ lbu(scratch2, MemOperand(scratch3)); |
3478 __ Branch(chars_not_equal, ne, scratch1, Operand(scratch2)); | 3478 __ Branch(chars_not_equal, ne, scratch1, Operand(scratch2)); |
3479 __ Addu(index, index, 1); | 3479 __ Addu(index, index, 1); |
3480 __ Branch(&loop, ne, index, Operand(zero_reg)); | 3480 __ Branch(&loop, ne, index, Operand(zero_reg)); |
3481 } | 3481 } |
3482 | 3482 |
3483 | 3483 |
3484 void StringCompareStub::Generate(MacroAssembler* masm) { | 3484 void StringCompareStub::Generate(MacroAssembler* masm) { |
3485 Label runtime; | 3485 // ----------- S t a t e ------------- |
3486 | 3486 // -- a1 : left |
3487 Counters* counters = isolate()->counters(); | 3487 // -- a0 : right |
3488 | 3488 // -- ra : return address |
3489 // Stack frame on entry. | 3489 // ----------------------------------- |
3490 // sp[0]: right string | 3490 __ AssertString(a1); |
3491 // sp[4]: left string | 3491 __ AssertString(a0); |
3492 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); // Left. | |
3493 __ lw(a0, MemOperand(sp, 0 * kPointerSize)); // Right. | |
3494 | 3492 |
3495 Label not_same; | 3493 Label not_same; |
3496 __ Branch(¬_same, ne, a0, Operand(a1)); | 3494 __ Branch(¬_same, ne, a0, Operand(a1)); |
3497 STATIC_ASSERT(EQUAL == 0); | |
3498 STATIC_ASSERT(kSmiTag == 0); | |
3499 __ li(v0, Operand(Smi::FromInt(EQUAL))); | 3495 __ li(v0, Operand(Smi::FromInt(EQUAL))); |
3500 __ IncrementCounter(counters->string_compare_native(), 1, a1, a2); | 3496 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, a1, |
3501 __ DropAndRet(2); | 3497 a2); |
| 3498 __ Ret(); |
3502 | 3499 |
3503 __ bind(¬_same); | 3500 __ bind(¬_same); |
3504 | 3501 |
3505 // Check that both objects are sequential one-byte strings. | 3502 // Check that both objects are sequential one-byte strings. |
| 3503 Label runtime; |
3506 __ JumpIfNotBothSequentialOneByteStrings(a1, a0, a2, a3, &runtime); | 3504 __ JumpIfNotBothSequentialOneByteStrings(a1, a0, a2, a3, &runtime); |
3507 | 3505 |
3508 // Compare flat ASCII strings natively. Remove arguments from stack first. | 3506 // Compare flat ASCII strings natively. |
3509 __ IncrementCounter(counters->string_compare_native(), 1, a2, a3); | 3507 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, a2, |
3510 __ Addu(sp, sp, Operand(2 * kPointerSize)); | 3508 a3); |
3511 StringHelper::GenerateCompareFlatOneByteStrings(masm, a1, a0, a2, a3, t0, t1); | 3509 StringHelper::GenerateCompareFlatOneByteStrings(masm, a1, a0, a2, a3, t0, t1); |
3512 | 3510 |
3513 __ bind(&runtime); | 3511 __ bind(&runtime); |
| 3512 __ Push(a1, a0); |
3514 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 3513 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
3515 } | 3514 } |
3516 | 3515 |
3517 | 3516 |
3518 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { | 3517 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { |
3519 // ----------- S t a t e ------------- | 3518 // ----------- S t a t e ------------- |
3520 // -- a1 : left | 3519 // -- a1 : left |
3521 // -- a0 : right | 3520 // -- a0 : right |
3522 // -- ra : return address | 3521 // -- ra : return address |
3523 // ----------------------------------- | 3522 // ----------------------------------- |
(...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5737 MemOperand(fp, 6 * kPointerSize), NULL); | 5736 MemOperand(fp, 6 * kPointerSize), NULL); |
5738 } | 5737 } |
5739 | 5738 |
5740 | 5739 |
5741 #undef __ | 5740 #undef __ |
5742 | 5741 |
5743 } // namespace internal | 5742 } // namespace internal |
5744 } // namespace v8 | 5743 } // namespace v8 |
5745 | 5744 |
5746 #endif // V8_TARGET_ARCH_MIPS | 5745 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |