| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
| 8 | 8 |
| 9 #include "src/api-arguments.h" | 9 #include "src/api-arguments.h" |
| 10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 if (!miss->is_unused()) { | 590 if (!miss->is_unused()) { |
| 591 Label success; | 591 Label success; |
| 592 __ jmp(&success); | 592 __ jmp(&success); |
| 593 GenerateRestoreName(miss, name); | 593 GenerateRestoreName(miss, name); |
| 594 if (IC::ICUseVector(kind())) PopVectorAndSlot(); | 594 if (IC::ICUseVector(kind())) PopVectorAndSlot(); |
| 595 TailCallBuiltin(masm(), MissBuiltin(kind())); | 595 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 596 __ bind(&success); | 596 __ bind(&success); |
| 597 } | 597 } |
| 598 } | 598 } |
| 599 | 599 |
| 600 | |
| 601 void NamedLoadHandlerCompiler::GenerateLoadCallback( | |
| 602 Register reg, Handle<AccessorInfo> callback) { | |
| 603 DCHECK(!AreAliased(kScratchRegister, scratch2(), scratch3(), receiver())); | |
| 604 DCHECK(!AreAliased(kScratchRegister, scratch2(), scratch3(), reg)); | |
| 605 | |
| 606 // Insert additional parameters into the stack frame above return address. | |
| 607 __ PopReturnAddressTo(scratch3()); | |
| 608 | |
| 609 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | |
| 610 // name below the exit frame to make GC aware of them. | |
| 611 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); | |
| 612 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); | |
| 613 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); | |
| 614 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); | |
| 615 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); | |
| 616 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); | |
| 617 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); | |
| 618 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); | |
| 619 | |
| 620 __ Push(receiver()); // receiver | |
| 621 Handle<Object> data(callback->data(), isolate()); | |
| 622 if (data->IsUndefined() || data->IsSmi()) { | |
| 623 __ Push(data); | |
| 624 } else { | |
| 625 Handle<WeakCell> cell = | |
| 626 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); | |
| 627 // The callback is alive if this instruction is executed, | |
| 628 // so the weak cell is not cleared and points to data. | |
| 629 __ GetWeakValue(scratch2(), cell); | |
| 630 __ Push(scratch2()); | |
| 631 } | |
| 632 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | |
| 633 __ Push(kScratchRegister); // return value | |
| 634 __ Push(kScratchRegister); // return value default | |
| 635 __ PushAddress(ExternalReference::isolate_address(isolate())); | |
| 636 __ Push(reg); // holder | |
| 637 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false | |
| 638 | |
| 639 __ Push(name()); // name | |
| 640 __ PushReturnAddressFrom(scratch3()); | |
| 641 | |
| 642 // Abi for CallApiGetter | |
| 643 Register api_function_address = ApiGetterDescriptor::function_address(); | |
| 644 Address getter_address = v8::ToCData<Address>(callback->getter()); | |
| 645 __ Move(api_function_address, getter_address, RelocInfo::EXTERNAL_REFERENCE); | |
| 646 | |
| 647 CallApiGetterStub stub(isolate()); | |
| 648 __ TailCallStub(&stub); | |
| 649 } | |
| 650 | |
| 651 | |
| 652 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 600 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 653 // Return the constant value. | 601 // Return the constant value. |
| 654 __ Move(rax, value); | 602 __ Move(rax, value); |
| 655 __ ret(0); | 603 __ ret(0); |
| 656 } | 604 } |
| 657 | 605 |
| 658 | 606 |
| 659 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 607 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
| 660 LookupIterator* it, Register holder_reg) { | 608 LookupIterator* it, Register holder_reg) { |
| 661 DCHECK(holder()->HasNamedInterceptor()); | 609 DCHECK(holder()->HasNamedInterceptor()); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 // Return the generated code. | 748 // Return the generated code. |
| 801 return GetCode(kind(), name); | 749 return GetCode(kind(), name); |
| 802 } | 750 } |
| 803 | 751 |
| 804 | 752 |
| 805 #undef __ | 753 #undef __ |
| 806 } // namespace internal | 754 } // namespace internal |
| 807 } // namespace v8 | 755 } // namespace v8 |
| 808 | 756 |
| 809 #endif // V8_TARGET_ARCH_X64 | 757 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |