Index: src/ic/x64/handler-compiler-x64.cc |
diff --git a/src/ic/x64/handler-compiler-x64.cc b/src/ic/x64/handler-compiler-x64.cc |
index 21d96eaabcfb9ba3ff696f42a31f455461a285d0..ffefeee43c3f0756c0a50187e67e12d6b04b43ff 100644 |
--- a/src/ic/x64/handler-compiler-x64.cc |
+++ b/src/ic/x64/handler-compiler-x64.cc |
@@ -597,6 +597,58 @@ |
} |
} |
+ |
+void NamedLoadHandlerCompiler::GenerateLoadCallback( |
+ Register reg, Handle<AccessorInfo> callback) { |
+ DCHECK(!AreAliased(kScratchRegister, scratch2(), scratch3(), receiver())); |
+ DCHECK(!AreAliased(kScratchRegister, scratch2(), scratch3(), reg)); |
+ |
+ // Insert additional parameters into the stack frame above return address. |
+ __ PopReturnAddressTo(scratch3()); |
+ |
+ // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
+ // name below the exit frame to make GC aware of them. |
+ STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); |
+ STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); |
+ STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); |
+ STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); |
+ STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); |
+ STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); |
+ STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); |
+ STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); |
+ |
+ __ Push(receiver()); // receiver |
+ Handle<Object> data(callback->data(), isolate()); |
+ if (data->IsUndefined() || data->IsSmi()) { |
+ __ Push(data); |
+ } else { |
+ Handle<WeakCell> cell = |
+ isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
+ // The callback is alive if this instruction is executed, |
+ // so the weak cell is not cleared and points to data. |
+ __ GetWeakValue(scratch2(), cell); |
+ __ Push(scratch2()); |
+ } |
+ __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
+ __ Push(kScratchRegister); // return value |
+ __ Push(kScratchRegister); // return value default |
+ __ PushAddress(ExternalReference::isolate_address(isolate())); |
+ __ Push(reg); // holder |
+ __ Push(Smi::FromInt(0)); // should_throw_on_error -> false |
+ |
+ __ Push(name()); // name |
+ __ PushReturnAddressFrom(scratch3()); |
+ |
+ // Abi for CallApiGetter |
+ Register api_function_address = ApiGetterDescriptor::function_address(); |
+ Address getter_address = v8::ToCData<Address>(callback->getter()); |
+ __ Move(api_function_address, getter_address, RelocInfo::EXTERNAL_REFERENCE); |
+ |
+ CallApiGetterStub stub(isolate()); |
+ __ TailCallStub(&stub); |
+} |
+ |
+ |
void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
// Return the constant value. |
__ Move(rax, value); |