| 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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 Register scratch3, | 793 Register scratch3, |
| 794 String* name, | 794 String* name, |
| 795 JSObject* interceptor_holder, | 795 JSObject* interceptor_holder, |
| 796 Label* miss_label) { | 796 Label* miss_label) { |
| 797 Register holder = | 797 Register holder = |
| 798 stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder, | 798 stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder, |
| 799 scratch1, scratch2, scratch3, name, | 799 scratch1, scratch2, scratch3, name, |
| 800 miss_label); | 800 miss_label); |
| 801 | 801 |
| 802 // Call a runtime function to load the interceptor property. | 802 // Call a runtime function to load the interceptor property. |
| 803 __ EnterInternalFrame(); | 803 FrameScope scope(masm, StackFrame::INTERNAL); |
| 804 // Save the name_ register across the call. | 804 // Save the name_ register across the call. |
| 805 __ push(name_); | 805 __ push(name_); |
| 806 | 806 |
| 807 PushInterceptorArguments(masm, | 807 PushInterceptorArguments(masm, |
| 808 receiver, | 808 receiver, |
| 809 holder, | 809 holder, |
| 810 name_, | 810 name_, |
| 811 interceptor_holder); | 811 interceptor_holder); |
| 812 | 812 |
| 813 __ CallExternalReference( | 813 __ CallExternalReference( |
| 814 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), | 814 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), |
| 815 masm->isolate()), | 815 masm->isolate()), |
| 816 5); | 816 5); |
| 817 | 817 |
| 818 // Restore the name_ register. | 818 // Restore the name_ register. |
| 819 __ pop(name_); | 819 __ pop(name_); |
| 820 __ LeaveInternalFrame(); | 820 |
| 821 // Leave the internal frame. |
| 821 } | 822 } |
| 822 | 823 |
| 823 void LoadWithInterceptor(MacroAssembler* masm, | 824 void LoadWithInterceptor(MacroAssembler* masm, |
| 824 Register receiver, | 825 Register receiver, |
| 825 Register holder, | 826 Register holder, |
| 826 JSObject* holder_obj, | 827 JSObject* holder_obj, |
| 827 Register scratch, | 828 Register scratch, |
| 828 Label* interceptor_succeeded) { | 829 Label* interceptor_succeeded) { |
| 829 __ EnterInternalFrame(); | 830 { |
| 830 __ Push(holder, name_); | 831 FrameScope scope(masm, StackFrame::INTERNAL); |
| 832 __ Push(holder, name_); |
| 831 | 833 |
| 832 CompileCallLoadPropertyWithInterceptor(masm, | 834 CompileCallLoadPropertyWithInterceptor(masm, |
| 833 receiver, | 835 receiver, |
| 834 holder, | 836 holder, |
| 835 name_, | 837 name_, |
| 836 holder_obj); | 838 holder_obj); |
| 837 | 839 |
| 838 __ pop(name_); // Restore the name. | 840 __ pop(name_); // Restore the name. |
| 839 __ pop(receiver); // Restore the holder. | 841 __ pop(receiver); // Restore the holder. |
| 840 __ LeaveInternalFrame(); | 842 } |
| 841 | 843 |
| 842 // If interceptor returns no-result sentinel, call the constant function. | 844 // If interceptor returns no-result sentinel, call the constant function. |
| 843 __ LoadRoot(scratch, Heap::kNoInterceptorResultSentinelRootIndex); | 845 __ LoadRoot(scratch, Heap::kNoInterceptorResultSentinelRootIndex); |
| 844 __ cmp(r0, scratch); | 846 __ cmp(r0, scratch); |
| 845 __ b(ne, interceptor_succeeded); | 847 __ b(ne, interceptor_succeeded); |
| 846 } | 848 } |
| 847 | 849 |
| 848 StubCompiler* stub_compiler_; | 850 StubCompiler* stub_compiler_; |
| 849 const ParameterCount& arguments_; | 851 const ParameterCount& arguments_; |
| 850 Register name_; | 852 Register name_; |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 // Compile the interceptor call, followed by inline code to load the | 1293 // Compile the interceptor call, followed by inline code to load the |
| 1292 // property from further up the prototype chain if the call fails. | 1294 // property from further up the prototype chain if the call fails. |
| 1293 // Check that the maps haven't changed. | 1295 // Check that the maps haven't changed. |
| 1294 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, | 1296 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, |
| 1295 scratch1, scratch2, scratch3, | 1297 scratch1, scratch2, scratch3, |
| 1296 name, miss); | 1298 name, miss); |
| 1297 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); | 1299 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); |
| 1298 | 1300 |
| 1299 // Save necessary data before invoking an interceptor. | 1301 // Save necessary data before invoking an interceptor. |
| 1300 // Requires a frame to make GC aware of pushed pointers. | 1302 // Requires a frame to make GC aware of pushed pointers. |
| 1301 __ EnterInternalFrame(); | 1303 { |
| 1304 FrameScope frame_scope(masm(), StackFrame::INTERNAL); |
| 1302 | 1305 |
| 1303 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | 1306 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { |
| 1304 // CALLBACKS case needs a receiver to be passed into C++ callback. | 1307 // CALLBACKS case needs a receiver to be passed into C++ callback. |
| 1305 __ Push(receiver, holder_reg, name_reg); | 1308 __ Push(receiver, holder_reg, name_reg); |
| 1306 } else { | 1309 } else { |
| 1307 __ Push(holder_reg, name_reg); | 1310 __ Push(holder_reg, name_reg); |
| 1311 } |
| 1312 |
| 1313 // Invoke an interceptor. Note: map checks from receiver to |
| 1314 // interceptor's holder has been compiled before (see a caller |
| 1315 // of this method.) |
| 1316 CompileCallLoadPropertyWithInterceptor(masm(), |
| 1317 receiver, |
| 1318 holder_reg, |
| 1319 name_reg, |
| 1320 interceptor_holder); |
| 1321 |
| 1322 // Check if interceptor provided a value for property. If it's |
| 1323 // the case, return immediately. |
| 1324 Label interceptor_failed; |
| 1325 __ LoadRoot(scratch1, Heap::kNoInterceptorResultSentinelRootIndex); |
| 1326 __ cmp(r0, scratch1); |
| 1327 __ b(eq, &interceptor_failed); |
| 1328 frame_scope.GenerateLeaveFrame(); |
| 1329 __ Ret(); |
| 1330 |
| 1331 __ bind(&interceptor_failed); |
| 1332 __ pop(name_reg); |
| 1333 __ pop(holder_reg); |
| 1334 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { |
| 1335 __ pop(receiver); |
| 1336 } |
| 1337 |
| 1338 // Leave the internal frame. |
| 1308 } | 1339 } |
| 1309 | 1340 |
| 1310 // Invoke an interceptor. Note: map checks from receiver to | |
| 1311 // interceptor's holder has been compiled before (see a caller | |
| 1312 // of this method.) | |
| 1313 CompileCallLoadPropertyWithInterceptor(masm(), | |
| 1314 receiver, | |
| 1315 holder_reg, | |
| 1316 name_reg, | |
| 1317 interceptor_holder); | |
| 1318 | |
| 1319 // Check if interceptor provided a value for property. If it's | |
| 1320 // the case, return immediately. | |
| 1321 Label interceptor_failed; | |
| 1322 __ LoadRoot(scratch1, Heap::kNoInterceptorResultSentinelRootIndex); | |
| 1323 __ cmp(r0, scratch1); | |
| 1324 __ b(eq, &interceptor_failed); | |
| 1325 __ LeaveInternalFrame(); | |
| 1326 __ Ret(); | |
| 1327 | |
| 1328 __ bind(&interceptor_failed); | |
| 1329 __ pop(name_reg); | |
| 1330 __ pop(holder_reg); | |
| 1331 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | |
| 1332 __ pop(receiver); | |
| 1333 } | |
| 1334 | |
| 1335 __ LeaveInternalFrame(); | |
| 1336 | |
| 1337 // Check that the maps from interceptor's holder to lookup's holder | 1341 // Check that the maps from interceptor's holder to lookup's holder |
| 1338 // haven't changed. And load lookup's holder into |holder| register. | 1342 // haven't changed. And load lookup's holder into |holder| register. |
| 1339 if (interceptor_holder != lookup->holder()) { | 1343 if (interceptor_holder != lookup->holder()) { |
| 1340 holder_reg = CheckPrototypes(interceptor_holder, | 1344 holder_reg = CheckPrototypes(interceptor_holder, |
| 1341 holder_reg, | 1345 holder_reg, |
| 1342 lookup->holder(), | 1346 lookup->holder(), |
| 1343 scratch1, | 1347 scratch1, |
| 1344 scratch2, | 1348 scratch2, |
| 1345 scratch3, | 1349 scratch3, |
| 1346 name, | 1350 name, |
| (...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4229 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 4233 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
| 4230 __ Jump(ic, RelocInfo::CODE_TARGET); | 4234 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 4231 } | 4235 } |
| 4232 | 4236 |
| 4233 | 4237 |
| 4234 #undef __ | 4238 #undef __ |
| 4235 | 4239 |
| 4236 } } // namespace v8::internal | 4240 } } // namespace v8::internal |
| 4237 | 4241 |
| 4238 #endif // V8_TARGET_ARCH_ARM | 4242 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |