OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 // ----------------------------------- | 431 // ----------------------------------- |
432 | 432 |
433 __ ldr(r0, MemOperand(sp, 0)); | 433 __ ldr(r0, MemOperand(sp, 0)); |
434 // Probe the stub cache. | 434 // Probe the stub cache. |
435 Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, | 435 Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, |
436 NOT_IN_LOOP, | 436 NOT_IN_LOOP, |
437 MONOMORPHIC); | 437 MONOMORPHIC); |
438 StubCache::GenerateProbe(masm, flags, r0, r2, r3, no_reg); | 438 StubCache::GenerateProbe(masm, flags, r0, r2, r3, no_reg); |
439 | 439 |
440 // Cache miss: Jump to runtime. | 440 // Cache miss: Jump to runtime. |
441 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); | 441 GenerateMiss(masm); |
442 } | 442 } |
443 | 443 |
444 | 444 |
445 void LoadIC::GenerateNormal(MacroAssembler* masm) { | 445 void LoadIC::GenerateNormal(MacroAssembler* masm) { |
446 // ----------- S t a t e ------------- | 446 // ----------- S t a t e ------------- |
447 // -- r2 : name | 447 // -- r2 : name |
448 // -- lr : return address | 448 // -- lr : return address |
449 // -- [sp] : receiver | 449 // -- [sp] : receiver |
450 // ----------------------------------- | 450 // ----------------------------------- |
451 Label miss, probe, global; | 451 Label miss, probe, global; |
(...skipping 23 matching lines...) Expand all Loading... |
475 GenerateCheckNonObjectOrLoaded(masm, &miss, r0, r1); | 475 GenerateCheckNonObjectOrLoaded(masm, &miss, r0, r1); |
476 __ Ret(); | 476 __ Ret(); |
477 | 477 |
478 // Global object access: Check access rights. | 478 // Global object access: Check access rights. |
479 __ bind(&global); | 479 __ bind(&global); |
480 __ CheckAccessGlobalProxy(r0, r1, &miss); | 480 __ CheckAccessGlobalProxy(r0, r1, &miss); |
481 __ b(&probe); | 481 __ b(&probe); |
482 | 482 |
483 // Cache miss: Restore receiver from stack and jump to runtime. | 483 // Cache miss: Restore receiver from stack and jump to runtime. |
484 __ bind(&miss); | 484 __ bind(&miss); |
485 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); | 485 GenerateMiss(masm); |
486 } | 486 } |
487 | 487 |
488 | 488 |
489 void LoadIC::GenerateMiss(MacroAssembler* masm) { | 489 void LoadIC::GenerateMiss(MacroAssembler* masm) { |
490 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); | |
491 } | |
492 | |
493 | |
494 void LoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { | |
495 // ----------- S t a t e ------------- | 490 // ----------- S t a t e ------------- |
496 // -- r2 : name | 491 // -- r2 : name |
497 // -- lr : return address | 492 // -- lr : return address |
498 // -- [sp] : receiver | 493 // -- [sp] : receiver |
499 // ----------------------------------- | 494 // ----------------------------------- |
500 | 495 |
501 __ ldr(r3, MemOperand(sp, 0)); | 496 __ ldr(r3, MemOperand(sp, 0)); |
502 __ stm(db_w, sp, r2.bit() | r3.bit()); | 497 __ stm(db_w, sp, r2.bit() | r3.bit()); |
503 | 498 |
504 // Perform tail call to the entry. | 499 // Perform tail call to the entry. |
505 __ TailCallRuntime(f, 2, 1); | 500 __ TailCallRuntime(ExternalReference(IC_Utility(kLoadIC_Miss)), 2, 1); |
506 } | 501 } |
507 | 502 |
508 | 503 |
509 // TODO(181): Implement map patching once loop nesting is tracked on the | 504 // TODO(181): Implement map patching once loop nesting is tracked on the |
510 // ARM platform so we can generate inlined fast-case code loads in | 505 // ARM platform so we can generate inlined fast-case code loads in |
511 // loops. | 506 // loops. |
512 void LoadIC::ClearInlinedVersion(Address address) {} | 507 void LoadIC::ClearInlinedVersion(Address address) {} |
513 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { | 508 bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { |
514 return false; | 509 return false; |
515 } | 510 } |
516 | 511 |
517 void KeyedLoadIC::ClearInlinedVersion(Address address) {} | 512 void KeyedLoadIC::ClearInlinedVersion(Address address) {} |
518 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) { | 513 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) { |
519 return false; | 514 return false; |
520 } | 515 } |
521 | 516 |
522 void KeyedStoreIC::ClearInlinedVersion(Address address) {} | 517 void KeyedStoreIC::ClearInlinedVersion(Address address) {} |
523 void KeyedStoreIC::RestoreInlinedVersion(Address address) {} | 518 void KeyedStoreIC::RestoreInlinedVersion(Address address) {} |
524 bool KeyedStoreIC::PatchInlinedStore(Address address, Object* map) { | 519 bool KeyedStoreIC::PatchInlinedStore(Address address, Object* map) { |
525 return false; | 520 return false; |
526 } | 521 } |
527 | 522 |
528 | 523 |
529 Object* KeyedLoadIC_Miss(Arguments args); | 524 Object* KeyedLoadIC_Miss(Arguments args); |
530 | 525 |
531 | 526 |
532 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 527 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
533 Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss))); | 528 // ---------- S t a t e -------------- |
| 529 // -- lr : return address |
| 530 // -- sp[0] : key |
| 531 // -- sp[4] : receiver |
| 532 // ----------------------------------- |
| 533 |
| 534 __ ldm(ia, sp, r2.bit() | r3.bit()); |
| 535 __ stm(db_w, sp, r2.bit() | r3.bit()); |
| 536 |
| 537 __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedLoadIC_Miss)), 2, 1); |
534 } | 538 } |
535 | 539 |
536 | 540 |
537 void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { | 541 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
538 // ---------- S t a t e -------------- | 542 // ---------- S t a t e -------------- |
539 // -- lr : return address | 543 // -- lr : return address |
540 // -- sp[0] : key | 544 // -- sp[0] : key |
541 // -- sp[4] : receiver | 545 // -- sp[4] : receiver |
542 // ----------------------------------- | 546 // ----------------------------------- |
543 | 547 |
544 __ ldm(ia, sp, r2.bit() | r3.bit()); | 548 __ ldm(ia, sp, r2.bit() | r3.bit()); |
545 __ stm(db_w, sp, r2.bit() | r3.bit()); | 549 __ stm(db_w, sp, r2.bit() | r3.bit()); |
546 | 550 |
547 __ TailCallRuntime(f, 2, 1); | 551 __ TailCallRuntime(ExternalReference(Runtime::kGetProperty), 2, 1); |
548 } | 552 } |
549 | 553 |
550 | 554 |
551 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { | 555 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
552 // ---------- S t a t e -------------- | 556 // ---------- S t a t e -------------- |
553 // -- lr : return address | 557 // -- lr : return address |
554 // -- sp[0] : key | 558 // -- sp[0] : key |
555 // -- sp[4] : receiver | 559 // -- sp[4] : receiver |
556 // ----------------------------------- | 560 // ----------------------------------- |
557 Label slow, fast; | 561 Label slow, fast; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 __ cmp(r3, ip); | 594 __ cmp(r3, ip); |
591 __ b(ne, &slow); | 595 __ b(ne, &slow); |
592 // Check that the key (index) is within bounds. | 596 // Check that the key (index) is within bounds. |
593 __ ldr(r3, FieldMemOperand(r1, Array::kLengthOffset)); | 597 __ ldr(r3, FieldMemOperand(r1, Array::kLengthOffset)); |
594 __ cmp(r0, Operand(r3)); | 598 __ cmp(r0, Operand(r3)); |
595 __ b(lo, &fast); | 599 __ b(lo, &fast); |
596 | 600 |
597 // Slow case: Push extra copies of the arguments (2). | 601 // Slow case: Push extra copies of the arguments (2). |
598 __ bind(&slow); | 602 __ bind(&slow); |
599 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1, r0, r1); | 603 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1, r0, r1); |
600 __ ldm(ia, sp, r0.bit() | r1.bit()); | 604 GenerateRuntimeGetProperty(masm); |
601 __ stm(db_w, sp, r0.bit() | r1.bit()); | |
602 // Do tail-call to runtime routine. | |
603 __ TailCallRuntime(ExternalReference(Runtime::kGetProperty), 2, 1); | |
604 | 605 |
605 // Fast case: Do the load. | 606 // Fast case: Do the load. |
606 __ bind(&fast); | 607 __ bind(&fast); |
607 __ add(r3, r1, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 608 __ add(r3, r1, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
608 __ ldr(r0, MemOperand(r3, r0, LSL, kPointerSizeLog2)); | 609 __ ldr(r0, MemOperand(r3, r0, LSL, kPointerSizeLog2)); |
609 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 610 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
610 __ cmp(r0, ip); | 611 __ cmp(r0, ip); |
611 // In case the loaded value is the_hole we have to consult GetProperty | 612 // In case the loaded value is the_hole we have to consult GetProperty |
612 // to ensure the prototype chain is searched. | 613 // to ensure the prototype chain is searched. |
613 __ b(eq, &slow); | 614 __ b(eq, &slow); |
(...skipping 13 matching lines...) Expand all Loading... |
627 } | 628 } |
628 | 629 |
629 | 630 |
630 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, | 631 void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
631 ExternalArrayType array_type) { | 632 ExternalArrayType array_type) { |
632 // TODO(476): port specialized code. | 633 // TODO(476): port specialized code. |
633 GenerateGeneric(masm); | 634 GenerateGeneric(masm); |
634 } | 635 } |
635 | 636 |
636 | 637 |
637 void KeyedStoreIC::Generate(MacroAssembler* masm, | 638 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { |
638 const ExternalReference& f) { | |
639 // ---------- S t a t e -------------- | 639 // ---------- S t a t e -------------- |
640 // -- r0 : value | 640 // -- r0 : value |
641 // -- lr : return address | 641 // -- lr : return address |
642 // -- sp[0] : key | 642 // -- sp[0] : key |
643 // -- sp[1] : receiver | 643 // -- sp[1] : receiver |
644 // ----------------------------------- | 644 // ----------------------------------- |
645 | 645 |
646 __ ldm(ia, sp, r2.bit() | r3.bit()); | 646 __ ldm(ia, sp, r2.bit() | r3.bit()); |
647 __ stm(db_w, sp, r0.bit() | r2.bit() | r3.bit()); | 647 __ stm(db_w, sp, r0.bit() | r2.bit() | r3.bit()); |
648 | 648 |
649 __ TailCallRuntime(f, 3, 1); | 649 __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedStoreIC_Miss)), 3, 1); |
| 650 } |
| 651 |
| 652 |
| 653 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) { |
| 654 // ---------- S t a t e -------------- |
| 655 // -- r0 : value |
| 656 // -- lr : return address |
| 657 // -- sp[0] : key |
| 658 // -- sp[1] : receiver |
| 659 // ----------------------------------- |
| 660 __ ldm(ia, sp, r1.bit() | r3.bit()); // r0 == value, r1 == key, r3 == object |
| 661 __ stm(db_w, sp, r0.bit() | r1.bit() | r3.bit()); |
| 662 |
| 663 __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1); |
650 } | 664 } |
651 | 665 |
652 | 666 |
653 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { | 667 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { |
654 // ---------- S t a t e -------------- | 668 // ---------- S t a t e -------------- |
655 // -- r0 : value | 669 // -- r0 : value |
656 // -- lr : return address | 670 // -- lr : return address |
657 // -- sp[0] : key | 671 // -- sp[0] : key |
658 // -- sp[1] : receiver | 672 // -- sp[1] : receiver |
659 // ----------------------------------- | 673 // ----------------------------------- |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 // Untag the key (for checking against untagged length in the fixed array). | 708 // Untag the key (for checking against untagged length in the fixed array). |
695 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); | 709 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); |
696 // Compute address to store into and check array bounds. | 710 // Compute address to store into and check array bounds. |
697 __ add(r2, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 711 __ add(r2, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
698 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); | 712 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); |
699 __ ldr(ip, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 713 __ ldr(ip, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
700 __ cmp(r1, Operand(ip)); | 714 __ cmp(r1, Operand(ip)); |
701 __ b(lo, &fast); | 715 __ b(lo, &fast); |
702 | 716 |
703 | 717 |
704 // Slow case: Push extra copies of the arguments (3). | 718 // Slow case: |
705 __ bind(&slow); | 719 __ bind(&slow); |
706 __ ldm(ia, sp, r1.bit() | r3.bit()); // r0 == value, r1 == key, r3 == object | 720 GenerateRuntimeSetProperty(masm); |
707 __ stm(db_w, sp, r0.bit() | r1.bit() | r3.bit()); | |
708 // Do tail-call to runtime routine. | |
709 __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1); | |
710 | 721 |
711 // Extra capacity case: Check if there is extra capacity to | 722 // Extra capacity case: Check if there is extra capacity to |
712 // perform the store and update the length. Used for adding one | 723 // perform the store and update the length. Used for adding one |
713 // element to the array by writing to array[array.length]. | 724 // element to the array by writing to array[array.length]. |
714 // r0 == value, r1 == key, r2 == elements, r3 == object | 725 // r0 == value, r1 == key, r2 == elements, r3 == object |
715 __ bind(&extra); | 726 __ bind(&extra); |
716 __ b(ne, &slow); // do not leave holes in the array | 727 __ b(ne, &slow); // do not leave holes in the array |
717 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); // untag | 728 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); // untag |
718 __ ldr(ip, FieldMemOperand(r2, Array::kLengthOffset)); | 729 __ ldr(ip, FieldMemOperand(r2, Array::kLengthOffset)); |
719 __ cmp(r1, Operand(ip)); | 730 __ cmp(r1, Operand(ip)); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 | 855 |
845 // Perform tail call to the entry. | 856 // Perform tail call to the entry. |
846 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); | 857 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); |
847 } | 858 } |
848 | 859 |
849 | 860 |
850 #undef __ | 861 #undef __ |
851 | 862 |
852 | 863 |
853 } } // namespace v8::internal | 864 } } // namespace v8::internal |
OLD | NEW |