| 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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 AccessorInfo* callback, | 1026 AccessorInfo* callback, |
| 1027 String* name, | 1027 String* name, |
| 1028 Label* miss, | 1028 Label* miss, |
| 1029 Failure** failure) { | 1029 Failure** failure) { |
| 1030 // Check that the receiver isn't a smi. | 1030 // Check that the receiver isn't a smi. |
| 1031 __ test(receiver, Immediate(kSmiTagMask)); | 1031 __ test(receiver, Immediate(kSmiTagMask)); |
| 1032 __ j(zero, miss, not_taken); | 1032 __ j(zero, miss, not_taken); |
| 1033 | 1033 |
| 1034 // Check that the maps haven't changed. | 1034 // Check that the maps haven't changed. |
| 1035 Register reg = | 1035 Register reg = |
| 1036 CheckPrototypes(object, receiver, holder, | 1036 CheckPrototypes(object, receiver, holder, scratch1, |
| 1037 scratch1, scratch2, scratch3, name, miss); | 1037 scratch2, scratch3, name, miss); |
| 1038 | 1038 |
| 1039 Handle<AccessorInfo> callback_handle(callback); | 1039 Handle<AccessorInfo> callback_handle(callback); |
| 1040 | 1040 |
| 1041 Register other = reg.is(scratch1) ? scratch2 : scratch1; | |
| 1042 __ EnterInternalFrame(); | 1041 __ EnterInternalFrame(); |
| 1043 __ PushHandleScope(other); | 1042 __ PushHandleScope(scratch2); |
| 1044 // Push the stack address where the list of arguments ends | 1043 // Push the stack address where the list of arguments ends. |
| 1045 __ mov(other, esp); | 1044 __ mov(scratch2, esp); |
| 1046 __ sub(Operand(other), Immediate(2 * kPointerSize)); | 1045 __ sub(Operand(scratch2), Immediate(2 * kPointerSize)); |
| 1047 __ push(other); | 1046 __ push(scratch2); |
| 1048 __ push(receiver); // receiver | 1047 __ push(receiver); // receiver |
| 1049 __ push(reg); // holder | 1048 __ push(reg); // holder |
| 1050 // Push data from AccessorInfo. | 1049 // Push data from AccessorInfo. |
| 1051 if (Heap::InNewSpace(callback_handle->data())) { | 1050 if (Heap::InNewSpace(callback_handle->data())) { |
| 1052 __ mov(other, Immediate(callback_handle)); | 1051 __ mov(scratch2, Immediate(callback_handle)); |
| 1053 __ push(FieldOperand(other, AccessorInfo::kDataOffset)); | 1052 __ push(FieldOperand(scratch2, AccessorInfo::kDataOffset)); |
| 1054 } else { | 1053 } else { |
| 1055 __ push(Immediate(Handle<Object>(callback_handle->data()))); | 1054 __ push(Immediate(Handle<Object>(callback_handle->data()))); |
| 1056 } | 1055 } |
| 1057 __ push(name_reg); // name | 1056 __ push(name_reg); // name |
| 1058 // Save a pointer to where we pushed the arguments pointer. | 1057 // Save a pointer to where we pushed the arguments pointer. |
| 1059 // This will be passed as the const AccessorInfo& to the C++ callback. | 1058 // This will be passed as the const AccessorInfo& to the C++ callback. |
| 1060 __ mov(eax, esp); | 1059 __ mov(eax, esp); |
| 1061 __ add(Operand(eax), Immediate(4 * kPointerSize)); | 1060 __ add(Operand(eax), Immediate(4 * kPointerSize)); |
| 1062 __ mov(ebx, esp); | 1061 __ mov(ebx, esp); |
| 1063 | 1062 |
| 1064 // Do call through the api. | 1063 // Do call through the api. |
| 1065 ASSERT_EQ(5, ApiGetterEntryStub::kStackSpace); | 1064 ASSERT_EQ(5, ApiGetterEntryStub::kStackSpace); |
| 1066 Address getter_address = v8::ToCData<Address>(callback->getter()); | 1065 Address getter_address = v8::ToCData<Address>(callback->getter()); |
| 1067 ApiFunction fun(getter_address); | 1066 ApiFunction fun(getter_address); |
| 1068 ApiGetterEntryStub stub(callback_handle, &fun); | 1067 ApiGetterEntryStub stub(callback_handle, &fun); |
| 1069 // Emitting a stub call may try to allocate (if the code is not | 1068 // Emitting a stub call may try to allocate (if the code is not |
| 1070 // already generated). Do not allow the assembler to perform a | 1069 // already generated). Do not allow the assembler to perform a |
| 1071 // garbage collection but instead return the allocation failure | 1070 // garbage collection but instead return the allocation failure |
| 1072 // object. | 1071 // object. |
| 1073 Object* result = masm()->TryCallStub(&stub); | 1072 Object* result = masm()->TryCallStub(&stub); |
| 1074 if (result->IsFailure()) { | 1073 if (result->IsFailure()) { |
| 1075 *failure = Failure::cast(result); | 1074 *failure = Failure::cast(result); |
| 1076 return false; | 1075 return false; |
| 1077 } | 1076 } |
| 1078 | 1077 |
| 1079 // We need to avoid using eax since that now holds the result. | 1078 // We need to avoid using eax since that now holds the result. |
| 1080 Register tmp = other.is(eax) ? reg : other; | 1079 Register tmp = scratch2.is(eax) ? reg : scratch2; |
| 1081 // Emitting PopHandleScope may try to allocate. Do not allow the | 1080 // Emitting PopHandleScope may try to allocate. Do not allow the |
| 1082 // assembler to perform a garbage collection but instead return a | 1081 // assembler to perform a garbage collection but instead return a |
| 1083 // failure object. | 1082 // failure object. |
| 1084 result = masm()->TryPopHandleScope(eax, tmp); | 1083 result = masm()->TryPopHandleScope(eax, tmp); |
| 1085 if (result->IsFailure()) { | 1084 if (result->IsFailure()) { |
| 1086 *failure = Failure::cast(result); | 1085 *failure = Failure::cast(result); |
| 1087 return false; | 1086 return false; |
| 1088 } | 1087 } |
| 1089 __ LeaveInternalFrame(); | 1088 __ LeaveInternalFrame(); |
| 1090 | 1089 |
| (...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2741 // Return the generated code. | 2740 // Return the generated code. |
| 2742 return GetCode(); | 2741 return GetCode(); |
| 2743 } | 2742 } |
| 2744 | 2743 |
| 2745 | 2744 |
| 2746 #undef __ | 2745 #undef __ |
| 2747 | 2746 |
| 2748 } } // namespace v8::internal | 2747 } } // namespace v8::internal |
| 2749 | 2748 |
| 2750 #endif // V8_TARGET_ARCH_IA32 | 2749 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |