OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 Register scratch2, | 638 Register scratch2, |
639 Register scratch3, | 639 Register scratch3, |
640 String* name, | 640 String* name, |
641 JSObject* interceptor_holder, | 641 JSObject* interceptor_holder, |
642 Label* miss_label) { | 642 Label* miss_label) { |
643 Register holder = | 643 Register holder = |
644 stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder, | 644 stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder, |
645 scratch1, scratch2, scratch3, name, | 645 scratch1, scratch2, scratch3, name, |
646 miss_label); | 646 miss_label); |
647 | 647 |
648 __ EnterInternalFrame(); | 648 FrameScope scope(masm, StackFrame::INTERNAL); |
649 // Save the name_ register across the call. | 649 // Save the name_ register across the call. |
650 __ push(name_); | 650 __ push(name_); |
651 | 651 |
652 PushInterceptorArguments(masm, | 652 PushInterceptorArguments(masm, |
653 receiver, | 653 receiver, |
654 holder, | 654 holder, |
655 name_, | 655 name_, |
656 interceptor_holder); | 656 interceptor_holder); |
657 | 657 |
658 __ CallExternalReference( | 658 __ CallExternalReference( |
659 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), | 659 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), |
660 masm->isolate()), | 660 masm->isolate()), |
661 5); | 661 5); |
662 | 662 |
663 // Restore the name_ register. | 663 // Restore the name_ register. |
664 __ pop(name_); | 664 __ pop(name_); |
665 __ LeaveInternalFrame(); | 665 |
| 666 // Leave the internal frame. |
666 } | 667 } |
667 | 668 |
668 void LoadWithInterceptor(MacroAssembler* masm, | 669 void LoadWithInterceptor(MacroAssembler* masm, |
669 Register receiver, | 670 Register receiver, |
670 Register holder, | 671 Register holder, |
671 JSObject* holder_obj, | 672 JSObject* holder_obj, |
672 Label* interceptor_succeeded) { | 673 Label* interceptor_succeeded) { |
673 __ EnterInternalFrame(); | 674 { |
674 __ push(holder); // Save the holder. | 675 FrameScope scope(masm, StackFrame::INTERNAL); |
675 __ push(name_); // Save the name. | 676 __ push(holder); // Save the holder. |
| 677 __ push(name_); // Save the name. |
676 | 678 |
677 CompileCallLoadPropertyWithInterceptor(masm, | 679 CompileCallLoadPropertyWithInterceptor(masm, |
678 receiver, | 680 receiver, |
679 holder, | 681 holder, |
680 name_, | 682 name_, |
681 holder_obj); | 683 holder_obj); |
682 | 684 |
683 __ pop(name_); // Restore the name. | 685 __ pop(name_); // Restore the name. |
684 __ pop(receiver); // Restore the holder. | 686 __ pop(receiver); // Restore the holder. |
685 __ LeaveInternalFrame(); | 687 // Leave the internal frame. |
| 688 } |
686 | 689 |
687 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); | 690 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); |
688 __ j(not_equal, interceptor_succeeded); | 691 __ j(not_equal, interceptor_succeeded); |
689 } | 692 } |
690 | 693 |
691 StubCompiler* stub_compiler_; | 694 StubCompiler* stub_compiler_; |
692 const ParameterCount& arguments_; | 695 const ParameterCount& arguments_; |
693 Register name_; | 696 Register name_; |
694 Code::ExtraICState extra_ic_state_; | 697 Code::ExtraICState extra_ic_state_; |
695 }; | 698 }; |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 // Compile the interceptor call, followed by inline code to load the | 1136 // Compile the interceptor call, followed by inline code to load the |
1134 // property from further up the prototype chain if the call fails. | 1137 // property from further up the prototype chain if the call fails. |
1135 // Check that the maps haven't changed. | 1138 // Check that the maps haven't changed. |
1136 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, | 1139 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, |
1137 scratch1, scratch2, scratch3, | 1140 scratch1, scratch2, scratch3, |
1138 name, miss); | 1141 name, miss); |
1139 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); | 1142 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); |
1140 | 1143 |
1141 // Save necessary data before invoking an interceptor. | 1144 // Save necessary data before invoking an interceptor. |
1142 // Requires a frame to make GC aware of pushed pointers. | 1145 // Requires a frame to make GC aware of pushed pointers. |
1143 __ EnterInternalFrame(); | 1146 { |
| 1147 FrameScope frame_scope(masm(), StackFrame::INTERNAL); |
1144 | 1148 |
1145 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | 1149 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { |
1146 // CALLBACKS case needs a receiver to be passed into C++ callback. | 1150 // CALLBACKS case needs a receiver to be passed into C++ callback. |
1147 __ push(receiver); | 1151 __ push(receiver); |
| 1152 } |
| 1153 __ push(holder_reg); |
| 1154 __ push(name_reg); |
| 1155 |
| 1156 // Invoke an interceptor. Note: map checks from receiver to |
| 1157 // interceptor's holder has been compiled before (see a caller |
| 1158 // of this method.) |
| 1159 CompileCallLoadPropertyWithInterceptor(masm(), |
| 1160 receiver, |
| 1161 holder_reg, |
| 1162 name_reg, |
| 1163 interceptor_holder); |
| 1164 |
| 1165 // Check if interceptor provided a value for property. If it's |
| 1166 // the case, return immediately. |
| 1167 Label interceptor_failed; |
| 1168 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); |
| 1169 __ j(equal, &interceptor_failed); |
| 1170 frame_scope.GenerateLeaveFrame(); |
| 1171 __ ret(0); |
| 1172 |
| 1173 __ bind(&interceptor_failed); |
| 1174 __ pop(name_reg); |
| 1175 __ pop(holder_reg); |
| 1176 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { |
| 1177 __ pop(receiver); |
| 1178 } |
| 1179 |
| 1180 // Leave the internal frame. |
1148 } | 1181 } |
1149 __ push(holder_reg); | |
1150 __ push(name_reg); | |
1151 | |
1152 // Invoke an interceptor. Note: map checks from receiver to | |
1153 // interceptor's holder has been compiled before (see a caller | |
1154 // of this method.) | |
1155 CompileCallLoadPropertyWithInterceptor(masm(), | |
1156 receiver, | |
1157 holder_reg, | |
1158 name_reg, | |
1159 interceptor_holder); | |
1160 | |
1161 // Check if interceptor provided a value for property. If it's | |
1162 // the case, return immediately. | |
1163 Label interceptor_failed; | |
1164 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); | |
1165 __ j(equal, &interceptor_failed); | |
1166 __ LeaveInternalFrame(); | |
1167 __ ret(0); | |
1168 | |
1169 __ bind(&interceptor_failed); | |
1170 __ pop(name_reg); | |
1171 __ pop(holder_reg); | |
1172 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | |
1173 __ pop(receiver); | |
1174 } | |
1175 | |
1176 __ LeaveInternalFrame(); | |
1177 | 1182 |
1178 // Check that the maps from interceptor's holder to lookup's holder | 1183 // Check that the maps from interceptor's holder to lookup's holder |
1179 // haven't changed. And load lookup's holder into |holder| register. | 1184 // haven't changed. And load lookup's holder into |holder| register. |
1180 if (interceptor_holder != lookup->holder()) { | 1185 if (interceptor_holder != lookup->holder()) { |
1181 holder_reg = CheckPrototypes(interceptor_holder, | 1186 holder_reg = CheckPrototypes(interceptor_holder, |
1182 holder_reg, | 1187 holder_reg, |
1183 lookup->holder(), | 1188 lookup->holder(), |
1184 scratch1, | 1189 scratch1, |
1185 scratch2, | 1190 scratch2, |
1186 scratch3, | 1191 scratch3, |
(...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3625 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3630 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
3626 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3631 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); |
3627 } | 3632 } |
3628 | 3633 |
3629 | 3634 |
3630 #undef __ | 3635 #undef __ |
3631 | 3636 |
3632 } } // namespace v8::internal | 3637 } } // namespace v8::internal |
3633 | 3638 |
3634 #endif // V8_TARGET_ARCH_X64 | 3639 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |