Chromium Code Reviews| Index: src/x64/stub-cache-x64.cc |
| =================================================================== |
| --- src/x64/stub-cache-x64.cc (revision 5803) |
| +++ src/x64/stub-cache-x64.cc (working copy) |
| @@ -2585,19 +2585,21 @@ |
| Handle<AccessorInfo> callback_handle(callback); |
| - __ EnterInternalFrame(); |
| - // Push the stack address where the list of arguments ends. |
| - __ movq(scratch2, rsp); |
| - __ subq(scratch2, Immediate(2 * kPointerSize)); |
| - __ push(scratch2); |
| + // Insert additional parameters into the stack frame above return address. |
| + ASSERT(!scratch2.is(reg)); |
| + __ pop(scratch2); // Get return address to place it below. |
| + |
| __ push(receiver); // receiver |
| + ASSERT(!scratch3.is(reg)); |
| + __ movq(scratch3, rsp); |
| __ push(reg); // holder |
| if (Heap::InNewSpace(callback_handle->data())) { |
| - __ Move(scratch2, callback_handle); |
| - __ push(FieldOperand(scratch2, AccessorInfo::kDataOffset)); // data |
| + __ Move(scratch1, callback_handle); |
| + __ push(FieldOperand(scratch1, AccessorInfo::kDataOffset)); // data |
| } else { |
| __ Push(Handle<Object>(callback_handle->data())); |
| } |
| + __ push(scratch3); |
| __ push(name_reg); // name |
| // Save a pointer to where we pushed the arguments pointer. |
| // This will be passed as the const AccessorInfo& to the C++ callback. |
| @@ -2607,42 +2609,41 @@ |
| Register accessor_info_arg = r8; |
| Register name_arg = rdx; |
| #else |
| - Register accessor_info_arg = rdx; // temporary, copied to rsi by the stub. |
| + Register accessor_info_arg = rsi; |
| Register name_arg = rdi; |
| #endif |
| - __ movq(accessor_info_arg, rsp); |
| - __ addq(accessor_info_arg, Immediate(4 * kPointerSize)); |
| - __ movq(name_arg, rsp); |
| + if (!name_arg.is(scratch2)) { |
|
antonm
2010/11/13 11:34:46
maybe just require that scratch2 is not rdi? or s
SeRya
2010/11/15 12:09:11
Done.
|
| + __ movq(name_arg, rsp); |
| + __ push(scratch2); // Restore return addresss. |
|
antonm
2010/11/13 11:34:46
addresss -> address
SeRya
2010/11/15 12:09:11
Done.
|
| + } else { |
| + __ push(scratch2); // Restore return addresss. |
|
antonm
2010/11/13 11:34:46
ditto
SeRya
2010/11/15 12:09:11
Done.
|
| + __ lea(name_arg, Operand(rsp, kPointerSize)); |
| + } |
| // Do call through the api. |
| - ASSERT_EQ(5, ApiGetterEntryStub::kStackSpace); |
| Address getter_address = v8::ToCData<Address>(callback->getter()); |
| ApiFunction fun(getter_address); |
| - ApiGetterEntryStub stub(callback_handle, &fun); |
| -#ifdef _WIN64 |
| - // We need to prepare a slot for result handle on stack and put |
| - // a pointer to it into 1st arg register. |
| - __ push(Immediate(0)); |
| - __ movq(rcx, rsp); |
| -#endif |
| + |
| + // 3 elements array for v8::Agruments::values_, handler for name and pointer |
| + // to the values (it considered as smi in GC). |
| + const int kStackSpace = 5; |
| + const int kApiArgc = 2; |
| + |
| + __ PrepareCallApiFunction(kStackSpace, kApiArgc); |
| + |
| + // If accessor_info_arg is rsi this is safe point to set it up. |
|
antonm
2010/11/13 11:34:46
what do you mean by that? may you be more explici
SeRya
2010/11/15 12:09:11
Done.
|
| + __ lea(accessor_info_arg, Operand(name_arg, 1 * kPointerSize)); |
| + |
| // Emitting a stub call may try to allocate (if the code is not |
| // already generated). Do not allow the assembler to perform a |
| // garbage collection but instead return the allocation failure |
| // object. |
| - MaybeObject* result = masm()->TryCallStub(&stub); |
| + MaybeObject* result = masm()->TryCallApiFunctionAndReturn(&fun); |
| if (result->IsFailure()) { |
| *failure = Failure::cast(result); |
| return false; |
| } |
| -#ifdef _WIN64 |
| - // Discard allocated slot. |
| - __ addq(rsp, Immediate(kPointerSize)); |
| -#endif |
| - __ LeaveInternalFrame(); |
| - |
| - __ ret(0); |
| - |
| return true; |
| } |