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

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

Issue 1765823002: [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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
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 3450 matching lines...) Expand 10 before | Expand all | Expand 10 after
3461 __ Bind(&loop); 3461 __ Bind(&loop);
3462 __ Ldrb(scratch1, MemOperand(left, index)); 3462 __ Ldrb(scratch1, MemOperand(left, index));
3463 __ Ldrb(scratch2, MemOperand(right, index)); 3463 __ Ldrb(scratch2, MemOperand(right, index));
3464 __ Cmp(scratch1, scratch2); 3464 __ Cmp(scratch1, scratch2);
3465 __ B(ne, chars_not_equal); 3465 __ B(ne, chars_not_equal);
3466 __ Add(index, index, 1); 3466 __ Add(index, index, 1);
3467 __ Cbnz(index, &loop); 3467 __ Cbnz(index, &loop);
3468 } 3468 }
3469 3469
3470 3470
3471 void StringCompareStub::Generate(MacroAssembler* masm) {
3472 // ----------- S t a t e -------------
3473 // -- x1 : left
3474 // -- x0 : right
3475 // -- lr : return address
3476 // -----------------------------------
3477 __ AssertString(x1);
3478 __ AssertString(x0);
3479
3480 Label not_same;
3481 __ Cmp(x0, x1);
3482 __ B(ne, &not_same);
3483 __ Mov(x0, Smi::FromInt(EQUAL));
3484 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, x3,
3485 x4);
3486 __ Ret();
3487
3488 __ Bind(&not_same);
3489
3490 // Check that both objects are sequential one-byte strings.
3491 Label runtime;
3492 __ JumpIfEitherIsNotSequentialOneByteStrings(x1, x0, x12, x13, &runtime);
3493
3494 // Compare flat one-byte strings natively.
3495 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, x3,
3496 x4);
3497 StringHelper::GenerateCompareFlatOneByteStrings(masm, x1, x0, x12, x13, x14,
3498 x15);
3499
3500 // Call the runtime.
3501 // Returns -1 (less), 0 (equal), or 1 (greater) tagged as a small integer.
3502 __ Bind(&runtime);
3503 __ Push(x1, x0);
3504 __ TailCallRuntime(Runtime::kStringCompare);
3505 }
3506
3507
3508 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { 3471 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
3509 // ----------- S t a t e ------------- 3472 // ----------- S t a t e -------------
3510 // -- x1 : left 3473 // -- x1 : left
3511 // -- x0 : right 3474 // -- x0 : right
3512 // -- lr : return address 3475 // -- lr : return address
3513 // ----------------------------------- 3476 // -----------------------------------
3514 3477
3515 // Load x2 with the allocation site. We stick an undefined dummy value here 3478 // Load x2 with the allocation site. We stick an undefined dummy value here
3516 // and replace it with the real allocation site later when we instantiate this 3479 // and replace it with the real allocation site later when we instantiate this
3517 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). 3480 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate().
(...skipping 2492 matching lines...) Expand 10 before | Expand all | Expand 10 after
6010 return_value_operand, NULL); 5973 return_value_operand, NULL);
6011 } 5974 }
6012 5975
6013 5976
6014 #undef __ 5977 #undef __
6015 5978
6016 } // namespace internal 5979 } // namespace internal
6017 } // namespace v8 5980 } // namespace v8
6018 5981
6019 #endif // V8_TARGET_ARCH_ARM64 5982 #endif // V8_TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698