Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 1903093003: Reland of Change calling convention of CallApiGetterStub to accept the AccessorInfo (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects-printer.cc ('k') | src/x64/interface-descriptors-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 5489 matching lines...) Expand 10 before | Expand all | Expand 10 after
5500 Operand* stack_space_operand = &is_construct_call_operand; 5500 Operand* stack_space_operand = &is_construct_call_operand;
5501 stack_space = argc + FCA::kArgsLength + 1; 5501 stack_space = argc + FCA::kArgsLength + 1;
5502 stack_space_operand = nullptr; 5502 stack_space_operand = nullptr;
5503 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, callback_arg, 5503 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, callback_arg,
5504 stack_space, stack_space_operand, 5504 stack_space, stack_space_operand,
5505 return_value_operand, &context_restore_operand); 5505 return_value_operand, &context_restore_operand);
5506 } 5506 }
5507 5507
5508 5508
5509 void CallApiGetterStub::Generate(MacroAssembler* masm) { 5509 void CallApiGetterStub::Generate(MacroAssembler* masm) {
5510 // ----------- S t a t e -------------
5511 // -- rsp[0] : return address
5512 // -- rsp[8] : name
5513 // -- rsp[16 .. (16 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_
5514 // -- ...
5515 // -- r8 : api_function_address
5516 // -----------------------------------
5517
5518 #if defined(__MINGW64__) || defined(_WIN64) 5510 #if defined(__MINGW64__) || defined(_WIN64)
5519 Register getter_arg = r8; 5511 Register getter_arg = r8;
5520 Register accessor_info_arg = rdx; 5512 Register accessor_info_arg = rdx;
5521 Register name_arg = rcx; 5513 Register name_arg = rcx;
5522 #else 5514 #else
5523 Register getter_arg = rdx; 5515 Register getter_arg = rdx;
5524 Register accessor_info_arg = rsi; 5516 Register accessor_info_arg = rsi;
5525 Register name_arg = rdi; 5517 Register name_arg = rdi;
5526 #endif 5518 #endif
5527 Register api_function_address = ApiGetterDescriptor::function_address(); 5519 Register api_function_address = r8;
5528 DCHECK(api_function_address.is(r8)); 5520 Register receiver = ApiGetterDescriptor::ReceiverRegister();
5521 Register holder = ApiGetterDescriptor::HolderRegister();
5522 Register callback = ApiGetterDescriptor::CallbackRegister();
5529 Register scratch = rax; 5523 Register scratch = rax;
5524 DCHECK(!AreAliased(receiver, holder, callback, scratch));
5525
5526 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
5527 // name below the exit frame to make GC aware of them.
5528 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
5529 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
5530 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
5531 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
5532 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
5533 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
5534 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
5535 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
5536
5537 // Insert additional parameters into the stack frame above return address.
5538 __ PopReturnAddressTo(scratch);
5539 __ Push(receiver);
5540 __ Push(FieldOperand(callback, AccessorInfo::kDataOffset));
5541 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
5542 __ Push(kScratchRegister); // return value
5543 __ Push(kScratchRegister); // return value default
5544 __ PushAddress(ExternalReference::isolate_address(isolate()));
5545 __ Push(holder);
5546 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false
5547 __ Push(FieldOperand(callback, AccessorInfo::kNameOffset));
5548 __ PushReturnAddressFrom(scratch);
5530 5549
5531 // v8::PropertyCallbackInfo::args_ array and name handle. 5550 // v8::PropertyCallbackInfo::args_ array and name handle.
5532 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; 5551 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
5533 5552
5534 // Allocate v8::PropertyCallbackInfo in non-GCed stack space. 5553 // Allocate v8::PropertyCallbackInfo in non-GCed stack space.
5535 const int kArgStackSpace = 1; 5554 const int kArgStackSpace = 1;
5536 5555
5537 // Load address of v8::PropertyAccessorInfo::args_ array. 5556 // Load address of v8::PropertyAccessorInfo::args_ array.
5538 __ leap(scratch, Operand(rsp, 2 * kPointerSize)); 5557 __ leap(scratch, Operand(rsp, 2 * kPointerSize));
5539 5558
5540 PrepareCallApiFunction(masm, kArgStackSpace); 5559 PrepareCallApiFunction(masm, kArgStackSpace);
5541 // Create v8::PropertyCallbackInfo object on the stack and initialize 5560 // Create v8::PropertyCallbackInfo object on the stack and initialize
5542 // it's args_ field. 5561 // it's args_ field.
5543 Operand info_object = StackSpaceOperand(0); 5562 Operand info_object = StackSpaceOperand(0);
5544 __ movp(info_object, scratch); 5563 __ movp(info_object, scratch);
5545 5564
5546 __ leap(name_arg, Operand(scratch, -kPointerSize)); 5565 __ leap(name_arg, Operand(scratch, -kPointerSize));
5547 // The context register (rsi) has been saved in PrepareCallApiFunction and 5566 // The context register (rsi) has been saved in PrepareCallApiFunction and
5548 // could be used to pass arguments. 5567 // could be used to pass arguments.
5549 __ leap(accessor_info_arg, info_object); 5568 __ leap(accessor_info_arg, info_object);
5550 5569
5551 ExternalReference thunk_ref = 5570 ExternalReference thunk_ref =
5552 ExternalReference::invoke_accessor_getter_callback(isolate()); 5571 ExternalReference::invoke_accessor_getter_callback(isolate());
5553 5572
5554 // It's okay if api_function_address == getter_arg 5573 // It's okay if api_function_address == getter_arg
5555 // but not accessor_info_arg or name_arg 5574 // but not accessor_info_arg or name_arg
5556 DCHECK(!api_function_address.is(accessor_info_arg) && 5575 DCHECK(!api_function_address.is(accessor_info_arg));
5557 !api_function_address.is(name_arg)); 5576 DCHECK(!api_function_address.is(name_arg));
5577 __ movp(scratch, FieldOperand(callback, AccessorInfo::kJsGetterOffset));
5578 __ movp(api_function_address,
5579 FieldOperand(scratch, Foreign::kForeignAddressOffset));
5558 5580
5559 // +3 is to skip prolog, return address and name handle. 5581 // +3 is to skip prolog, return address and name handle.
5560 Operand return_value_operand( 5582 Operand return_value_operand(
5561 rbp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); 5583 rbp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
5562 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, 5584 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg,
5563 kStackUnwindSpace, nullptr, return_value_operand, 5585 kStackUnwindSpace, nullptr, return_value_operand,
5564 NULL); 5586 NULL);
5565 } 5587 }
5566 5588
5567 namespace { 5589 namespace {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
5727 TypedArrayJumpTableEpilogue(masm, &table, &i8, &u8, &i16, &u16, &i32, &u32, 5749 TypedArrayJumpTableEpilogue(masm, &table, &i8, &u8, &i16, &u16, &i32, &u32,
5728 &u8); 5750 &u8);
5729 } 5751 }
5730 5752
5731 #undef __ 5753 #undef __
5732 5754
5733 } // namespace internal 5755 } // namespace internal
5734 } // namespace v8 5756 } // namespace v8
5735 5757
5736 #endif // V8_TARGET_ARCH_X64 5758 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/x64/interface-descriptors-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698