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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 3496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3507 __ lbu(scratch1, MemOperand(scratch3)); | 3507 __ lbu(scratch1, MemOperand(scratch3)); |
3508 __ Daddu(scratch3, right, index); | 3508 __ Daddu(scratch3, right, index); |
3509 __ lbu(scratch2, MemOperand(scratch3)); | 3509 __ lbu(scratch2, MemOperand(scratch3)); |
3510 __ Branch(chars_not_equal, ne, scratch1, Operand(scratch2)); | 3510 __ Branch(chars_not_equal, ne, scratch1, Operand(scratch2)); |
3511 __ Daddu(index, index, 1); | 3511 __ Daddu(index, index, 1); |
3512 __ Branch(&loop, ne, index, Operand(zero_reg)); | 3512 __ Branch(&loop, ne, index, Operand(zero_reg)); |
3513 } | 3513 } |
3514 | 3514 |
3515 | 3515 |
3516 void StringCompareStub::Generate(MacroAssembler* masm) { | 3516 void StringCompareStub::Generate(MacroAssembler* masm) { |
3517 Label runtime; | 3517 // ----------- S t a t e ------------- |
3518 | 3518 // -- a1 : left |
3519 Counters* counters = isolate()->counters(); | 3519 // -- a0 : right |
3520 | 3520 // -- ra : return address |
3521 // Stack frame on entry. | 3521 // ----------------------------------- |
3522 // sp[0]: right string | 3522 __ AssertString(a1); |
3523 // sp[4]: left string | 3523 __ AssertString(a0); |
3524 __ ld(a1, MemOperand(sp, 1 * kPointerSize)); // Left. | |
3525 __ ld(a0, MemOperand(sp, 0 * kPointerSize)); // Right. | |
3526 | 3524 |
3527 Label not_same; | 3525 Label not_same; |
3528 __ Branch(¬_same, ne, a0, Operand(a1)); | 3526 __ Branch(¬_same, ne, a0, Operand(a1)); |
3529 STATIC_ASSERT(EQUAL == 0); | |
3530 STATIC_ASSERT(kSmiTag == 0); | |
3531 __ li(v0, Operand(Smi::FromInt(EQUAL))); | 3527 __ li(v0, Operand(Smi::FromInt(EQUAL))); |
3532 __ IncrementCounter(counters->string_compare_native(), 1, a1, a2); | 3528 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, a1, |
3533 __ DropAndRet(2); | 3529 a2); |
| 3530 __ Ret(); |
3534 | 3531 |
3535 __ bind(¬_same); | 3532 __ bind(¬_same); |
3536 | 3533 |
3537 // Check that both objects are sequential one_byte strings. | 3534 // Check that both objects are sequential one-byte strings. |
| 3535 Label runtime; |
3538 __ JumpIfNotBothSequentialOneByteStrings(a1, a0, a2, a3, &runtime); | 3536 __ JumpIfNotBothSequentialOneByteStrings(a1, a0, a2, a3, &runtime); |
3539 | 3537 |
3540 // Compare flat one_byte strings natively. Remove arguments from stack first. | 3538 // Compare flat ASCII strings natively. |
3541 __ IncrementCounter(counters->string_compare_native(), 1, a2, a3); | 3539 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, a2, |
3542 __ Daddu(sp, sp, Operand(2 * kPointerSize)); | 3540 a3); |
3543 StringHelper::GenerateCompareFlatOneByteStrings(masm, a1, a0, a2, a3, a4, a5); | 3541 StringHelper::GenerateCompareFlatOneByteStrings(masm, a1, a0, a2, a3, t0, t1); |
3544 | 3542 |
3545 __ bind(&runtime); | 3543 __ bind(&runtime); |
| 3544 __ Push(a1, a0); |
3546 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 3545 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
3547 } | 3546 } |
3548 | 3547 |
3549 | 3548 |
3550 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { | 3549 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { |
3551 // ----------- S t a t e ------------- | 3550 // ----------- S t a t e ------------- |
3552 // -- a1 : left | 3551 // -- a1 : left |
3553 // -- a0 : right | 3552 // -- a0 : right |
3554 // -- ra : return address | 3553 // -- ra : return address |
3555 // ----------------------------------- | 3554 // ----------------------------------- |
(...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5764 MemOperand(fp, 6 * kPointerSize), NULL); | 5763 MemOperand(fp, 6 * kPointerSize), NULL); |
5765 } | 5764 } |
5766 | 5765 |
5767 | 5766 |
5768 #undef __ | 5767 #undef __ |
5769 | 5768 |
5770 } // namespace internal | 5769 } // namespace internal |
5771 } // namespace v8 | 5770 } // namespace v8 |
5772 | 5771 |
5773 #endif // V8_TARGET_ARCH_MIPS64 | 5772 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |