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