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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 __ push(scratch2()); // restore old return address | 678 __ push(scratch2()); // restore old return address |
679 | 679 |
680 ExternalReference ref = ExternalReference( | 680 ExternalReference ref = ExternalReference( |
681 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); | 681 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); |
682 __ TailCallExternalReference( | 682 __ TailCallExternalReference( |
683 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); | 683 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); |
684 } | 684 } |
685 | 685 |
686 | 686 |
687 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 687 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
688 Handle<JSObject> object, Handle<Name> name, int accessor_index) { | 688 Handle<JSObject> object, Handle<Name> name, |
| 689 Handle<ExecutableAccessorInfo> callback) { |
689 Register holder_reg = Frontend(name); | 690 Register holder_reg = Frontend(name); |
690 | 691 |
691 __ pop(scratch1()); // remove the return address | 692 __ pop(scratch1()); // remove the return address |
692 __ push(receiver()); | 693 __ push(receiver()); |
693 __ push(holder_reg); | 694 __ push(holder_reg); |
694 __ Push(Smi::FromInt(accessor_index)); | 695 // If the callback cannot leak, then push the callback directly, |
| 696 // otherwise wrap it in a weak cell. |
| 697 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
| 698 __ Push(callback); |
| 699 } else { |
| 700 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
| 701 __ Push(cell); |
| 702 } |
695 __ Push(name); | 703 __ Push(name); |
696 __ push(value()); | 704 __ push(value()); |
697 __ push(scratch1()); // restore return address | 705 __ push(scratch1()); // restore return address |
698 | 706 |
699 // Do tail-call to the runtime system. | 707 // Do tail-call to the runtime system. |
700 ExternalReference store_callback_property = | 708 ExternalReference store_callback_property = |
701 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 709 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
702 __ TailCallExternalReference(store_callback_property, 5, 1); | 710 __ TailCallExternalReference(store_callback_property, 5, 1); |
703 | 711 |
704 // Return the generated code. | 712 // Return the generated code. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 // Return the generated code. | 772 // Return the generated code. |
765 return GetCode(kind(), Code::NORMAL, name); | 773 return GetCode(kind(), Code::NORMAL, name); |
766 } | 774 } |
767 | 775 |
768 | 776 |
769 #undef __ | 777 #undef __ |
770 } | 778 } |
771 } // namespace v8::internal | 779 } // namespace v8::internal |
772 | 780 |
773 #endif // V8_TARGET_ARCH_IA32 | 781 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |