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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 __ PushReturnAddressFrom(scratch2()); | 669 __ PushReturnAddressFrom(scratch2()); |
670 | 670 |
671 ExternalReference ref = ExternalReference( | 671 ExternalReference ref = ExternalReference( |
672 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); | 672 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); |
673 __ TailCallExternalReference( | 673 __ TailCallExternalReference( |
674 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); | 674 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); |
675 } | 675 } |
676 | 676 |
677 | 677 |
678 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 678 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
679 Handle<JSObject> object, Handle<Name> name, int accessor_index) { | 679 Handle<JSObject> object, Handle<Name> name, |
| 680 Handle<ExecutableAccessorInfo> callback) { |
680 Register holder_reg = Frontend(name); | 681 Register holder_reg = Frontend(name); |
681 | 682 |
682 __ PopReturnAddressTo(scratch1()); | 683 __ PopReturnAddressTo(scratch1()); |
683 __ Push(receiver()); | 684 __ Push(receiver()); |
684 __ Push(holder_reg); | 685 __ Push(holder_reg); |
685 __ Push(Smi::FromInt(accessor_index)); | 686 // If the callback cannot leak, then push the callback directly, |
| 687 // otherwise wrap it in a weak cell. |
| 688 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
| 689 __ Push(callback); |
| 690 } else { |
| 691 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
| 692 __ Push(cell); |
| 693 } |
686 __ Push(name); | 694 __ Push(name); |
687 __ Push(value()); | 695 __ Push(value()); |
688 __ PushReturnAddressFrom(scratch1()); | 696 __ PushReturnAddressFrom(scratch1()); |
689 | 697 |
690 // Do tail-call to the runtime system. | 698 // Do tail-call to the runtime system. |
691 ExternalReference store_callback_property = | 699 ExternalReference store_callback_property = |
692 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 700 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
693 __ TailCallExternalReference(store_callback_property, 5, 1); | 701 __ TailCallExternalReference(store_callback_property, 5, 1); |
694 | 702 |
695 // Return the generated code. | 703 // Return the generated code. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 // Return the generated code. | 763 // Return the generated code. |
756 return GetCode(kind(), Code::NORMAL, name); | 764 return GetCode(kind(), Code::NORMAL, name); |
757 } | 765 } |
758 | 766 |
759 | 767 |
760 #undef __ | 768 #undef __ |
761 } | 769 } |
762 } // namespace v8::internal | 770 } // namespace v8::internal |
763 | 771 |
764 #endif // V8_TARGET_ARCH_X64 | 772 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |