Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
| 8 | 8 |
| 9 #include "src/arm64/assembler-arm64.h" | 9 #include "src/arm64/assembler-arm64.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 backing_store, | 402 backing_store, |
| 403 FixedArray::kHeaderSize - kHeapObjectTag); | 403 FixedArray::kHeaderSize - kHeapObjectTag); |
| 404 __ SmiUntag(scratch, key); | 404 __ SmiUntag(scratch, key); |
| 405 return MemOperand(backing_store, scratch, LSL, kPointerSizeLog2); | 405 return MemOperand(backing_store, scratch, LSL, kPointerSizeLog2); |
| 406 } | 406 } |
| 407 | 407 |
| 408 | 408 |
| 409 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { | 409 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
| 410 // ----------- S t a t e ------------- | 410 // ----------- S t a t e ------------- |
| 411 // -- x2 : name | 411 // -- x2 : name |
| 412 // -- lr : return address | 412 // -- lr : return address |
|
Jakob Kummerow
2014/06/30 14:12:45
another comment that can be trimmed to "The return
mvstanton
2014/06/30 14:59:00
Done.
| |
| 413 // -- x0 : receiver | 413 // -- x1 : receiver |
| 414 // ----------------------------------- | 414 // ----------------------------------- |
| 415 ASSERT(x0.is(ReceiverRegister())); | 415 ASSERT(x1.is(ReceiverRegister())); |
| 416 ASSERT(x2.is(NameRegister())); | 416 ASSERT(x2.is(NameRegister())); |
| 417 | 417 |
| 418 // Probe the stub cache. | 418 // Probe the stub cache. |
| 419 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); | 419 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); |
| 420 masm->isolate()->stub_cache()->GenerateProbe( | 420 masm->isolate()->stub_cache()->GenerateProbe( |
| 421 masm, flags, x0, x2, x3, x4, x5, x6); | 421 masm, flags, x1, x2, x3, x4, x5, x6); |
| 422 | 422 |
| 423 // Cache miss: Jump to runtime. | 423 // Cache miss: Jump to runtime. |
| 424 GenerateMiss(masm); | 424 GenerateMiss(masm); |
| 425 } | 425 } |
| 426 | 426 |
| 427 | 427 |
| 428 void LoadIC::GenerateNormal(MacroAssembler* masm) { | 428 void LoadIC::GenerateNormal(MacroAssembler* masm) { |
| 429 // ----------- S t a t e ------------- | 429 // ----------- S t a t e ------------- |
| 430 // -- x2 : name | 430 // -- x2 : name |
| 431 // -- lr : return address | 431 // -- lr : return address |
| 432 // -- x0 : receiver | 432 // -- x1 : receiver |
| 433 // ----------------------------------- | 433 // ----------------------------------- |
| 434 ASSERT(x0.is(ReceiverRegister())); | 434 ASSERT(x1.is(ReceiverRegister())); |
| 435 ASSERT(x2.is(NameRegister())); | 435 ASSERT(x2.is(NameRegister())); |
| 436 Label miss, slow; | 436 Label miss, slow; |
| 437 | 437 |
| 438 GenerateNameDictionaryReceiverCheck(masm, x0, x1, x3, x4, &miss); | 438 GenerateNameDictionaryReceiverCheck(masm, x1, x0, x3, x4, &miss); |
| 439 | 439 |
| 440 // x1 now holds the property dictionary. | 440 // x0 now holds the property dictionary. |
| 441 GenerateDictionaryLoad(masm, &slow, x1, x2, x0, x3, x4); | 441 GenerateDictionaryLoad(masm, &slow, x0, x2, x0, x3, x4); |
| 442 __ Ret(); | 442 __ Ret(); |
| 443 | 443 |
| 444 // Dictionary load failed, go slow (but don't miss). | 444 // Dictionary load failed, go slow (but don't miss). |
| 445 __ Bind(&slow); | 445 __ Bind(&slow); |
| 446 GenerateRuntimeGetProperty(masm); | 446 GenerateRuntimeGetProperty(masm); |
| 447 | 447 |
| 448 // Cache miss: Jump to runtime. | 448 // Cache miss: Jump to runtime. |
| 449 __ Bind(&miss); | 449 __ Bind(&miss); |
| 450 GenerateMiss(masm); | 450 GenerateMiss(masm); |
| 451 } | 451 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 467 | 467 |
| 468 | 468 |
| 469 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 469 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 470 // The return address is on the stack. | 470 // The return address is on the stack. |
| 471 __ Push(ReceiverRegister(), NameRegister()); | 471 __ Push(ReceiverRegister(), NameRegister()); |
| 472 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); | 472 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); |
| 473 } | 473 } |
| 474 | 474 |
| 475 | 475 |
| 476 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { | 476 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { |
| 477 // ---------- S t a t e -------------- | 477 // The return address is on the stack. |
| 478 // -- lr : return address | |
| 479 // -- x0 : key | |
| 480 // -- x1 : receiver | |
| 481 // ----------------------------------- | |
| 482 Register result = x0; | 478 Register result = x0; |
| 483 Register receiver = ReceiverRegister(); | 479 Register receiver = ReceiverRegister(); |
| 484 Register key = NameRegister(); | 480 Register key = NameRegister(); |
| 485 ASSERT(receiver.is(x1)); | 481 ASSERT(receiver.is(x1)); |
| 486 ASSERT(key.is(x0)); | 482 ASSERT(key.is(x2)); |
| 487 | 483 |
| 488 Label miss, unmapped; | 484 Label miss, unmapped; |
| 489 | 485 |
| 490 Register map_scratch = x2; | 486 Register map_scratch = x0; |
| 491 MemOperand mapped_location = GenerateMappedArgumentsLookup( | 487 MemOperand mapped_location = GenerateMappedArgumentsLookup( |
| 492 masm, receiver, key, map_scratch, x3, x4, &unmapped, &miss); | 488 masm, receiver, key, map_scratch, x3, x4, &unmapped, &miss); |
| 493 __ Ldr(result, mapped_location); | 489 __ Ldr(result, mapped_location); |
| 494 __ Ret(); | 490 __ Ret(); |
| 495 | 491 |
| 496 __ Bind(&unmapped); | 492 __ Bind(&unmapped); |
| 497 // Parameter map is left in map_scratch when a jump on unmapped is done. | 493 // Parameter map is left in map_scratch when a jump on unmapped is done. |
| 498 MemOperand unmapped_location = | 494 MemOperand unmapped_location = |
| 499 GenerateUnmappedArgumentsLookup(masm, key, map_scratch, x3, &miss); | 495 GenerateUnmappedArgumentsLookup(masm, key, map_scratch, x3, &miss); |
| 500 __ Ldr(x2, unmapped_location); | 496 __ Ldr(x0, unmapped_location); |
|
Jakob Kummerow
2014/06/30 14:12:45
I'd s/x0/result/ here (and in the next line)
mvstanton
2014/06/30 14:59:00
Done.
| |
| 501 __ JumpIfRoot(x2, Heap::kTheHoleValueRootIndex, &miss); | 497 __ JumpIfRoot(x0, Heap::kTheHoleValueRootIndex, &miss); |
| 502 // Move the result in x0. x0 must be preserved on miss. | |
| 503 __ Mov(result, x2); | |
| 504 __ Ret(); | 498 __ Ret(); |
| 505 | 499 |
| 506 __ Bind(&miss); | 500 __ Bind(&miss); |
| 507 GenerateMiss(masm); | 501 GenerateMiss(masm); |
| 508 } | 502 } |
| 509 | 503 |
| 510 | 504 |
| 511 void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { | 505 void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { |
| 512 ASM_LOCATION("KeyedStoreIC::GenerateSloppyArguments"); | 506 ASM_LOCATION("KeyedStoreIC::GenerateSloppyArguments"); |
| 513 // ---------- S t a t e -------------- | 507 // ---------- S t a t e -------------- |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 569 | 563 |
| 570 // Perform tail call to the entry. | 564 // Perform tail call to the entry. |
| 571 ExternalReference ref = | 565 ExternalReference ref = |
| 572 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate); | 566 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate); |
| 573 | 567 |
| 574 __ TailCallExternalReference(ref, 2, 1); | 568 __ TailCallExternalReference(ref, 2, 1); |
| 575 } | 569 } |
| 576 | 570 |
| 577 | 571 |
| 578 // IC register specifications | 572 // IC register specifications |
| 579 const Register LoadIC::ReceiverRegister() { return x0; } | 573 const Register LoadIC::ReceiverRegister() { return x1; } |
| 580 const Register LoadIC::NameRegister() { return x2; } | 574 const Register LoadIC::NameRegister() { return x2; } |
| 581 const Register KeyedLoadIC::ReceiverRegister() { return x1; } | |
| 582 const Register KeyedLoadIC::NameRegister() { return x0; } | |
| 583 | 575 |
| 584 | 576 |
| 585 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 577 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 586 // The return address is on the stack. | 578 // The return address is on the stack. |
| 587 __ Push(ReceiverRegister(), NameRegister()); | 579 __ Push(ReceiverRegister(), NameRegister()); |
| 588 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); | 580 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); |
| 589 } | 581 } |
| 590 | 582 |
| 591 | 583 |
| 592 static void GenerateKeyedLoadWithSmiKey(MacroAssembler* masm, | 584 static void GenerateKeyedLoadWithSmiKey(MacroAssembler* masm, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 746 GenerateGlobalInstanceTypeCheck(masm, scratch1, slow); | 738 GenerateGlobalInstanceTypeCheck(masm, scratch1, slow); |
| 747 // Load the property. | 739 // Load the property. |
| 748 GenerateDictionaryLoad(masm, slow, scratch2, key, result, scratch1, scratch3); | 740 GenerateDictionaryLoad(masm, slow, scratch2, key, result, scratch1, scratch3); |
| 749 __ IncrementCounter(isolate->counters()->keyed_load_generic_symbol(), | 741 __ IncrementCounter(isolate->counters()->keyed_load_generic_symbol(), |
| 750 1, scratch1, scratch2); | 742 1, scratch1, scratch2); |
| 751 __ Ret(); | 743 __ Ret(); |
| 752 } | 744 } |
| 753 | 745 |
| 754 | 746 |
| 755 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { | 747 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
| 756 // ---------- S t a t e -------------- | 748 // The return address is on the stack. |
| 757 // -- lr : return address | |
| 758 // -- x0 : key | |
| 759 // -- x1 : receiver | |
| 760 // ----------------------------------- | |
| 761 Label slow, check_name, index_smi, index_name; | 749 Label slow, check_name, index_smi, index_name; |
| 762 | 750 |
| 763 Register key = NameRegister(); | 751 Register key = NameRegister(); |
| 764 Register receiver = ReceiverRegister(); | 752 Register receiver = ReceiverRegister(); |
| 765 ASSERT(key.is(x0)); | 753 ASSERT(key.is(x2)); |
| 766 ASSERT(receiver.is(x1)); | 754 ASSERT(receiver.is(x1)); |
| 767 | 755 |
| 768 __ JumpIfNotSmi(key, &check_name); | 756 __ JumpIfNotSmi(key, &check_name); |
| 769 __ Bind(&index_smi); | 757 __ Bind(&index_smi); |
| 770 // Now the key is known to be a smi. This place is also jumped to from below | 758 // Now the key is known to be a smi. This place is also jumped to from below |
| 771 // where a numeric string is converted to a smi. | 759 // where a numeric string is converted to a smi. |
| 772 GenerateKeyedLoadWithSmiKey(masm, key, receiver, x2, x3, x4, x5, x6, &slow); | 760 GenerateKeyedLoadWithSmiKey(masm, key, receiver, x7, x3, x4, x5, x6, &slow); |
| 773 | 761 |
| 774 // Slow case, key and receiver still in x0 and x1. | 762 // Slow case |
|
Jakob Kummerow
2014/06/30 14:12:45
nit: trailing full stop please.
mvstanton
2014/06/30 14:59:00
Done.
| |
| 775 __ Bind(&slow); | 763 __ Bind(&slow); |
| 776 __ IncrementCounter( | 764 __ IncrementCounter( |
| 777 masm->isolate()->counters()->keyed_load_generic_slow(), 1, x2, x3); | 765 masm->isolate()->counters()->keyed_load_generic_slow(), 1, x4, x3); |
| 778 GenerateRuntimeGetProperty(masm); | 766 GenerateRuntimeGetProperty(masm); |
| 779 | 767 |
| 780 __ Bind(&check_name); | 768 __ Bind(&check_name); |
| 781 GenerateKeyNameCheck(masm, key, x2, x3, &index_name, &slow); | 769 GenerateKeyNameCheck(masm, key, x0, x3, &index_name, &slow); |
| 782 | 770 |
| 783 GenerateKeyedLoadWithNameKey(masm, key, receiver, x2, x3, x4, x5, x6, &slow); | 771 GenerateKeyedLoadWithNameKey(masm, key, receiver, x7, x3, x4, x5, x6, &slow); |
| 784 | 772 |
| 785 __ Bind(&index_name); | 773 __ Bind(&index_name); |
| 786 __ IndexFromHash(x3, key); | 774 __ IndexFromHash(x3, key); |
| 787 // Now jump to the place where smi keys are handled. | 775 // Now jump to the place where smi keys are handled. |
| 788 __ B(&index_smi); | 776 __ B(&index_smi); |
| 789 } | 777 } |
| 790 | 778 |
| 791 | 779 |
| 792 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { | 780 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
|
Jakob Kummerow
2014/06/30 14:12:45
Wohoo! Register refactoring nirvana -- nothing to
mvstanton
2014/06/30 14:59:00
:D
| |
| 793 // Return address is on the stack. | 781 // Return address is on the stack. |
| 794 Label miss; | 782 Label miss; |
| 795 | 783 |
| 796 Register receiver = ReceiverRegister(); | 784 Register receiver = ReceiverRegister(); |
| 797 Register index = NameRegister(); | 785 Register index = NameRegister(); |
| 798 Register result = x0; | 786 Register result = x0; |
| 799 Register scratch = x3; | 787 Register scratch = x3; |
| 800 ASSERT(!scratch.is(receiver) && !scratch.is(index)); | 788 ASSERT(!scratch.is(receiver) && !scratch.is(index)); |
| 801 | 789 |
| 802 StringCharAtGenerator char_at_generator(receiver, | 790 StringCharAtGenerator char_at_generator(receiver, |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 817 GenerateMiss(masm); | 805 GenerateMiss(masm); |
| 818 } | 806 } |
| 819 | 807 |
| 820 | 808 |
| 821 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { | 809 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
| 822 // Return address is on the stack. | 810 // Return address is on the stack. |
| 823 Label slow; | 811 Label slow; |
| 824 | 812 |
| 825 Register receiver = ReceiverRegister(); | 813 Register receiver = ReceiverRegister(); |
| 826 Register key = NameRegister(); | 814 Register key = NameRegister(); |
| 827 Register scratch1 = x2; | 815 Register scratch1 = x3; |
| 828 Register scratch2 = x3; | 816 Register scratch2 = x4; |
| 829 ASSERT(!scratch1.is(receiver) && !scratch1.is(key)); | 817 ASSERT(!scratch1.is(receiver) && !scratch1.is(key)); |
| 830 ASSERT(!scratch2.is(receiver) && !scratch2.is(key)); | 818 ASSERT(!scratch2.is(receiver) && !scratch2.is(key)); |
| 831 | 819 |
| 832 // Check that the receiver isn't a smi. | 820 // Check that the receiver isn't a smi. |
| 833 __ JumpIfSmi(receiver, &slow); | 821 __ JumpIfSmi(receiver, &slow); |
| 834 | 822 |
| 835 // Check that the key is an array index, that is Uint32. | 823 // Check that the key is an array index, that is Uint32. |
| 836 __ TestAndBranchIfAnySet(key, kSmiTagMask | kSmiSignMask, &slow); | 824 __ TestAndBranchIfAnySet(key, kSmiTagMask | kSmiSignMask, &slow); |
| 837 | 825 |
| 838 // Get the map of the receiver. | 826 // Get the map of the receiver. |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1371 ASSERT(to_patch->Mask(TestBranchMask) == TBNZ); | 1359 ASSERT(to_patch->Mask(TestBranchMask) == TBNZ); |
| 1372 // This is JumpIfSmi(smi_reg, branch_imm). | 1360 // This is JumpIfSmi(smi_reg, branch_imm). |
| 1373 patcher.tbz(smi_reg, 0, branch_imm); | 1361 patcher.tbz(smi_reg, 0, branch_imm); |
| 1374 } | 1362 } |
| 1375 } | 1363 } |
| 1376 | 1364 |
| 1377 | 1365 |
| 1378 } } // namespace v8::internal | 1366 } } // namespace v8::internal |
| 1379 | 1367 |
| 1380 #endif // V8_TARGET_ARCH_ARM64 | 1368 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |