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