| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 // Handle call cache miss. | 808 // Handle call cache miss. |
| 809 __ bind(&miss); | 809 __ bind(&miss); |
| 810 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 810 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 811 __ Jump(ic, RelocInfo::CODE_TARGET); | 811 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 812 | 812 |
| 813 // Return the generated code. | 813 // Return the generated code. |
| 814 return GetCode(FIELD, name); | 814 return GetCode(FIELD, name); |
| 815 } | 815 } |
| 816 | 816 |
| 817 | 817 |
| 818 Object* CallStubCompiler::CompileArrayPushCall(Object* object, |
| 819 JSObject* holder, |
| 820 JSFunction* function, |
| 821 String* name, |
| 822 CheckType check) { |
| 823 // ----------- S t a t e ------------- |
| 824 // -- r2 : name |
| 825 // -- lr : return address |
| 826 // ----------------------------------- |
| 827 |
| 828 // TODO(639): faster implementation. |
| 829 ASSERT(check == RECEIVER_MAP_CHECK); |
| 830 |
| 831 Label miss; |
| 832 |
| 833 // Get the receiver from the stack |
| 834 const int argc = arguments().immediate(); |
| 835 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
| 836 |
| 837 // Check that the receiver isn't a smi. |
| 838 __ tst(r1, Operand(kSmiTagMask)); |
| 839 __ b(eq, &miss); |
| 840 |
| 841 // Check that the maps haven't changed. |
| 842 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, name, &miss); |
| 843 |
| 844 if (object->IsGlobalObject()) { |
| 845 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); |
| 846 __ str(r3, MemOperand(sp, argc * kPointerSize)); |
| 847 } |
| 848 |
| 849 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), |
| 850 argc + 1, |
| 851 1); |
| 852 |
| 853 // Handle call cache miss. |
| 854 __ bind(&miss); |
| 855 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 856 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 857 |
| 858 // Return the generated code. |
| 859 String* function_name = NULL; |
| 860 if (function->shared()->name()->IsString()) { |
| 861 function_name = String::cast(function->shared()->name()); |
| 862 } |
| 863 return GetCode(CONSTANT_FUNCTION, function_name); |
| 864 } |
| 865 |
| 866 |
| 867 Object* CallStubCompiler::CompileArrayPopCall(Object* object, |
| 868 JSObject* holder, |
| 869 JSFunction* function, |
| 870 String* name, |
| 871 CheckType check) { |
| 872 // ----------- S t a t e ------------- |
| 873 // -- r2 : name |
| 874 // -- lr : return address |
| 875 // ----------------------------------- |
| 876 |
| 877 // TODO(642): faster implementation. |
| 878 ASSERT(check == RECEIVER_MAP_CHECK); |
| 879 |
| 880 Label miss; |
| 881 |
| 882 // Get the receiver from the stack |
| 883 const int argc = arguments().immediate(); |
| 884 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
| 885 |
| 886 // Check that the receiver isn't a smi. |
| 887 __ tst(r1, Operand(kSmiTagMask)); |
| 888 __ b(eq, &miss); |
| 889 |
| 890 // Check that the maps haven't changed. |
| 891 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, name, &miss); |
| 892 |
| 893 if (object->IsGlobalObject()) { |
| 894 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); |
| 895 __ str(r3, MemOperand(sp, argc * kPointerSize)); |
| 896 } |
| 897 |
| 898 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), |
| 899 argc + 1, |
| 900 1); |
| 901 |
| 902 // Handle call cache miss. |
| 903 __ bind(&miss); |
| 904 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 905 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 906 |
| 907 // Return the generated code. |
| 908 String* function_name = NULL; |
| 909 if (function->shared()->name()->IsString()) { |
| 910 function_name = String::cast(function->shared()->name()); |
| 911 } |
| 912 return GetCode(CONSTANT_FUNCTION, function_name); |
| 913 } |
| 914 |
| 915 |
| 818 Object* CallStubCompiler::CompileCallConstant(Object* object, | 916 Object* CallStubCompiler::CompileCallConstant(Object* object, |
| 819 JSObject* holder, | 917 JSObject* holder, |
| 820 JSFunction* function, | 918 JSFunction* function, |
| 821 String* name, | 919 String* name, |
| 822 CheckType check) { | 920 CheckType check) { |
| 823 // ----------- S t a t e ------------- | 921 // ----------- S t a t e ------------- |
| 824 // -- r2 : name | 922 // -- r2 : name |
| 825 // -- lr : return address | 923 // -- lr : return address |
| 826 // ----------------------------------- | 924 // ----------------------------------- |
| 925 SharedFunctionInfo* function_info = function->shared(); |
| 926 if (false && function_info->HasCustomCallGenerator()) { |
| 927 CustomCallGenerator generator = |
| 928 ToCData<CustomCallGenerator>(function_info->function_data()); |
| 929 return generator(this, object, holder, function, name, check); |
| 930 } |
| 931 |
| 827 Label miss; | 932 Label miss; |
| 828 | 933 |
| 829 // Get the receiver from the stack | 934 // Get the receiver from the stack |
| 830 const int argc = arguments().immediate(); | 935 const int argc = arguments().immediate(); |
| 831 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); | 936 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
| 832 | 937 |
| 833 // Check that the receiver isn't a smi. | 938 // Check that the receiver isn't a smi. |
| 834 if (check != NUMBER_CHECK) { | 939 if (check != NUMBER_CHECK) { |
| 835 __ tst(r1, Operand(kSmiTagMask)); | 940 __ tst(r1, Operand(kSmiTagMask)); |
| 836 __ b(eq, &miss); | 941 __ b(eq, &miss); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 // Check that the maps starting from the prototype haven't changed. | 1014 // Check that the maps starting from the prototype haven't changed. |
| 910 GenerateLoadGlobalFunctionPrototype(masm(), | 1015 GenerateLoadGlobalFunctionPrototype(masm(), |
| 911 Context::BOOLEAN_FUNCTION_INDEX, | 1016 Context::BOOLEAN_FUNCTION_INDEX, |
| 912 r0); | 1017 r0); |
| 913 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, | 1018 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, |
| 914 r1, name, &miss); | 1019 r1, name, &miss); |
| 915 } | 1020 } |
| 916 break; | 1021 break; |
| 917 } | 1022 } |
| 918 | 1023 |
| 919 case JSARRAY_HAS_FAST_ELEMENTS_CHECK: | |
| 920 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, name, &miss); | |
| 921 // Make sure object->HasFastElements(). | |
| 922 // Get the elements array of the object. | |
| 923 __ ldr(r3, FieldMemOperand(r1, JSObject::kElementsOffset)); | |
| 924 // Check that the object is in fast mode (not dictionary). | |
| 925 __ ldr(r0, FieldMemOperand(r3, HeapObject::kMapOffset)); | |
| 926 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | |
| 927 __ cmp(r0, ip); | |
| 928 __ b(ne, &miss); | |
| 929 break; | |
| 930 | |
| 931 default: | 1024 default: |
| 932 UNREACHABLE(); | 1025 UNREACHABLE(); |
| 933 } | 1026 } |
| 934 | 1027 |
| 935 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 1028 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
| 936 | 1029 |
| 937 // Handle call cache miss. | 1030 // Handle call cache miss. |
| 938 __ bind(&miss); | 1031 __ bind(&miss); |
| 939 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 1032 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 940 __ Jump(ic, RelocInfo::CODE_TARGET); | 1033 __ Jump(ic, RelocInfo::CODE_TARGET); |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1801 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1894 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 1802 | 1895 |
| 1803 // Return the generated code. | 1896 // Return the generated code. |
| 1804 return GetCode(); | 1897 return GetCode(); |
| 1805 } | 1898 } |
| 1806 | 1899 |
| 1807 | 1900 |
| 1808 #undef __ | 1901 #undef __ |
| 1809 | 1902 |
| 1810 } } // namespace v8::internal | 1903 } } // namespace v8::internal |
| OLD | NEW |