Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 82743003: Minor cleanup in calling interceptors for loading properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 __ push(receiver); 784 __ push(receiver);
785 __ push(holder); 785 __ push(holder);
786 } 786 }
787 787
788 788
789 static void CompileCallLoadPropertyWithInterceptor( 789 static void CompileCallLoadPropertyWithInterceptor(
790 MacroAssembler* masm, 790 MacroAssembler* masm,
791 Register receiver, 791 Register receiver,
792 Register holder, 792 Register holder,
793 Register name, 793 Register name,
794 Handle<JSObject> holder_obj) { 794 Handle<JSObject> holder_obj,
795 IC::UtilityId id) {
795 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 796 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
796 797 __ CallExternalReference(
797 ExternalReference ref = 798 ExternalReference(IC_Utility(id), masm->isolate()),
798 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), 799 StubCache::kInterceptorArgsLength);
799 masm->isolate());
800 __ mov(r0, Operand(StubCache::kInterceptorArgsLength));
801 __ mov(r1, Operand(ref));
802
803 CEntryStub stub(1);
804 __ CallStub(&stub);
805 } 800 }
806 801
807 802
808 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; 803 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength;
809 804
810 // Reserves space for the extra arguments to API function in the 805 // Reserves space for the extra arguments to API function in the
811 // caller's frame. 806 // caller's frame.
812 // 807 //
813 // These arguments are set by CheckPrototypes and GenerateFastApiDirectCall. 808 // These arguments are set by CheckPrototypes and GenerateFastApiDirectCall.
814 static void ReserveSpaceForFastApiCall(MacroAssembler* masm, 809 static void ReserveSpaceForFastApiCall(MacroAssembler* masm,
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 Label* miss_label) { 1094 Label* miss_label) {
1100 Register holder = 1095 Register holder =
1101 stub_compiler_->CheckPrototypes( 1096 stub_compiler_->CheckPrototypes(
1102 IC::CurrentTypeOf(object, masm->isolate()), receiver, 1097 IC::CurrentTypeOf(object, masm->isolate()), receiver,
1103 interceptor_holder, scratch1, scratch2, scratch3, name, miss_label); 1098 interceptor_holder, scratch1, scratch2, scratch3, name, miss_label);
1104 1099
1105 // Call a runtime function to load the interceptor property. 1100 // Call a runtime function to load the interceptor property.
1106 FrameScope scope(masm, StackFrame::INTERNAL); 1101 FrameScope scope(masm, StackFrame::INTERNAL);
1107 // Save the name_ register across the call. 1102 // Save the name_ register across the call.
1108 __ push(name_); 1103 __ push(name_);
1109 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); 1104
1110 __ CallExternalReference( 1105 CompileCallLoadPropertyWithInterceptor(
1111 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), 1106 masm, receiver, holder, name_, interceptor_holder,
1112 masm->isolate()), 1107 IC::kLoadPropertyWithInterceptorForCall);
1113 StubCache::kInterceptorArgsLength); 1108
1114 // Restore the name_ register. 1109 // Restore the name_ register.
1115 __ pop(name_); 1110 __ pop(name_);
1116 // Leave the internal frame. 1111 // Leave the internal frame.
1117 } 1112 }
1118 1113
1119 void LoadWithInterceptor(MacroAssembler* masm, 1114 void LoadWithInterceptor(MacroAssembler* masm,
1120 Register receiver, 1115 Register receiver,
1121 Register holder, 1116 Register holder,
1122 Handle<JSObject> holder_obj, 1117 Handle<JSObject> holder_obj,
1123 Register scratch, 1118 Register scratch,
1124 Label* interceptor_succeeded) { 1119 Label* interceptor_succeeded) {
1125 { 1120 {
1126 FrameScope scope(masm, StackFrame::INTERNAL); 1121 FrameScope scope(masm, StackFrame::INTERNAL);
1127 __ Push(holder, name_); 1122 __ Push(holder, name_);
1128 CompileCallLoadPropertyWithInterceptor(masm, 1123 CompileCallLoadPropertyWithInterceptor(
1129 receiver, 1124 masm, receiver, holder, name_, holder_obj,
1130 holder, 1125 IC::kLoadPropertyWithInterceptorOnly);
1131 name_,
1132 holder_obj);
1133 __ pop(name_); // Restore the name. 1126 __ pop(name_); // Restore the name.
1134 __ pop(receiver); // Restore the holder. 1127 __ pop(receiver); // Restore the holder.
1135 } 1128 }
1136 // If interceptor returns no-result sentinel, call the constant function. 1129 // If interceptor returns no-result sentinel, call the constant function.
1137 __ LoadRoot(scratch, Heap::kNoInterceptorResultSentinelRootIndex); 1130 __ LoadRoot(scratch, Heap::kNoInterceptorResultSentinelRootIndex);
1138 __ cmp(r0, scratch); 1131 __ cmp(r0, scratch);
1139 __ b(ne, interceptor_succeeded); 1132 __ b(ne, interceptor_succeeded);
1140 } 1133 }
1141 1134
1142 StubCompiler* stub_compiler_; 1135 StubCompiler* stub_compiler_;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 { 1482 {
1490 FrameScope frame_scope(masm(), StackFrame::INTERNAL); 1483 FrameScope frame_scope(masm(), StackFrame::INTERNAL);
1491 if (must_preserve_receiver_reg) { 1484 if (must_preserve_receiver_reg) {
1492 __ Push(receiver(), holder_reg, this->name()); 1485 __ Push(receiver(), holder_reg, this->name());
1493 } else { 1486 } else {
1494 __ Push(holder_reg, this->name()); 1487 __ Push(holder_reg, this->name());
1495 } 1488 }
1496 // Invoke an interceptor. Note: map checks from receiver to 1489 // Invoke an interceptor. Note: map checks from receiver to
1497 // interceptor's holder has been compiled before (see a caller 1490 // interceptor's holder has been compiled before (see a caller
1498 // of this method.) 1491 // of this method.)
1499 CompileCallLoadPropertyWithInterceptor(masm(), 1492 CompileCallLoadPropertyWithInterceptor(
1500 receiver(), 1493 masm(), receiver(), holder_reg, this->name(), interceptor_holder,
1501 holder_reg, 1494 IC::kLoadPropertyWithInterceptorOnly);
1502 this->name(), 1495
1503 interceptor_holder);
1504 // Check if interceptor provided a value for property. If it's 1496 // Check if interceptor provided a value for property. If it's
1505 // the case, return immediately. 1497 // the case, return immediately.
1506 Label interceptor_failed; 1498 Label interceptor_failed;
1507 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex); 1499 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex);
1508 __ cmp(r0, scratch1()); 1500 __ cmp(r0, scratch1());
1509 __ b(eq, &interceptor_failed); 1501 __ b(eq, &interceptor_failed);
1510 frame_scope.GenerateLeaveFrame(); 1502 frame_scope.GenerateLeaveFrame();
1511 __ Ret(); 1503 __ Ret();
1512 1504
1513 __ bind(&interceptor_failed); 1505 __ bind(&interceptor_failed);
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
2954 // ----------------------------------- 2946 // -----------------------------------
2955 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 2947 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
2956 } 2948 }
2957 2949
2958 2950
2959 #undef __ 2951 #undef __
2960 2952
2961 } } // namespace v8::internal 2953 } } // namespace v8::internal
2962 2954
2963 #endif // V8_TARGET_ARCH_ARM 2955 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698