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 FrameScope scope(masm, StackFrame::INTERNAL); | 648 __ EnterInternalFrame(); |
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 | 665 __ LeaveInternalFrame(); |
666 // Leave the internal frame. | |
667 } | 666 } |
668 | 667 |
669 void LoadWithInterceptor(MacroAssembler* masm, | 668 void LoadWithInterceptor(MacroAssembler* masm, |
670 Register receiver, | 669 Register receiver, |
671 Register holder, | 670 Register holder, |
672 JSObject* holder_obj, | 671 JSObject* holder_obj, |
673 Label* interceptor_succeeded) { | 672 Label* interceptor_succeeded) { |
674 { | 673 __ EnterInternalFrame(); |
675 FrameScope scope(masm, StackFrame::INTERNAL); | 674 __ push(holder); // Save the holder. |
676 __ push(holder); // Save the holder. | 675 __ push(name_); // Save the name. |
677 __ push(name_); // Save the name. | |
678 | 676 |
679 CompileCallLoadPropertyWithInterceptor(masm, | 677 CompileCallLoadPropertyWithInterceptor(masm, |
680 receiver, | 678 receiver, |
681 holder, | 679 holder, |
682 name_, | 680 name_, |
683 holder_obj); | 681 holder_obj); |
684 | 682 |
685 __ pop(name_); // Restore the name. | 683 __ pop(name_); // Restore the name. |
686 __ pop(receiver); // Restore the holder. | 684 __ pop(receiver); // Restore the holder. |
687 // Leave the internal frame. | 685 __ LeaveInternalFrame(); |
688 } | |
689 | 686 |
690 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); | 687 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); |
691 __ j(not_equal, interceptor_succeeded); | 688 __ j(not_equal, interceptor_succeeded); |
692 } | 689 } |
693 | 690 |
694 StubCompiler* stub_compiler_; | 691 StubCompiler* stub_compiler_; |
695 const ParameterCount& arguments_; | 692 const ParameterCount& arguments_; |
696 Register name_; | 693 Register name_; |
697 Code::ExtraICState extra_ic_state_; | 694 Code::ExtraICState extra_ic_state_; |
698 }; | 695 }; |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 // Compile the interceptor call, followed by inline code to load the | 1133 // Compile the interceptor call, followed by inline code to load the |
1137 // property from further up the prototype chain if the call fails. | 1134 // property from further up the prototype chain if the call fails. |
1138 // Check that the maps haven't changed. | 1135 // Check that the maps haven't changed. |
1139 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, | 1136 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, |
1140 scratch1, scratch2, scratch3, | 1137 scratch1, scratch2, scratch3, |
1141 name, miss); | 1138 name, miss); |
1142 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); | 1139 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); |
1143 | 1140 |
1144 // Save necessary data before invoking an interceptor. | 1141 // Save necessary data before invoking an interceptor. |
1145 // Requires a frame to make GC aware of pushed pointers. | 1142 // Requires a frame to make GC aware of pushed pointers. |
1146 { | 1143 __ EnterInternalFrame(); |
1147 FrameScope frame_scope(masm(), StackFrame::INTERNAL); | |
1148 | 1144 |
1149 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | 1145 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { |
1150 // CALLBACKS case needs a receiver to be passed into C++ callback. | 1146 // CALLBACKS case needs a receiver to be passed into C++ callback. |
1151 __ push(receiver); | 1147 __ push(receiver); |
1152 } | 1148 } |
1153 __ push(holder_reg); | 1149 __ push(holder_reg); |
1154 __ push(name_reg); | 1150 __ push(name_reg); |
1155 | 1151 |
1156 // Invoke an interceptor. Note: map checks from receiver to | 1152 // Invoke an interceptor. Note: map checks from receiver to |
1157 // interceptor's holder has been compiled before (see a caller | 1153 // interceptor's holder has been compiled before (see a caller |
1158 // of this method.) | 1154 // of this method.) |
1159 CompileCallLoadPropertyWithInterceptor(masm(), | 1155 CompileCallLoadPropertyWithInterceptor(masm(), |
1160 receiver, | 1156 receiver, |
1161 holder_reg, | 1157 holder_reg, |
1162 name_reg, | 1158 name_reg, |
1163 interceptor_holder); | 1159 interceptor_holder); |
1164 | 1160 |
1165 // Check if interceptor provided a value for property. If it's | 1161 // Check if interceptor provided a value for property. If it's |
1166 // the case, return immediately. | 1162 // the case, return immediately. |
1167 Label interceptor_failed; | 1163 Label interceptor_failed; |
1168 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); | 1164 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); |
1169 __ j(equal, &interceptor_failed); | 1165 __ j(equal, &interceptor_failed); |
1170 frame_scope.GenerateLeaveFrame(); | 1166 __ LeaveInternalFrame(); |
1171 __ ret(0); | 1167 __ ret(0); |
1172 | 1168 |
1173 __ bind(&interceptor_failed); | 1169 __ bind(&interceptor_failed); |
1174 __ pop(name_reg); | 1170 __ pop(name_reg); |
1175 __ pop(holder_reg); | 1171 __ pop(holder_reg); |
1176 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | 1172 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { |
1177 __ pop(receiver); | 1173 __ pop(receiver); |
1178 } | 1174 } |
1179 | 1175 |
1180 // Leave the internal frame. | 1176 __ LeaveInternalFrame(); |
1181 } | |
1182 | 1177 |
1183 // Check that the maps from interceptor's holder to lookup's holder | 1178 // Check that the maps from interceptor's holder to lookup's holder |
1184 // haven't changed. And load lookup's holder into |holder| register. | 1179 // haven't changed. And load lookup's holder into |holder| register. |
1185 if (interceptor_holder != lookup->holder()) { | 1180 if (interceptor_holder != lookup->holder()) { |
1186 holder_reg = CheckPrototypes(interceptor_holder, | 1181 holder_reg = CheckPrototypes(interceptor_holder, |
1187 holder_reg, | 1182 holder_reg, |
1188 lookup->holder(), | 1183 lookup->holder(), |
1189 scratch1, | 1184 scratch1, |
1190 scratch2, | 1185 scratch2, |
1191 scratch3, | 1186 scratch3, |
(...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3630 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3625 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
3631 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3626 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); |
3632 } | 3627 } |
3633 | 3628 |
3634 | 3629 |
3635 #undef __ | 3630 #undef __ |
3636 | 3631 |
3637 } } // namespace v8::internal | 3632 } } // namespace v8::internal |
3638 | 3633 |
3639 #endif // V8_TARGET_ARCH_X64 | 3634 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |