Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 1347913003: [stubs] Refactor StringCompareStub and use it for HStringCompareAndBranch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interface-descriptors.cc ('k') | src/mips/interface-descriptors-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(&not_same, ne, a0, Operand(a1)); 3494 __ Branch(&not_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(&not_same); 3500 __ bind(&not_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
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
OLDNEW
« no previous file with comments | « src/interface-descriptors.cc ('k') | src/mips/interface-descriptors-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698