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

Side by Side Diff: src/arm64/ic-arm64.cc

Issue 356713003: Use IC register definitions in platform files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports and comments. Created 6 years, 5 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 | Annotate | Revision Log
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 #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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
413 // -- x0 : receiver 413 // -- x0 : receiver
414 // ----------------------------------- 414 // -----------------------------------
415 ASSERT(x0.is(ReceiverRegister()));
416 ASSERT(x2.is(NameRegister()));
415 417
416 // Probe the stub cache. 418 // Probe the stub cache.
417 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); 419 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
418 masm->isolate()->stub_cache()->GenerateProbe( 420 masm->isolate()->stub_cache()->GenerateProbe(
419 masm, flags, x0, x2, x3, x4, x5, x6); 421 masm, flags, x0, x2, x3, x4, x5, x6);
420 422
421 // Cache miss: Jump to runtime. 423 // Cache miss: Jump to runtime.
422 GenerateMiss(masm); 424 GenerateMiss(masm);
423 } 425 }
424 426
425 427
426 void LoadIC::GenerateNormal(MacroAssembler* masm) { 428 void LoadIC::GenerateNormal(MacroAssembler* masm) {
427 // ----------- S t a t e ------------- 429 // ----------- S t a t e -------------
428 // -- x2 : name 430 // -- x2 : name
429 // -- lr : return address 431 // -- lr : return address
430 // -- x0 : receiver 432 // -- x0 : receiver
431 // ----------------------------------- 433 // -----------------------------------
434 ASSERT(x0.is(ReceiverRegister()));
435 ASSERT(x2.is(NameRegister()));
432 Label miss, slow; 436 Label miss, slow;
433 437
434 GenerateNameDictionaryReceiverCheck(masm, x0, x1, x3, x4, &miss); 438 GenerateNameDictionaryReceiverCheck(masm, x0, x1, x3, x4, &miss);
435 439
436 // x1 now holds the property dictionary. 440 // x1 now holds the property dictionary.
437 GenerateDictionaryLoad(masm, &slow, x1, x2, x0, x3, x4); 441 GenerateDictionaryLoad(masm, &slow, x1, x2, x0, x3, x4);
438 __ Ret(); 442 __ Ret();
439 443
440 // Dictionary load failed, go slow (but don't miss). 444 // Dictionary load failed, go slow (but don't miss).
441 __ Bind(&slow); 445 __ Bind(&slow);
442 GenerateRuntimeGetProperty(masm); 446 GenerateRuntimeGetProperty(masm);
443 447
444 // Cache miss: Jump to runtime. 448 // Cache miss: Jump to runtime.
445 __ Bind(&miss); 449 __ Bind(&miss);
446 GenerateMiss(masm); 450 GenerateMiss(masm);
447 } 451 }
448 452
449 453
450 void LoadIC::GenerateMiss(MacroAssembler* masm) { 454 void LoadIC::GenerateMiss(MacroAssembler* masm) {
451 // ----------- S t a t e ------------- 455 // ----------- S t a t e -------------
452 // -- x2 : name
453 // -- lr : return address 456 // -- lr : return address
454 // -- x0 : receiver
455 // ----------------------------------- 457 // -----------------------------------
456 Isolate* isolate = masm->isolate(); 458 Isolate* isolate = masm->isolate();
457 ASM_LOCATION("LoadIC::GenerateMiss"); 459 ASM_LOCATION("LoadIC::GenerateMiss");
458 460
459 __ IncrementCounter(isolate->counters()->load_miss(), 1, x3, x4); 461 __ IncrementCounter(isolate->counters()->load_miss(), 1, x3, x4);
460 462
461 // Perform tail call to the entry. 463 // Perform tail call to the entry.
462 __ Push(x0, x2); 464 __ Push(ReceiverRegister(), NameRegister());
463 ExternalReference ref = 465 ExternalReference ref =
464 ExternalReference(IC_Utility(kLoadIC_Miss), isolate); 466 ExternalReference(IC_Utility(kLoadIC_Miss), isolate);
465 __ TailCallExternalReference(ref, 2, 1); 467 __ TailCallExternalReference(ref, 2, 1);
466 } 468 }
467 469
468 470
469 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { 471 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
470 // ---------- S t a t e -------------- 472 // ---------- S t a t e --------------
471 // -- x2 : name
472 // -- lr : return address 473 // -- lr : return address
473 // -- x0 : receiver
474 // ----------------------------------- 474 // -----------------------------------
475 475 __ Push(ReceiverRegister(), NameRegister());
476 __ Push(x0, x2);
477 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); 476 __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
478 } 477 }
479 478
480 479
481 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { 480 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) {
482 // ---------- S t a t e -------------- 481 // ---------- S t a t e --------------
483 // -- lr : return address 482 // -- lr : return address
484 // -- x0 : key 483 // -- x0 : key
485 // -- x1 : receiver 484 // -- x1 : receiver
486 // ----------------------------------- 485 // -----------------------------------
486 ASSERT(x1.is(ReceiverRegister()));
487 ASSERT(x0.is(NameRegister()));
487 Register result = x0; 488 Register result = x0;
488 Register key = x0; 489 Register key = x0;
489 Register receiver = x1; 490 Register receiver = x1;
490 Label miss, unmapped; 491 Label miss, unmapped;
491 492
492 Register map_scratch = x2; 493 Register map_scratch = x2;
493 MemOperand mapped_location = GenerateMappedArgumentsLookup( 494 MemOperand mapped_location = GenerateMappedArgumentsLookup(
494 masm, receiver, key, map_scratch, x3, x4, &unmapped, &miss); 495 masm, receiver, key, map_scratch, x3, x4, &unmapped, &miss);
495 __ Ldr(result, mapped_location); 496 __ Ldr(result, mapped_location);
496 __ Ret(); 497 __ Ret();
(...skipping 14 matching lines...) Expand all
511 512
512 513
513 void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { 514 void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) {
514 ASM_LOCATION("KeyedStoreIC::GenerateSloppyArguments"); 515 ASM_LOCATION("KeyedStoreIC::GenerateSloppyArguments");
515 // ---------- S t a t e -------------- 516 // ---------- S t a t e --------------
516 // -- lr : return address 517 // -- lr : return address
517 // -- x0 : value 518 // -- x0 : value
518 // -- x1 : key 519 // -- x1 : key
519 // -- x2 : receiver 520 // -- x2 : receiver
520 // ----------------------------------- 521 // -----------------------------------
521
522 Label slow, notin; 522 Label slow, notin;
523 523
524 Register value = x0; 524 Register value = x0;
525 Register key = x1; 525 Register key = x1;
526 Register receiver = x2; 526 Register receiver = x2;
527 Register map = x3; 527 Register map = x3;
528 528
529 // These registers are used by GenerateMappedArgumentsLookup to build a 529 // These registers are used by GenerateMappedArgumentsLookup to build a
530 // MemOperand. They are live for as long as the MemOperand is live. 530 // MemOperand. They are live for as long as the MemOperand is live.
531 Register mapped1 = x4; 531 Register mapped1 = x4;
(...skipping 26 matching lines...) Expand all
558 kLRHasNotBeenSaved, kDontSaveFPRegs); 558 kLRHasNotBeenSaved, kDontSaveFPRegs);
559 __ Ret(); 559 __ Ret();
560 __ Bind(&slow); 560 __ Bind(&slow);
561 GenerateMiss(masm); 561 GenerateMiss(masm);
562 } 562 }
563 563
564 564
565 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { 565 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
566 // ---------- S t a t e -------------- 566 // ---------- S t a t e --------------
567 // -- lr : return address 567 // -- lr : return address
568 // -- x0 : key
569 // -- x1 : receiver
570 // ----------------------------------- 568 // -----------------------------------
571 Isolate* isolate = masm->isolate(); 569 Isolate* isolate = masm->isolate();
572 570
573 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, x10, x11); 571 __ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, x10, x11);
574 572
575 __ Push(x1, x0); 573 __ Push(ReceiverRegister(), NameRegister());
576 574
577 // Perform tail call to the entry. 575 // Perform tail call to the entry.
578 ExternalReference ref = 576 ExternalReference ref =
579 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate); 577 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate);
580 578
581 __ TailCallExternalReference(ref, 2, 1); 579 __ TailCallExternalReference(ref, 2, 1);
582 } 580 }
583 581
584 582
585 // IC register specifications 583 // IC register specifications
586 const Register LoadIC::ReceiverRegister() { return x0; } 584 const Register LoadIC::ReceiverRegister() { return x0; }
587 const Register LoadIC::NameRegister() { return x2; } 585 const Register LoadIC::NameRegister() { return x2; }
588 const Register KeyedLoadIC::ReceiverRegister() { return x1; } 586 const Register KeyedLoadIC::ReceiverRegister() { return x1; }
589 const Register KeyedLoadIC::NameRegister() { return x0; } 587 const Register KeyedLoadIC::NameRegister() { return x0; }
590 588
591 589
592 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { 590 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
593 // ---------- S t a t e -------------- 591 // ---------- S t a t e --------------
594 // -- lr : return address 592 // -- lr : return address
595 // -- x0 : key
596 // -- x1 : receiver
597 // ----------------------------------- 593 // -----------------------------------
598 Register key = x0; 594 __ Push(ReceiverRegister(), NameRegister());
599 Register receiver = x1;
600
601 __ Push(receiver, key);
602 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); 595 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
603 } 596 }
604 597
605 598
606 static void GenerateKeyedLoadWithSmiKey(MacroAssembler* masm, 599 static void GenerateKeyedLoadWithSmiKey(MacroAssembler* masm,
607 Register key, 600 Register key,
608 Register receiver, 601 Register receiver,
609 Register scratch1, 602 Register scratch1,
610 Register scratch2, 603 Register scratch2,
611 Register scratch3, 604 Register scratch3,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 __ Ret(); 758 __ Ret();
766 } 759 }
767 760
768 761
769 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { 762 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
770 // ---------- S t a t e -------------- 763 // ---------- S t a t e --------------
771 // -- lr : return address 764 // -- lr : return address
772 // -- x0 : key 765 // -- x0 : key
773 // -- x1 : receiver 766 // -- x1 : receiver
774 // ----------------------------------- 767 // -----------------------------------
768 ASSERT(x1.is(ReceiverRegister()));
769 ASSERT(x0.is(NameRegister()));
775 Label slow, check_name, index_smi, index_name; 770 Label slow, check_name, index_smi, index_name;
776 771
777 Register key = x0; 772 Register key = x0;
778 Register receiver = x1; 773 Register receiver = x1;
779 774
780 __ JumpIfNotSmi(key, &check_name); 775 __ JumpIfNotSmi(key, &check_name);
781 __ Bind(&index_smi); 776 __ Bind(&index_smi);
782 // Now the key is known to be a smi. This place is also jumped to from below 777 // Now the key is known to be a smi. This place is also jumped to from below
783 // where a numeric string is converted to a smi. 778 // where a numeric string is converted to a smi.
784 GenerateKeyedLoadWithSmiKey(masm, key, receiver, x2, x3, x4, x5, x6, &slow); 779 GenerateKeyedLoadWithSmiKey(masm, key, receiver, x2, x3, x4, x5, x6, &slow);
(...skipping 15 matching lines...) Expand all
800 __ B(&index_smi); 795 __ B(&index_smi);
801 } 796 }
802 797
803 798
804 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { 799 void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
805 // ---------- S t a t e -------------- 800 // ---------- S t a t e --------------
806 // -- lr : return address 801 // -- lr : return address
807 // -- x0 : key (index) 802 // -- x0 : key (index)
808 // -- x1 : receiver 803 // -- x1 : receiver
809 // ----------------------------------- 804 // -----------------------------------
805 ASSERT(x1.is(ReceiverRegister()));
806 ASSERT(x0.is(NameRegister()));
810 Label miss; 807 Label miss;
811 808
812 Register index = x0; 809 Register index = x0;
813 Register receiver = x1; 810 Register receiver = x1;
814 Register result = x0; 811 Register result = x0;
815 Register scratch = x3; 812 Register scratch = x3;
816 813
817 StringCharAtGenerator char_at_generator(receiver, 814 StringCharAtGenerator char_at_generator(receiver,
818 index, 815 index,
819 scratch, 816 scratch,
(...skipping 12 matching lines...) Expand all
832 GenerateMiss(masm); 829 GenerateMiss(masm);
833 } 830 }
834 831
835 832
836 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { 833 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
837 // ---------- S t a t e -------------- 834 // ---------- S t a t e --------------
838 // -- lr : return address 835 // -- lr : return address
839 // -- x0 : key 836 // -- x0 : key
840 // -- x1 : receiver 837 // -- x1 : receiver
841 // ----------------------------------- 838 // -----------------------------------
839 ASSERT(x1.is(ReceiverRegister()));
840 ASSERT(x0.is(NameRegister()));
842 Label slow; 841 Label slow;
843 Register key = x0; 842 Register key = x0;
844 Register receiver = x1; 843 Register receiver = x1;
845 844
846 // Check that the receiver isn't a smi. 845 // Check that the receiver isn't a smi.
847 __ JumpIfSmi(receiver, &slow); 846 __ JumpIfSmi(receiver, &slow);
848 847
849 // Check that the key is an array index, that is Uint32. 848 // Check that the key is an array index, that is Uint32.
850 __ TestAndBranchIfAnySet(key, kSmiTagMask | kSmiSignMask, &slow); 849 __ TestAndBranchIfAnySet(key, kSmiTagMask | kSmiSignMask, &slow);
851 850
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 ASSERT(to_patch->Mask(TestBranchMask) == TBNZ); 1384 ASSERT(to_patch->Mask(TestBranchMask) == TBNZ);
1386 // This is JumpIfSmi(smi_reg, branch_imm). 1385 // This is JumpIfSmi(smi_reg, branch_imm).
1387 patcher.tbz(smi_reg, 0, branch_imm); 1386 patcher.tbz(smi_reg, 0, branch_imm);
1388 } 1387 }
1389 } 1388 }
1390 1389
1391 1390
1392 } } // namespace v8::internal 1391 } } // namespace v8::internal
1393 1392
1394 #endif // V8_TARGET_ARCH_ARM64 1393 #endif // V8_TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698