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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 Label* miss) { | 769 Label* miss) { |
770 // Check that the receiver isn't a smi. | 770 // Check that the receiver isn't a smi. |
771 __ test(receiver, Immediate(kSmiTagMask)); | 771 __ test(receiver, Immediate(kSmiTagMask)); |
772 __ j(zero, miss, not_taken); | 772 __ j(zero, miss, not_taken); |
773 | 773 |
774 // Check that the maps haven't changed. | 774 // Check that the maps haven't changed. |
775 Register reg = | 775 Register reg = |
776 CheckPrototypes(object, receiver, holder, | 776 CheckPrototypes(object, receiver, holder, |
777 scratch1, scratch2, name, miss); | 777 scratch1, scratch2, name, miss); |
778 | 778 |
779 // Push the arguments on the JS stack of the caller. | 779 Handle<AccessorInfo> callback_handle(callback); |
780 __ pop(scratch2); // remove return address | 780 |
| 781 Register other = reg.is(scratch1) ? scratch2 : scratch1; |
| 782 __ EnterInternalFrame(); |
| 783 __ PushHandleScope(other); |
| 784 // Push the stack address where the list of arguments ends |
| 785 __ mov(other, esp); |
| 786 __ sub(Operand(other), Immediate(2 * kPointerSize)); |
| 787 __ push(other); |
781 __ push(receiver); // receiver | 788 __ push(receiver); // receiver |
782 __ push(reg); // holder | 789 __ push(reg); // holder |
783 __ mov(reg, Immediate(Handle<AccessorInfo>(callback))); // callback data | 790 __ mov(other, Immediate(callback_handle)); |
784 __ push(reg); | 791 __ push(other); |
785 __ push(FieldOperand(reg, AccessorInfo::kDataOffset)); | 792 __ push(FieldOperand(other, AccessorInfo::kDataOffset)); // data |
786 __ push(name_reg); // name | 793 __ push(name_reg); // name |
787 __ push(scratch2); // restore return address | 794 // Save a pointer to where we pushed the arguments pointer. |
| 795 // This will be passed as the const Arguments& to the C++ callback. |
| 796 __ mov(eax, esp); |
| 797 __ add(Operand(eax), Immediate(5 * kPointerSize)); |
| 798 __ mov(ebx, esp); |
788 | 799 |
789 // Do tail-call to the runtime system. | 800 // Do call through the api. |
790 ExternalReference load_callback_property = | 801 ASSERT_EQ(6, ApiGetterEntryStub::kStackSpace); |
791 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); | 802 Address getter_address = v8::ToCData<Address>(callback->getter()); |
792 __ TailCallRuntime(load_callback_property, 5, 1); | 803 ApiFunction fun(getter_address); |
| 804 ApiGetterEntryStub stub(callback_handle, &fun); |
| 805 __ CallStub(&stub); |
| 806 |
| 807 Register tmp = other.is(eax) ? reg : other; |
| 808 __ PopHandleScope(tmp); |
| 809 __ LeaveInternalFrame(); |
| 810 |
| 811 __ ret(0); |
793 } | 812 } |
794 | 813 |
795 | 814 |
796 void StubCompiler::GenerateLoadConstant(JSObject* object, | 815 void StubCompiler::GenerateLoadConstant(JSObject* object, |
797 JSObject* holder, | 816 JSObject* holder, |
798 Register receiver, | 817 Register receiver, |
799 Register scratch1, | 818 Register scratch1, |
800 Register scratch2, | 819 Register scratch2, |
801 Object* value, | 820 Object* value, |
802 String* name, | 821 String* name, |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1867 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 1886 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
1868 | 1887 |
1869 // Return the generated code. | 1888 // Return the generated code. |
1870 return GetCode(); | 1889 return GetCode(); |
1871 } | 1890 } |
1872 | 1891 |
1873 | 1892 |
1874 #undef __ | 1893 #undef __ |
1875 | 1894 |
1876 } } // namespace v8::internal | 1895 } } // namespace v8::internal |
OLD | NEW |