| 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 // Compile the interceptor call, followed by inline code to load the | 1135 // Compile the interceptor call, followed by inline code to load the |
| 1133 // property from further up the prototype chain if the call fails. | 1136 // property from further up the prototype chain if the call fails. |
| 1134 // Check that the maps haven't changed. | 1137 // Check that the maps haven't changed. |
| 1135 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, | 1138 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, |
| 1136 scratch1, scratch2, scratch3, | 1139 scratch1, scratch2, scratch3, |
| 1137 name, miss); | 1140 name, miss); |
| 1138 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); | 1141 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); |
| 1139 | 1142 |
| 1140 // Save necessary data before invoking an interceptor. | 1143 // Save necessary data before invoking an interceptor. |
| 1141 // Requires a frame to make GC aware of pushed pointers. | 1144 // Requires a frame to make GC aware of pushed pointers. |
| 1142 __ EnterInternalFrame(); | 1145 { |
| 1146 FrameScope frame_scope(masm(), StackFrame::INTERNAL); |
| 1143 | 1147 |
| 1144 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | 1148 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { |
| 1145 // CALLBACKS case needs a receiver to be passed into C++ callback. | 1149 // CALLBACKS case needs a receiver to be passed into C++ callback. |
| 1146 __ push(receiver); | 1150 __ push(receiver); |
| 1151 } |
| 1152 __ push(holder_reg); |
| 1153 __ push(name_reg); |
| 1154 |
| 1155 // Invoke an interceptor. Note: map checks from receiver to |
| 1156 // interceptor's holder has been compiled before (see a caller |
| 1157 // of this method.) |
| 1158 CompileCallLoadPropertyWithInterceptor(masm(), |
| 1159 receiver, |
| 1160 holder_reg, |
| 1161 name_reg, |
| 1162 interceptor_holder); |
| 1163 |
| 1164 // Check if interceptor provided a value for property. If it's |
| 1165 // the case, return immediately. |
| 1166 Label interceptor_failed; |
| 1167 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); |
| 1168 __ j(equal, &interceptor_failed); |
| 1169 frame_scope.GenerateLeaveFrame(); |
| 1170 __ ret(0); |
| 1171 |
| 1172 __ bind(&interceptor_failed); |
| 1173 __ pop(name_reg); |
| 1174 __ pop(holder_reg); |
| 1175 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { |
| 1176 __ pop(receiver); |
| 1177 } |
| 1178 |
| 1179 // Leave the internal frame. |
| 1147 } | 1180 } |
| 1148 __ push(holder_reg); | |
| 1149 __ push(name_reg); | |
| 1150 | |
| 1151 // Invoke an interceptor. Note: map checks from receiver to | |
| 1152 // interceptor's holder has been compiled before (see a caller | |
| 1153 // of this method.) | |
| 1154 CompileCallLoadPropertyWithInterceptor(masm(), | |
| 1155 receiver, | |
| 1156 holder_reg, | |
| 1157 name_reg, | |
| 1158 interceptor_holder); | |
| 1159 | |
| 1160 // Check if interceptor provided a value for property. If it's | |
| 1161 // the case, return immediately. | |
| 1162 Label interceptor_failed; | |
| 1163 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); | |
| 1164 __ j(equal, &interceptor_failed); | |
| 1165 __ LeaveInternalFrame(); | |
| 1166 __ ret(0); | |
| 1167 | |
| 1168 __ bind(&interceptor_failed); | |
| 1169 __ pop(name_reg); | |
| 1170 __ pop(holder_reg); | |
| 1171 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | |
| 1172 __ pop(receiver); | |
| 1173 } | |
| 1174 | |
| 1175 __ LeaveInternalFrame(); | |
| 1176 | 1181 |
| 1177 // Check that the maps from interceptor's holder to lookup's holder | 1182 // Check that the maps from interceptor's holder to lookup's holder |
| 1178 // haven't changed. And load lookup's holder into |holder| register. | 1183 // haven't changed. And load lookup's holder into |holder| register. |
| 1179 if (interceptor_holder != lookup->holder()) { | 1184 if (interceptor_holder != lookup->holder()) { |
| 1180 holder_reg = CheckPrototypes(interceptor_holder, | 1185 holder_reg = CheckPrototypes(interceptor_holder, |
| 1181 holder_reg, | 1186 holder_reg, |
| 1182 lookup->holder(), | 1187 lookup->holder(), |
| 1183 scratch1, | 1188 scratch1, |
| 1184 scratch2, | 1189 scratch2, |
| 1185 scratch3, | 1190 scratch3, |
| (...skipping 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3767 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3772 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
| 3768 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3773 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); |
| 3769 } | 3774 } |
| 3770 | 3775 |
| 3771 | 3776 |
| 3772 #undef __ | 3777 #undef __ |
| 3773 | 3778 |
| 3774 } } // namespace v8::internal | 3779 } } // namespace v8::internal |
| 3775 | 3780 |
| 3776 #endif // V8_TARGET_ARCH_X64 | 3781 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |