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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 __ mov(dst, FieldOperand(dst, offset)); | 269 __ mov(dst, FieldOperand(dst, offset)); |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 | 273 |
274 static void PushInterceptorArguments(MacroAssembler* masm, | 274 static void PushInterceptorArguments(MacroAssembler* masm, |
275 Register receiver, | 275 Register receiver, |
276 Register holder, | 276 Register holder, |
277 Register name, | 277 Register name, |
278 JSObject* holder_obj) { | 278 JSObject* holder_obj) { |
279 __ push(receiver); | |
280 __ push(holder); | |
281 __ push(name); | 279 __ push(name); |
282 InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor(); | 280 InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor(); |
283 ASSERT(!Heap::InNewSpace(interceptor)); | 281 ASSERT(!Heap::InNewSpace(interceptor)); |
284 __ mov(receiver, Immediate(Handle<Object>(interceptor))); | 282 Register scratch = name; |
283 __ mov(scratch, Immediate(Handle<Object>(interceptor))); | |
284 __ push(scratch); | |
285 __ push(receiver); | 285 __ push(receiver); |
286 __ push(FieldOperand(receiver, InterceptorInfo::kDataOffset)); | 286 __ push(holder); |
287 __ push(FieldOperand(scratch, InterceptorInfo::kDataOffset)); | |
287 } | 288 } |
288 | 289 |
289 | 290 |
290 static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm, | 291 static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm, |
291 Register receiver, | 292 Register receiver, |
292 Register holder, | 293 Register holder, |
293 Register name, | 294 Register name, |
294 JSObject* holder_obj) { | 295 JSObject* holder_obj) { |
295 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 296 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
296 __ CallExternalReference( | 297 __ CallExternalReference( |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1032 Register reg = | 1033 Register reg = |
1033 CheckPrototypes(object, receiver, holder, | 1034 CheckPrototypes(object, receiver, holder, |
1034 scratch1, scratch2, name, miss); | 1035 scratch1, scratch2, name, miss); |
1035 | 1036 |
1036 Handle<AccessorInfo> callback_handle(callback); | 1037 Handle<AccessorInfo> callback_handle(callback); |
1037 | 1038 |
1038 Register other = reg.is(scratch1) ? scratch2 : scratch1; | 1039 Register other = reg.is(scratch1) ? scratch2 : scratch1; |
1039 __ EnterInternalFrame(); | 1040 __ EnterInternalFrame(); |
1040 __ PushHandleScope(other); | 1041 __ PushHandleScope(other); |
1041 // Push the stack address where the list of arguments ends | 1042 // Push the stack address where the list of arguments ends |
1042 __ mov(other, esp); | 1043 __ mov(other, esp); |
antonm
2010/03/25 14:40:53
Do we need to push the address?
Vitaly Repeshko
2010/03/25 17:08:56
Yes, please see below. It's internal::Object** fro
| |
1043 __ sub(Operand(other), Immediate(2 * kPointerSize)); | 1044 __ sub(Operand(other), Immediate(2 * kPointerSize)); |
1044 __ push(other); | 1045 __ push(other); |
1045 __ push(receiver); // receiver | 1046 __ push(receiver); // receiver |
1046 __ push(reg); // holder | 1047 __ push(reg); // holder |
1047 __ mov(other, Immediate(callback_handle)); | 1048 __ mov(other, Immediate(callback_handle)); |
1048 __ push(other); | |
1049 __ push(FieldOperand(other, AccessorInfo::kDataOffset)); // data | 1049 __ push(FieldOperand(other, AccessorInfo::kDataOffset)); // data |
1050 __ push(name_reg); // name | 1050 __ push(name_reg); // name |
1051 // Save a pointer to where we pushed the arguments pointer. | 1051 // Save a pointer to where we pushed the arguments pointer. |
1052 // This will be passed as the const Arguments& to the C++ callback. | 1052 // This will be passed as the const AccessorInfo& to the C++ callback. |
1053 __ mov(eax, esp); | 1053 __ mov(eax, esp); |
1054 __ add(Operand(eax), Immediate(5 * kPointerSize)); | 1054 __ add(Operand(eax), Immediate(4 * kPointerSize)); |
antonm
2010/03/25 14:40:53
could we use some named constant for this 4?
Vitaly Repeshko
2010/03/25 17:08:56
This is a local thing: it's the depth of the argum
| |
1055 __ mov(ebx, esp); | 1055 __ mov(ebx, esp); |
1056 | 1056 |
1057 // Do call through the api. | 1057 // Do call through the api. |
1058 ASSERT_EQ(6, ApiGetterEntryStub::kStackSpace); | 1058 ASSERT_EQ(5, ApiGetterEntryStub::kStackSpace); |
antonm
2010/03/25 14:40:53
do you I understand it right, this is not ported t
Vitaly Repeshko
2010/03/25 17:08:56
Right, this is not ported to other platforms and I
| |
1059 Address getter_address = v8::ToCData<Address>(callback->getter()); | 1059 Address getter_address = v8::ToCData<Address>(callback->getter()); |
1060 ApiFunction fun(getter_address); | 1060 ApiFunction fun(getter_address); |
1061 ApiGetterEntryStub stub(callback_handle, &fun); | 1061 ApiGetterEntryStub stub(callback_handle, &fun); |
1062 // Emitting a stub call may try to allocate (if the code is not | 1062 // Emitting a stub call may try to allocate (if the code is not |
1063 // already generated). Do not allow the assembler to perform a | 1063 // already generated). Do not allow the assembler to perform a |
1064 // garbage collection but instead return the allocation failure | 1064 // garbage collection but instead return the allocation failure |
1065 // object. | 1065 // object. |
1066 Object* result = masm()->TryCallStub(&stub); | 1066 Object* result = masm()->TryCallStub(&stub); |
1067 if (result->IsFailure()) { | 1067 if (result->IsFailure()) { |
1068 *failure = Failure::cast(result); | 1068 *failure = Failure::cast(result); |
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2424 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 2424 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
2425 | 2425 |
2426 // Return the generated code. | 2426 // Return the generated code. |
2427 return GetCode(); | 2427 return GetCode(); |
2428 } | 2428 } |
2429 | 2429 |
2430 | 2430 |
2431 #undef __ | 2431 #undef __ |
2432 | 2432 |
2433 } } // namespace v8::internal | 2433 } } // namespace v8::internal |
OLD | NEW |