| 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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 | 459 |
| 460 #define __ masm()-> | 460 #define __ masm()-> |
| 461 | 461 |
| 462 | 462 |
| 463 Object* StubCompiler::CompileLazyCompile(Code::Flags flags) { | 463 Object* StubCompiler::CompileLazyCompile(Code::Flags flags) { |
| 464 // ----------- S t a t e ------------- | 464 // ----------- S t a t e ------------- |
| 465 // -- r1: function | 465 // -- r1: function |
| 466 // -- lr: return address | 466 // -- lr: return address |
| 467 // ----------------------------------- | 467 // ----------------------------------- |
| 468 | 468 |
| 469 HandleScope scope; | |
| 470 | |
| 471 // Enter an internal frame. | 469 // Enter an internal frame. |
| 472 __ EnterInternalFrame(); | 470 __ EnterInternalFrame(); |
| 473 | 471 |
| 474 // Preserve the function. | 472 // Preserve the function. |
| 475 __ push(r1); | 473 __ push(r1); |
| 476 | 474 |
| 477 // Push the function on the stack as the argument to the runtime function. | 475 // Push the function on the stack as the argument to the runtime function. |
| 478 __ push(r1); | 476 __ push(r1); |
| 479 __ CallRuntime(Runtime::kLazyCompile, 1); | 477 __ CallRuntime(Runtime::kLazyCompile, 1); |
| 480 | 478 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 493 return GetCodeWithFlags(flags); | 491 return GetCodeWithFlags(flags); |
| 494 } | 492 } |
| 495 | 493 |
| 496 | 494 |
| 497 Object* CallStubCompiler::CompileCallField(Object* object, | 495 Object* CallStubCompiler::CompileCallField(Object* object, |
| 498 JSObject* holder, | 496 JSObject* holder, |
| 499 int index) { | 497 int index) { |
| 500 // ----------- S t a t e ------------- | 498 // ----------- S t a t e ------------- |
| 501 // -- lr: return address | 499 // -- lr: return address |
| 502 // ----------------------------------- | 500 // ----------------------------------- |
| 503 | |
| 504 HandleScope scope; | |
| 505 Label miss; | 501 Label miss; |
| 506 | 502 |
| 507 const int argc = arguments().immediate(); | 503 const int argc = arguments().immediate(); |
| 508 | 504 |
| 509 // Get the receiver of the function from the stack into r0. | 505 // Get the receiver of the function from the stack into r0. |
| 510 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); | 506 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); |
| 511 // Check that the receiver isn't a smi. | 507 // Check that the receiver isn't a smi. |
| 512 __ tst(r0, Operand(kSmiTagMask)); | 508 __ tst(r0, Operand(kSmiTagMask)); |
| 513 __ b(eq, &miss); | 509 __ b(eq, &miss); |
| 514 | 510 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 } | 542 } |
| 547 | 543 |
| 548 | 544 |
| 549 Object* CallStubCompiler::CompileCallConstant(Object* object, | 545 Object* CallStubCompiler::CompileCallConstant(Object* object, |
| 550 JSObject* holder, | 546 JSObject* holder, |
| 551 JSFunction* function, | 547 JSFunction* function, |
| 552 CheckType check) { | 548 CheckType check) { |
| 553 // ----------- S t a t e ------------- | 549 // ----------- S t a t e ------------- |
| 554 // -- lr: return address | 550 // -- lr: return address |
| 555 // ----------------------------------- | 551 // ----------------------------------- |
| 556 | |
| 557 HandleScope scope; | |
| 558 Label miss; | 552 Label miss; |
| 559 | 553 |
| 560 // Get the receiver from the stack | 554 // Get the receiver from the stack |
| 561 const int argc = arguments().immediate(); | 555 const int argc = arguments().immediate(); |
| 562 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); | 556 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
| 563 | 557 |
| 564 // Check that the receiver isn't a smi. | 558 // Check that the receiver isn't a smi. |
| 565 if (check != NUMBER_CHECK) { | 559 if (check != NUMBER_CHECK) { |
| 566 __ tst(r1, Operand(kSmiTagMask)); | 560 __ tst(r1, Operand(kSmiTagMask)); |
| 567 __ b(eq, &miss); | 561 __ b(eq, &miss); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 return GetCode(CONSTANT_FUNCTION); | 662 return GetCode(CONSTANT_FUNCTION); |
| 669 } | 663 } |
| 670 | 664 |
| 671 | 665 |
| 672 Object* CallStubCompiler::CompileCallInterceptor(Object* object, | 666 Object* CallStubCompiler::CompileCallInterceptor(Object* object, |
| 673 JSObject* holder, | 667 JSObject* holder, |
| 674 String* name) { | 668 String* name) { |
| 675 // ----------- S t a t e ------------- | 669 // ----------- S t a t e ------------- |
| 676 // -- lr: return address | 670 // -- lr: return address |
| 677 // ----------------------------------- | 671 // ----------------------------------- |
| 678 | |
| 679 HandleScope scope; | |
| 680 Label miss; | 672 Label miss; |
| 681 | 673 |
| 682 // TODO(1224669): Implement. | 674 // TODO(1224669): Implement. |
| 683 | 675 |
| 684 // Handle call cache miss. | 676 // Handle call cache miss. |
| 685 __ bind(&miss); | 677 __ bind(&miss); |
| 686 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 678 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 687 __ Jump(ic, RelocInfo::CODE_TARGET); | 679 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 688 | 680 |
| 689 // Return the generated code. | 681 // Return the generated code. |
| 690 return GetCode(INTERCEPTOR); | 682 return GetCode(INTERCEPTOR); |
| 691 } | 683 } |
| 692 | 684 |
| 693 | 685 |
| 694 Object* StoreStubCompiler::CompileStoreField(JSObject* object, | 686 Object* StoreStubCompiler::CompileStoreField(JSObject* object, |
| 695 int index, | 687 int index, |
| 696 Map* transition, | 688 Map* transition, |
| 697 String* name) { | 689 String* name) { |
| 698 // ----------- S t a t e ------------- | 690 // ----------- S t a t e ------------- |
| 699 // -- r0 : value | 691 // -- r0 : value |
| 700 // -- r2 : name | 692 // -- r2 : name |
| 701 // -- lr : return address | 693 // -- lr : return address |
| 702 // -- [sp] : receiver | 694 // -- [sp] : receiver |
| 703 // ----------------------------------- | 695 // ----------------------------------- |
| 704 | |
| 705 HandleScope scope; | |
| 706 Label miss; | 696 Label miss; |
| 707 | 697 |
| 708 // Get the receiver from the stack. | 698 // Get the receiver from the stack. |
| 709 __ ldr(r3, MemOperand(sp, 0 * kPointerSize)); | 699 __ ldr(r3, MemOperand(sp, 0 * kPointerSize)); |
| 710 | 700 |
| 711 // name register might be clobbered. | 701 // name register might be clobbered. |
| 712 GenerateStoreField(masm(), | 702 GenerateStoreField(masm(), |
| 713 Builtins::StoreIC_ExtendStorage, | 703 Builtins::StoreIC_ExtendStorage, |
| 714 object, | 704 object, |
| 715 index, | 705 index, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 728 | 718 |
| 729 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, | 719 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, |
| 730 AccessorInfo* callback, | 720 AccessorInfo* callback, |
| 731 String* name) { | 721 String* name) { |
| 732 // ----------- S t a t e ------------- | 722 // ----------- S t a t e ------------- |
| 733 // -- r0 : value | 723 // -- r0 : value |
| 734 // -- r2 : name | 724 // -- r2 : name |
| 735 // -- lr : return address | 725 // -- lr : return address |
| 736 // -- [sp] : receiver | 726 // -- [sp] : receiver |
| 737 // ----------------------------------- | 727 // ----------------------------------- |
| 738 | |
| 739 HandleScope scope; | |
| 740 Label miss; | 728 Label miss; |
| 741 | 729 |
| 742 // Get the object from the stack. | 730 // Get the object from the stack. |
| 743 __ ldr(r3, MemOperand(sp, 0 * kPointerSize)); | 731 __ ldr(r3, MemOperand(sp, 0 * kPointerSize)); |
| 744 | 732 |
| 745 // Check that the object isn't a smi. | 733 // Check that the object isn't a smi. |
| 746 __ tst(r3, Operand(kSmiTagMask)); | 734 __ tst(r3, Operand(kSmiTagMask)); |
| 747 __ b(eq, &miss); | 735 __ b(eq, &miss); |
| 748 | 736 |
| 749 // Check that the map of the object hasn't changed. | 737 // Check that the map of the object hasn't changed. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 | 772 |
| 785 | 773 |
| 786 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, | 774 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, |
| 787 String* name) { | 775 String* name) { |
| 788 // ----------- S t a t e ------------- | 776 // ----------- S t a t e ------------- |
| 789 // -- r0 : value | 777 // -- r0 : value |
| 790 // -- r2 : name | 778 // -- r2 : name |
| 791 // -- lr : return address | 779 // -- lr : return address |
| 792 // -- [sp] : receiver | 780 // -- [sp] : receiver |
| 793 // ----------------------------------- | 781 // ----------------------------------- |
| 794 | |
| 795 HandleScope scope; | |
| 796 Label miss; | 782 Label miss; |
| 797 | 783 |
| 798 // Get the object from the stack. | 784 // Get the object from the stack. |
| 799 __ ldr(r3, MemOperand(sp, 0 * kPointerSize)); | 785 __ ldr(r3, MemOperand(sp, 0 * kPointerSize)); |
| 800 | 786 |
| 801 // Check that the object isn't a smi. | 787 // Check that the object isn't a smi. |
| 802 __ tst(r3, Operand(kSmiTagMask)); | 788 __ tst(r3, Operand(kSmiTagMask)); |
| 803 __ b(eq, &miss); | 789 __ b(eq, &miss); |
| 804 | 790 |
| 805 // Check that the map of the object hasn't changed. | 791 // Check that the map of the object hasn't changed. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 | 824 |
| 839 | 825 |
| 840 Object* LoadStubCompiler::CompileLoadField(JSObject* object, | 826 Object* LoadStubCompiler::CompileLoadField(JSObject* object, |
| 841 JSObject* holder, | 827 JSObject* holder, |
| 842 int index) { | 828 int index) { |
| 843 // ----------- S t a t e ------------- | 829 // ----------- S t a t e ------------- |
| 844 // -- r2 : name | 830 // -- r2 : name |
| 845 // -- lr : return address | 831 // -- lr : return address |
| 846 // -- [sp] : receiver | 832 // -- [sp] : receiver |
| 847 // ----------------------------------- | 833 // ----------------------------------- |
| 848 | |
| 849 HandleScope scope; | |
| 850 Label miss; | 834 Label miss; |
| 851 | 835 |
| 852 __ ldr(r0, MemOperand(sp, 0)); | 836 __ ldr(r0, MemOperand(sp, 0)); |
| 853 | 837 |
| 854 GenerateLoadField(masm(), object, holder, r0, r3, r1, index, &miss); | 838 GenerateLoadField(masm(), object, holder, r0, r3, r1, index, &miss); |
| 855 __ bind(&miss); | 839 __ bind(&miss); |
| 856 GenerateLoadMiss(masm(), Code::LOAD_IC); | 840 GenerateLoadMiss(masm(), Code::LOAD_IC); |
| 857 | 841 |
| 858 // Return the generated code. | 842 // Return the generated code. |
| 859 return GetCode(FIELD); | 843 return GetCode(FIELD); |
| 860 } | 844 } |
| 861 | 845 |
| 862 | 846 |
| 863 Object* LoadStubCompiler::CompileLoadCallback(JSObject* object, | 847 Object* LoadStubCompiler::CompileLoadCallback(JSObject* object, |
| 864 JSObject* holder, | 848 JSObject* holder, |
| 865 AccessorInfo* callback) { | 849 AccessorInfo* callback) { |
| 866 // ----------- S t a t e ------------- | 850 // ----------- S t a t e ------------- |
| 867 // -- r2 : name | 851 // -- r2 : name |
| 868 // -- lr : return address | 852 // -- lr : return address |
| 869 // -- [sp] : receiver | 853 // -- [sp] : receiver |
| 870 // ----------------------------------- | 854 // ----------------------------------- |
| 871 | |
| 872 HandleScope scope; | |
| 873 Label miss; | 855 Label miss; |
| 874 | 856 |
| 875 __ ldr(r0, MemOperand(sp, 0)); | 857 __ ldr(r0, MemOperand(sp, 0)); |
| 876 GenerateLoadCallback(masm(), object, holder, r0, r2, r3, r1, callback, &miss); | 858 GenerateLoadCallback(masm(), object, holder, r0, r2, r3, r1, callback, &miss); |
| 877 __ bind(&miss); | 859 __ bind(&miss); |
| 878 GenerateLoadMiss(masm(), Code::LOAD_IC); | 860 GenerateLoadMiss(masm(), Code::LOAD_IC); |
| 879 | 861 |
| 880 // Return the generated code. | 862 // Return the generated code. |
| 881 return GetCode(CALLBACKS); | 863 return GetCode(CALLBACKS); |
| 882 } | 864 } |
| 883 | 865 |
| 884 | 866 |
| 885 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, | 867 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, |
| 886 JSObject* holder, | 868 JSObject* holder, |
| 887 Object* value) { | 869 Object* value) { |
| 888 // ----------- S t a t e ------------- | 870 // ----------- S t a t e ------------- |
| 889 // -- r2 : name | 871 // -- r2 : name |
| 890 // -- lr : return address | 872 // -- lr : return address |
| 891 // -- [sp] : receiver | 873 // -- [sp] : receiver |
| 892 // ----------------------------------- | 874 // ----------------------------------- |
| 893 | |
| 894 HandleScope scope; | |
| 895 Label miss; | 875 Label miss; |
| 896 | 876 |
| 897 __ ldr(r0, MemOperand(sp, 0)); | 877 __ ldr(r0, MemOperand(sp, 0)); |
| 898 | 878 |
| 899 GenerateLoadConstant(masm(), object, holder, r0, r3, r1, value, &miss); | 879 GenerateLoadConstant(masm(), object, holder, r0, r3, r1, value, &miss); |
| 900 __ bind(&miss); | 880 __ bind(&miss); |
| 901 GenerateLoadMiss(masm(), Code::LOAD_IC); | 881 GenerateLoadMiss(masm(), Code::LOAD_IC); |
| 902 | 882 |
| 903 // Return the generated code. | 883 // Return the generated code. |
| 904 return GetCode(CONSTANT_FUNCTION); | 884 return GetCode(CONSTANT_FUNCTION); |
| 905 } | 885 } |
| 906 | 886 |
| 907 | 887 |
| 908 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* object, | 888 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* object, |
| 909 JSObject* holder, | 889 JSObject* holder, |
| 910 String* name) { | 890 String* name) { |
| 911 // ----------- S t a t e ------------- | 891 // ----------- S t a t e ------------- |
| 912 // -- r2 : name | 892 // -- r2 : name |
| 913 // -- lr : return address | 893 // -- lr : return address |
| 914 // -- [sp] : receiver | 894 // -- [sp] : receiver |
| 915 // ----------------------------------- | 895 // ----------------------------------- |
| 916 | |
| 917 HandleScope scope; | |
| 918 Label miss; | 896 Label miss; |
| 919 | 897 |
| 920 __ ldr(r0, MemOperand(sp, 0)); | 898 __ ldr(r0, MemOperand(sp, 0)); |
| 921 | 899 |
| 922 GenerateLoadInterceptor(masm(), object, holder, r0, r2, r3, r1, &miss); | 900 GenerateLoadInterceptor(masm(), object, holder, r0, r2, r3, r1, &miss); |
| 923 __ bind(&miss); | 901 __ bind(&miss); |
| 924 GenerateLoadMiss(masm(), Code::LOAD_IC); | 902 GenerateLoadMiss(masm(), Code::LOAD_IC); |
| 925 | 903 |
| 926 // Return the generated code. | 904 // Return the generated code. |
| 927 return GetCode(INTERCEPTOR); | 905 return GetCode(INTERCEPTOR); |
| 928 } | 906 } |
| 929 | 907 |
| 930 | 908 |
| 931 // TODO(1224671): IC stubs for keyed loads have not been implemented | 909 // TODO(1224671): IC stubs for keyed loads have not been implemented |
| 932 // for ARM. | 910 // for ARM. |
| 933 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, | 911 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, |
| 934 JSObject* receiver, | 912 JSObject* receiver, |
| 935 JSObject* holder, | 913 JSObject* holder, |
| 936 int index) { | 914 int index) { |
| 937 // ----------- S t a t e ------------- | 915 // ----------- S t a t e ------------- |
| 938 // -- lr : return address | 916 // -- lr : return address |
| 939 // -- sp[0] : key | 917 // -- sp[0] : key |
| 940 // -- sp[4] : receiver | 918 // -- sp[4] : receiver |
| 941 // ----------------------------------- | 919 // ----------------------------------- |
| 942 HandleScope scope; | |
| 943 Label miss; | 920 Label miss; |
| 944 | 921 |
| 945 __ ldr(r2, MemOperand(sp, 0)); | 922 __ ldr(r2, MemOperand(sp, 0)); |
| 946 __ ldr(r0, MemOperand(sp, kPointerSize)); | 923 __ ldr(r0, MemOperand(sp, kPointerSize)); |
| 947 | 924 |
| 948 __ cmp(r2, Operand(Handle<String>(name))); | 925 __ cmp(r2, Operand(Handle<String>(name))); |
| 949 __ b(ne, &miss); | 926 __ b(ne, &miss); |
| 950 | 927 |
| 951 GenerateLoadField(masm(), receiver, holder, r0, r3, r1, index, &miss); | 928 GenerateLoadField(masm(), receiver, holder, r0, r3, r1, index, &miss); |
| 952 __ bind(&miss); | 929 __ bind(&miss); |
| 953 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 930 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 954 | 931 |
| 955 return GetCode(FIELD); | 932 return GetCode(FIELD); |
| 956 } | 933 } |
| 957 | 934 |
| 958 | 935 |
| 959 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, | 936 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, |
| 960 JSObject* receiver, | 937 JSObject* receiver, |
| 961 JSObject* holder, | 938 JSObject* holder, |
| 962 AccessorInfo* callback) { | 939 AccessorInfo* callback) { |
| 963 // ----------- S t a t e ------------- | 940 // ----------- S t a t e ------------- |
| 964 // -- lr : return address | 941 // -- lr : return address |
| 965 // -- sp[0] : key | 942 // -- sp[0] : key |
| 966 // -- sp[4] : receiver | 943 // -- sp[4] : receiver |
| 967 // ----------------------------------- | 944 // ----------------------------------- |
| 968 HandleScope scope; | |
| 969 Label miss; | 945 Label miss; |
| 970 | 946 |
| 971 __ ldr(r2, MemOperand(sp, 0)); | 947 __ ldr(r2, MemOperand(sp, 0)); |
| 972 __ ldr(r0, MemOperand(sp, kPointerSize)); | 948 __ ldr(r0, MemOperand(sp, kPointerSize)); |
| 973 | 949 |
| 974 __ cmp(r2, Operand(Handle<String>(name))); | 950 __ cmp(r2, Operand(Handle<String>(name))); |
| 975 __ b(ne, &miss); | 951 __ b(ne, &miss); |
| 976 | 952 |
| 977 GenerateLoadCallback(masm(), receiver, holder, r0, r2, r3, | 953 GenerateLoadCallback(masm(), receiver, holder, r0, r2, r3, |
| 978 r1, callback, &miss); | 954 r1, callback, &miss); |
| 979 __ bind(&miss); | 955 __ bind(&miss); |
| 980 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 956 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 981 | 957 |
| 982 return GetCode(CALLBACKS); | 958 return GetCode(CALLBACKS); |
| 983 } | 959 } |
| 984 | 960 |
| 985 | 961 |
| 986 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, | 962 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, |
| 987 JSObject* receiver, | 963 JSObject* receiver, |
| 988 JSObject* holder, | 964 JSObject* holder, |
| 989 Object* value) { | 965 Object* value) { |
| 990 // ----------- S t a t e ------------- | 966 // ----------- S t a t e ------------- |
| 991 // -- lr : return address | 967 // -- lr : return address |
| 992 // -- sp[0] : key | 968 // -- sp[0] : key |
| 993 // -- sp[4] : receiver | 969 // -- sp[4] : receiver |
| 994 // ----------------------------------- | 970 // ----------------------------------- |
| 995 HandleScope scope; | |
| 996 Label miss; | 971 Label miss; |
| 997 | 972 |
| 998 // Check the key is the cached one | 973 // Check the key is the cached one |
| 999 __ ldr(r2, MemOperand(sp, 0)); | 974 __ ldr(r2, MemOperand(sp, 0)); |
| 1000 __ ldr(r0, MemOperand(sp, kPointerSize)); | 975 __ ldr(r0, MemOperand(sp, kPointerSize)); |
| 1001 | 976 |
| 1002 __ cmp(r2, Operand(Handle<String>(name))); | 977 __ cmp(r2, Operand(Handle<String>(name))); |
| 1003 __ b(ne, &miss); | 978 __ b(ne, &miss); |
| 1004 | 979 |
| 1005 GenerateLoadConstant(masm(), receiver, holder, r0, r3, r1, value, &miss); | 980 GenerateLoadConstant(masm(), receiver, holder, r0, r3, r1, value, &miss); |
| 1006 __ bind(&miss); | 981 __ bind(&miss); |
| 1007 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 982 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1008 | 983 |
| 1009 // Return the generated code. | 984 // Return the generated code. |
| 1010 return GetCode(CONSTANT_FUNCTION); | 985 return GetCode(CONSTANT_FUNCTION); |
| 1011 } | 986 } |
| 1012 | 987 |
| 1013 | 988 |
| 1014 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, | 989 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, |
| 1015 JSObject* holder, | 990 JSObject* holder, |
| 1016 String* name) { | 991 String* name) { |
| 1017 // ----------- S t a t e ------------- | 992 // ----------- S t a t e ------------- |
| 1018 // -- lr : return address | 993 // -- lr : return address |
| 1019 // -- sp[0] : key | 994 // -- sp[0] : key |
| 1020 // -- sp[4] : receiver | 995 // -- sp[4] : receiver |
| 1021 // ----------------------------------- | 996 // ----------------------------------- |
| 1022 HandleScope scope; | |
| 1023 Label miss; | 997 Label miss; |
| 1024 | 998 |
| 1025 // Check the key is the cached one | 999 // Check the key is the cached one |
| 1026 __ ldr(r2, MemOperand(sp, 0)); | 1000 __ ldr(r2, MemOperand(sp, 0)); |
| 1027 __ ldr(r0, MemOperand(sp, kPointerSize)); | 1001 __ ldr(r0, MemOperand(sp, kPointerSize)); |
| 1028 | 1002 |
| 1029 __ cmp(r2, Operand(Handle<String>(name))); | 1003 __ cmp(r2, Operand(Handle<String>(name))); |
| 1030 __ b(ne, &miss); | 1004 __ b(ne, &miss); |
| 1031 | 1005 |
| 1032 GenerateLoadInterceptor(masm(), receiver, holder, r0, r2, r3, r1, &miss); | 1006 GenerateLoadInterceptor(masm(), receiver, holder, r0, r2, r3, r1, &miss); |
| 1033 __ bind(&miss); | 1007 __ bind(&miss); |
| 1034 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1008 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1035 | 1009 |
| 1036 return GetCode(INTERCEPTOR); | 1010 return GetCode(INTERCEPTOR); |
| 1037 } | 1011 } |
| 1038 | 1012 |
| 1039 | 1013 |
| 1040 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { | 1014 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { |
| 1041 // ----------- S t a t e ------------- | 1015 // ----------- S t a t e ------------- |
| 1042 // -- lr : return address | 1016 // -- lr : return address |
| 1043 // -- sp[0] : key | 1017 // -- sp[0] : key |
| 1044 // -- sp[4] : receiver | 1018 // -- sp[4] : receiver |
| 1045 // ----------------------------------- | 1019 // ----------------------------------- |
| 1046 HandleScope scope; | |
| 1047 Label miss; | 1020 Label miss; |
| 1048 | 1021 |
| 1049 // Check the key is the cached one | 1022 // Check the key is the cached one |
| 1050 __ ldr(r2, MemOperand(sp, 0)); | 1023 __ ldr(r2, MemOperand(sp, 0)); |
| 1051 __ ldr(r0, MemOperand(sp, kPointerSize)); | 1024 __ ldr(r0, MemOperand(sp, kPointerSize)); |
| 1052 | 1025 |
| 1053 __ cmp(r2, Operand(Handle<String>(name))); | 1026 __ cmp(r2, Operand(Handle<String>(name))); |
| 1054 __ b(ne, &miss); | 1027 __ b(ne, &miss); |
| 1055 | 1028 |
| 1056 GenerateLoadArrayLength(masm(), r0, r3, &miss); | 1029 GenerateLoadArrayLength(masm(), r0, r3, &miss); |
| 1057 __ bind(&miss); | 1030 __ bind(&miss); |
| 1058 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1031 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1059 | 1032 |
| 1060 return GetCode(CALLBACKS); | 1033 return GetCode(CALLBACKS); |
| 1061 } | 1034 } |
| 1062 | 1035 |
| 1063 | 1036 |
| 1064 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { | 1037 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { |
| 1065 // ----------- S t a t e ------------- | 1038 // ----------- S t a t e ------------- |
| 1066 // -- lr : return address | 1039 // -- lr : return address |
| 1067 // -- sp[0] : key | 1040 // -- sp[0] : key |
| 1068 // -- sp[4] : receiver | 1041 // -- sp[4] : receiver |
| 1069 // ----------------------------------- | 1042 // ----------------------------------- |
| 1070 HandleScope scope; | |
| 1071 | |
| 1072 Label miss; | 1043 Label miss; |
| 1073 __ IncrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); | 1044 __ IncrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); |
| 1074 | 1045 |
| 1075 __ ldr(r2, MemOperand(sp)); | 1046 __ ldr(r2, MemOperand(sp)); |
| 1076 __ ldr(r0, MemOperand(sp, kPointerSize)); // receiver | 1047 __ ldr(r0, MemOperand(sp, kPointerSize)); // receiver |
| 1077 | 1048 |
| 1078 __ cmp(r2, Operand(Handle<String>(name))); | 1049 __ cmp(r2, Operand(Handle<String>(name))); |
| 1079 __ b(ne, &miss); | 1050 __ b(ne, &miss); |
| 1080 | 1051 |
| 1081 GenerateLoadStringLength2(masm(), r0, r1, r3, &miss); | 1052 GenerateLoadStringLength2(masm(), r0, r1, r3, &miss); |
| 1082 __ bind(&miss); | 1053 __ bind(&miss); |
| 1083 __ DecrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); | 1054 __ DecrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); |
| 1084 | 1055 |
| 1085 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1056 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1086 | 1057 |
| 1087 return GetCode(CALLBACKS); | 1058 return GetCode(CALLBACKS); |
| 1088 } | 1059 } |
| 1089 | 1060 |
| 1090 | 1061 |
| 1091 // TODO(1224671): implement the fast case. | 1062 // TODO(1224671): implement the fast case. |
| 1092 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 1063 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { |
| 1093 // ----------- S t a t e ------------- | 1064 // ----------- S t a t e ------------- |
| 1094 // -- lr : return address | 1065 // -- lr : return address |
| 1095 // -- sp[0] : key | 1066 // -- sp[0] : key |
| 1096 // -- sp[4] : receiver | 1067 // -- sp[4] : receiver |
| 1097 // ----------------------------------- | 1068 // ----------------------------------- |
| 1098 HandleScope scope; | |
| 1099 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1069 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1100 | 1070 |
| 1101 return GetCode(CALLBACKS); | 1071 return GetCode(CALLBACKS); |
| 1102 } | 1072 } |
| 1103 | 1073 |
| 1104 | 1074 |
| 1105 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, | 1075 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, |
| 1106 int index, | 1076 int index, |
| 1107 Map* transition, | 1077 Map* transition, |
| 1108 String* name) { | 1078 String* name) { |
| 1109 // ----------- S t a t e ------------- | 1079 // ----------- S t a t e ------------- |
| 1110 // -- r0 : value | 1080 // -- r0 : value |
| 1111 // -- r2 : name | 1081 // -- r2 : name |
| 1112 // -- lr : return address | 1082 // -- lr : return address |
| 1113 // -- [sp] : receiver | 1083 // -- [sp] : receiver |
| 1114 // ----------------------------------- | 1084 // ----------------------------------- |
| 1115 HandleScope scope; | |
| 1116 Label miss; | 1085 Label miss; |
| 1117 | 1086 |
| 1118 __ IncrementCounter(&Counters::keyed_store_field, 1, r1, r3); | 1087 __ IncrementCounter(&Counters::keyed_store_field, 1, r1, r3); |
| 1119 | 1088 |
| 1120 // Check that the name has not changed. | 1089 // Check that the name has not changed. |
| 1121 __ cmp(r2, Operand(Handle<String>(name))); | 1090 __ cmp(r2, Operand(Handle<String>(name))); |
| 1122 __ b(ne, &miss); | 1091 __ b(ne, &miss); |
| 1123 | 1092 |
| 1124 // Load receiver from the stack. | 1093 // Load receiver from the stack. |
| 1125 __ ldr(r3, MemOperand(sp)); | 1094 __ ldr(r3, MemOperand(sp)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1139 __ Jump(ic, RelocInfo::CODE_TARGET); | 1108 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 1140 | 1109 |
| 1141 // Return the generated code. | 1110 // Return the generated code. |
| 1142 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION); | 1111 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION); |
| 1143 } | 1112 } |
| 1144 | 1113 |
| 1145 | 1114 |
| 1146 #undef __ | 1115 #undef __ |
| 1147 | 1116 |
| 1148 } } // namespace v8::internal | 1117 } } // namespace v8::internal |
| OLD | NEW |