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

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

Issue 1358553002: PPC: [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 | « no previous file | src/ppc/interface-descriptors-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 3500 matching lines...) Expand 10 before | Expand all | Expand 10 after
3511 __ lbzx(r0, MemOperand(right, index)); 3511 __ lbzx(r0, MemOperand(right, index));
3512 __ cmp(scratch1, r0); 3512 __ cmp(scratch1, r0);
3513 __ bne(chars_not_equal); 3513 __ bne(chars_not_equal);
3514 __ addi(index, index, Operand(1)); 3514 __ addi(index, index, Operand(1));
3515 __ cmpi(index, Operand::Zero()); 3515 __ cmpi(index, Operand::Zero());
3516 __ bne(&loop); 3516 __ bne(&loop);
3517 } 3517 }
3518 3518
3519 3519
3520 void StringCompareStub::Generate(MacroAssembler* masm) { 3520 void StringCompareStub::Generate(MacroAssembler* masm) {
3521 Label runtime; 3521 // ----------- S t a t e -------------
3522 3522 // -- r4 : left
3523 Counters* counters = isolate()->counters(); 3523 // -- r3 : right
3524 3524 // -- lr : return address
3525 // Stack frame on entry. 3525 // -----------------------------------
3526 // sp[0]: right string 3526 __ AssertString(r4);
3527 // sp[4]: left string 3527 __ AssertString(r3);
3528 __ LoadP(r3, MemOperand(sp)); // Load right in r3, left in r4.
3529 __ LoadP(r4, MemOperand(sp, kPointerSize));
3530 3528
3531 Label not_same; 3529 Label not_same;
3532 __ cmp(r3, r4); 3530 __ cmp(r3, r4);
3533 __ bne(&not_same); 3531 __ bne(&not_same);
3534 STATIC_ASSERT(EQUAL == 0);
3535 STATIC_ASSERT(kSmiTag == 0);
3536 __ LoadSmiLiteral(r3, Smi::FromInt(EQUAL)); 3532 __ LoadSmiLiteral(r3, Smi::FromInt(EQUAL));
3537 __ IncrementCounter(counters->string_compare_native(), 1, r4, r5); 3533 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, r4,
3538 __ addi(sp, sp, Operand(2 * kPointerSize)); 3534 r5);
3539 __ Ret(); 3535 __ Ret();
3540 3536
3541 __ bind(&not_same); 3537 __ bind(&not_same);
3542 3538
3543 // Check that both objects are sequential one-byte strings. 3539 // Check that both objects are sequential one-byte strings.
3540 Label runtime;
3544 __ JumpIfNotBothSequentialOneByteStrings(r4, r3, r5, r6, &runtime); 3541 __ JumpIfNotBothSequentialOneByteStrings(r4, r3, r5, r6, &runtime);
3545 3542
3546 // Compare flat one-byte strings natively. Remove arguments from stack first. 3543 // Compare flat one-byte strings natively.
3547 __ IncrementCounter(counters->string_compare_native(), 1, r5, r6); 3544 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, r5,
3548 __ addi(sp, sp, Operand(2 * kPointerSize)); 3545 r6);
3549 StringHelper::GenerateCompareFlatOneByteStrings(masm, r4, r3, r5, r6, r7); 3546 StringHelper::GenerateCompareFlatOneByteStrings(masm, r4, r3, r5, r6, r7);
3550 3547
3551 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 3548 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
3552 // tagged as a small integer. 3549 // tagged as a small integer.
3553 __ bind(&runtime); 3550 __ bind(&runtime);
3551 __ Push(r4, r3);
3554 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 3552 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
3555 } 3553 }
3556 3554
3557 3555
3558 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { 3556 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
3559 // ----------- S t a t e ------------- 3557 // ----------- S t a t e -------------
3560 // -- r4 : left 3558 // -- r4 : left
3561 // -- r3 : right 3559 // -- r3 : right
3562 // -- lr : return address 3560 // -- lr : return address
3563 // ----------------------------------- 3561 // -----------------------------------
(...skipping 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after
5841 kStackUnwindSpace, NULL, 5839 kStackUnwindSpace, NULL,
5842 MemOperand(fp, 6 * kPointerSize), NULL); 5840 MemOperand(fp, 6 * kPointerSize), NULL);
5843 } 5841 }
5844 5842
5845 5843
5846 #undef __ 5844 #undef __
5847 } // namespace internal 5845 } // namespace internal
5848 } // namespace v8 5846 } // namespace v8
5849 5847
5850 #endif // V8_TARGET_ARCH_PPC 5848 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | src/ppc/interface-descriptors-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698