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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 Register scratch2, | 648 Register scratch2, |
649 Register scratch3, | 649 Register scratch3, |
650 String* name, | 650 String* name, |
651 JSObject* interceptor_holder, | 651 JSObject* interceptor_holder, |
652 Label* miss_label) { | 652 Label* miss_label) { |
653 Register holder = | 653 Register holder = |
654 stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder, | 654 stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder, |
655 scratch1, scratch2, scratch3, name, | 655 scratch1, scratch2, scratch3, name, |
656 miss_label); | 656 miss_label); |
657 | 657 |
658 FrameScope scope(masm, StackFrame::INTERNAL); | 658 __ EnterInternalFrame(); |
659 // Save the name_ register across the call. | 659 // Save the name_ register across the call. |
660 __ push(name_); | 660 __ push(name_); |
661 | 661 |
662 PushInterceptorArguments(masm, | 662 PushInterceptorArguments(masm, |
663 receiver, | 663 receiver, |
664 holder, | 664 holder, |
665 name_, | 665 name_, |
666 interceptor_holder); | 666 interceptor_holder); |
667 | 667 |
668 __ CallExternalReference( | 668 __ CallExternalReference( |
669 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), | 669 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), |
670 masm->isolate()), | 670 masm->isolate()), |
671 5); | 671 5); |
672 | 672 |
673 // Restore the name_ register. | 673 // Restore the name_ register. |
674 __ pop(name_); | 674 __ pop(name_); |
675 | 675 __ LeaveInternalFrame(); |
676 // Leave the internal frame. | |
677 } | 676 } |
678 | 677 |
679 void LoadWithInterceptor(MacroAssembler* masm, | 678 void LoadWithInterceptor(MacroAssembler* masm, |
680 Register receiver, | 679 Register receiver, |
681 Register holder, | 680 Register holder, |
682 JSObject* holder_obj, | 681 JSObject* holder_obj, |
683 Label* interceptor_succeeded) { | 682 Label* interceptor_succeeded) { |
684 { | 683 __ EnterInternalFrame(); |
685 FrameScope scope(masm, StackFrame::INTERNAL); | 684 __ push(holder); // Save the holder. |
686 __ push(holder); // Save the holder. | 685 __ push(name_); // Save the name. |
687 __ push(name_); // Save the name. | |
688 | 686 |
689 CompileCallLoadPropertyWithInterceptor(masm, | 687 CompileCallLoadPropertyWithInterceptor(masm, |
690 receiver, | 688 receiver, |
691 holder, | 689 holder, |
692 name_, | 690 name_, |
693 holder_obj); | 691 holder_obj); |
694 | 692 |
695 __ pop(name_); // Restore the name. | 693 __ pop(name_); // Restore the name. |
696 __ pop(receiver); // Restore the holder. | 694 __ pop(receiver); // Restore the holder. |
697 // Leave the internal frame. | 695 __ LeaveInternalFrame(); |
698 } | |
699 | 696 |
700 __ cmp(eax, masm->isolate()->factory()->no_interceptor_result_sentinel()); | 697 __ cmp(eax, masm->isolate()->factory()->no_interceptor_result_sentinel()); |
701 __ j(not_equal, interceptor_succeeded); | 698 __ j(not_equal, interceptor_succeeded); |
702 } | 699 } |
703 | 700 |
704 StubCompiler* stub_compiler_; | 701 StubCompiler* stub_compiler_; |
705 const ParameterCount& arguments_; | 702 const ParameterCount& arguments_; |
706 Register name_; | 703 Register name_; |
707 Code::ExtraICState extra_ic_state_; | 704 Code::ExtraICState extra_ic_state_; |
708 }; | 705 }; |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 // Compile the interceptor call, followed by inline code to load the | 1160 // Compile the interceptor call, followed by inline code to load the |
1164 // property from further up the prototype chain if the call fails. | 1161 // property from further up the prototype chain if the call fails. |
1165 // Check that the maps haven't changed. | 1162 // Check that the maps haven't changed. |
1166 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, | 1163 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, |
1167 scratch1, scratch2, scratch3, | 1164 scratch1, scratch2, scratch3, |
1168 name, miss); | 1165 name, miss); |
1169 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); | 1166 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); |
1170 | 1167 |
1171 // Save necessary data before invoking an interceptor. | 1168 // Save necessary data before invoking an interceptor. |
1172 // Requires a frame to make GC aware of pushed pointers. | 1169 // Requires a frame to make GC aware of pushed pointers. |
1173 { | 1170 __ EnterInternalFrame(); |
1174 FrameScope frame_scope(masm(), StackFrame::INTERNAL); | |
1175 | 1171 |
1176 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | 1172 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { |
1177 // CALLBACKS case needs a receiver to be passed into C++ callback. | 1173 // CALLBACKS case needs a receiver to be passed into C++ callback. |
1178 __ push(receiver); | 1174 __ push(receiver); |
1179 } | 1175 } |
1180 __ push(holder_reg); | 1176 __ push(holder_reg); |
1181 __ push(name_reg); | 1177 __ push(name_reg); |
1182 | 1178 |
1183 // Invoke an interceptor. Note: map checks from receiver to | 1179 // Invoke an interceptor. Note: map checks from receiver to |
1184 // interceptor's holder has been compiled before (see a caller | 1180 // interceptor's holder has been compiled before (see a caller |
1185 // of this method.) | 1181 // of this method.) |
1186 CompileCallLoadPropertyWithInterceptor(masm(), | 1182 CompileCallLoadPropertyWithInterceptor(masm(), |
1187 receiver, | 1183 receiver, |
1188 holder_reg, | 1184 holder_reg, |
1189 name_reg, | 1185 name_reg, |
1190 interceptor_holder); | 1186 interceptor_holder); |
1191 | 1187 |
1192 // Check if interceptor provided a value for property. If it's | 1188 // Check if interceptor provided a value for property. If it's |
1193 // the case, return immediately. | 1189 // the case, return immediately. |
1194 Label interceptor_failed; | 1190 Label interceptor_failed; |
1195 __ cmp(eax, factory()->no_interceptor_result_sentinel()); | 1191 __ cmp(eax, factory()->no_interceptor_result_sentinel()); |
1196 __ j(equal, &interceptor_failed); | 1192 __ j(equal, &interceptor_failed); |
1197 frame_scope.GenerateLeaveFrame(); | 1193 __ LeaveInternalFrame(); |
1198 __ ret(0); | 1194 __ ret(0); |
1199 | 1195 |
1200 __ bind(&interceptor_failed); | 1196 __ bind(&interceptor_failed); |
1201 __ pop(name_reg); | 1197 __ pop(name_reg); |
1202 __ pop(holder_reg); | 1198 __ pop(holder_reg); |
1203 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | 1199 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { |
1204 __ pop(receiver); | 1200 __ pop(receiver); |
1205 } | 1201 } |
1206 | 1202 |
1207 // Leave the internal frame. | 1203 __ LeaveInternalFrame(); |
1208 } | |
1209 | 1204 |
1210 // Check that the maps from interceptor's holder to lookup's holder | 1205 // Check that the maps from interceptor's holder to lookup's holder |
1211 // haven't changed. And load lookup's holder into holder_reg. | 1206 // haven't changed. And load lookup's holder into holder_reg. |
1212 if (interceptor_holder != lookup->holder()) { | 1207 if (interceptor_holder != lookup->holder()) { |
1213 holder_reg = CheckPrototypes(interceptor_holder, | 1208 holder_reg = CheckPrototypes(interceptor_holder, |
1214 holder_reg, | 1209 holder_reg, |
1215 lookup->holder(), | 1210 lookup->holder(), |
1216 scratch1, | 1211 scratch1, |
1217 scratch2, | 1212 scratch2, |
1218 scratch3, | 1213 scratch3, |
(...skipping 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3867 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3862 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
3868 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3863 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); |
3869 } | 3864 } |
3870 | 3865 |
3871 | 3866 |
3872 #undef __ | 3867 #undef __ |
3873 | 3868 |
3874 } } // namespace v8::internal | 3869 } } // namespace v8::internal |
3875 | 3870 |
3876 #endif // V8_TARGET_ARCH_IA32 | 3871 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |