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

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

Issue 1768013002: X87: [compiler] Introduce code stubs for string relational comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/crankshaft/x87/lithium-codegen-x87.cc ('k') | no next file » | 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_X87 5 #if V8_TARGET_ARCH_X87
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 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 Label loop; 2580 Label loop;
2581 __ bind(&loop); 2581 __ bind(&loop);
2582 __ mov_b(scratch, Operand(left, index, times_1, 0)); 2582 __ mov_b(scratch, Operand(left, index, times_1, 0));
2583 __ cmpb(scratch, Operand(right, index, times_1, 0)); 2583 __ cmpb(scratch, Operand(right, index, times_1, 0));
2584 __ j(not_equal, chars_not_equal, chars_not_equal_near); 2584 __ j(not_equal, chars_not_equal, chars_not_equal_near);
2585 __ inc(index); 2585 __ inc(index);
2586 __ j(not_zero, &loop); 2586 __ j(not_zero, &loop);
2587 } 2587 }
2588 2588
2589 2589
2590 void StringCompareStub::Generate(MacroAssembler* masm) {
2591 // ----------- S t a t e -------------
2592 // -- edx : left string
2593 // -- eax : right string
2594 // -- esp[0] : return address
2595 // -----------------------------------
2596 __ AssertString(edx);
2597 __ AssertString(eax);
2598
2599 Label not_same;
2600 __ cmp(edx, eax);
2601 __ j(not_equal, &not_same, Label::kNear);
2602 __ Move(eax, Immediate(Smi::FromInt(EQUAL)));
2603 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1);
2604 __ Ret();
2605
2606 __ bind(&not_same);
2607
2608 // Check that both objects are sequential one-byte strings.
2609 Label runtime;
2610 __ JumpIfNotBothSequentialOneByteStrings(edx, eax, ecx, ebx, &runtime);
2611
2612 // Compare flat one-byte strings.
2613 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1);
2614 StringHelper::GenerateCompareFlatOneByteStrings(masm, edx, eax, ecx, ebx,
2615 edi);
2616
2617 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
2618 // tagged as a small integer.
2619 __ bind(&runtime);
2620 __ PopReturnAddressTo(ecx);
2621 __ Push(edx);
2622 __ Push(eax);
2623 __ PushReturnAddressFrom(ecx);
2624 __ TailCallRuntime(Runtime::kStringCompare);
2625 }
2626
2627
2628 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { 2590 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
2629 // ----------- S t a t e ------------- 2591 // ----------- S t a t e -------------
2630 // -- edx : left 2592 // -- edx : left
2631 // -- eax : right 2593 // -- eax : right
2632 // -- esp[0] : return address 2594 // -- esp[0] : return address
2633 // ----------------------------------- 2595 // -----------------------------------
2634 2596
2635 // Load ecx with the allocation site. We stick an undefined dummy value here 2597 // Load ecx with the allocation site. We stick an undefined dummy value here
2636 // and replace it with the real allocation site later when we instantiate this 2598 // and replace it with the real allocation site later when we instantiate this
2637 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). 2599 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate().
(...skipping 2960 matching lines...) Expand 10 before | Expand all | Expand 10 after
5598 return_value_operand, NULL); 5560 return_value_operand, NULL);
5599 } 5561 }
5600 5562
5601 5563
5602 #undef __ 5564 #undef __
5603 5565
5604 } // namespace internal 5566 } // namespace internal
5605 } // namespace v8 5567 } // namespace v8
5606 5568
5607 #endif // V8_TARGET_ARCH_X87 5569 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/crankshaft/x87/lithium-codegen-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698