| 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 // This will be passed as the const Arguments& to the C++ callback. | 795 // This will be passed as the const Arguments& to the C++ callback. |
| 796 __ mov(eax, esp); | 796 __ mov(eax, esp); |
| 797 __ add(Operand(eax), Immediate(5 * kPointerSize)); | 797 __ add(Operand(eax), Immediate(5 * kPointerSize)); |
| 798 __ mov(ebx, esp); | 798 __ mov(ebx, esp); |
| 799 | 799 |
| 800 // Do call through the api. | 800 // Do call through the api. |
| 801 ASSERT_EQ(6, ApiGetterEntryStub::kStackSpace); | 801 ASSERT_EQ(6, ApiGetterEntryStub::kStackSpace); |
| 802 Address getter_address = v8::ToCData<Address>(callback->getter()); | 802 Address getter_address = v8::ToCData<Address>(callback->getter()); |
| 803 ApiFunction fun(getter_address); | 803 ApiFunction fun(getter_address); |
| 804 ApiGetterEntryStub stub(callback_handle, &fun); | 804 ApiGetterEntryStub stub(callback_handle, &fun); |
| 805 // Calling the stub may try to allocate (if the code is not already | 805 // Emitting a stub call may try to allocate (if the code is not |
| 806 // generated). Do not allow the call to perform a garbage | 806 // already generated). Do not allow the assembler to perform a |
| 807 // collection but instead return the allocation failure object. | 807 // garbage collection but instead return the allocation failure |
| 808 // object. |
| 808 Object* result = masm()->TryCallStub(&stub); | 809 Object* result = masm()->TryCallStub(&stub); |
| 809 if (result->IsFailure()) { | 810 if (result->IsFailure()) { |
| 810 *failure = Failure::cast(result); | 811 *failure = Failure::cast(result); |
| 811 return false; | 812 return false; |
| 812 } | 813 } |
| 813 | 814 |
| 814 // We need to avoid using eax since that now holds the result. | 815 // We need to avoid using eax since that now holds the result. |
| 815 Register tmp = other.is(eax) ? reg : other; | 816 Register tmp = other.is(eax) ? reg : other; |
| 816 __ PopHandleScope(eax, tmp); | 817 // Emitting PopHandleScope may try to allocate. Do not allow the |
| 818 // assembler to perform a garbage collection but instead return a |
| 819 // failure object. |
| 820 result = masm()->TryPopHandleScope(eax, tmp); |
| 821 if (result->IsFailure()) { |
| 822 *failure = Failure::cast(result); |
| 823 return false; |
| 824 } |
| 817 __ LeaveInternalFrame(); | 825 __ LeaveInternalFrame(); |
| 818 | 826 |
| 819 __ ret(0); | 827 __ ret(0); |
| 820 return true; | 828 return true; |
| 821 } | 829 } |
| 822 | 830 |
| 823 | 831 |
| 824 void StubCompiler::GenerateLoadConstant(JSObject* object, | 832 void StubCompiler::GenerateLoadConstant(JSObject* object, |
| 825 JSObject* holder, | 833 JSObject* holder, |
| 826 Register receiver, | 834 Register receiver, |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1938 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 1946 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 1939 | 1947 |
| 1940 // Return the generated code. | 1948 // Return the generated code. |
| 1941 return GetCode(); | 1949 return GetCode(); |
| 1942 } | 1950 } |
| 1943 | 1951 |
| 1944 | 1952 |
| 1945 #undef __ | 1953 #undef __ |
| 1946 | 1954 |
| 1947 } } // namespace v8::internal | 1955 } } // namespace v8::internal |
| OLD | NEW |