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

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

Issue 10417004: Merged r11492 into 3.9 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.9
Patch Set: Created 8 years, 7 months 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 | « src/version.cc ('k') | test/cctest/test-api.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 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 1097
1098 if (compile_followup_inline) { 1098 if (compile_followup_inline) {
1099 // Compile the interceptor call, followed by inline code to load the 1099 // Compile the interceptor call, followed by inline code to load the
1100 // property from further up the prototype chain if the call fails. 1100 // property from further up the prototype chain if the call fails.
1101 // Check that the maps haven't changed. 1101 // Check that the maps haven't changed.
1102 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, 1102 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder,
1103 scratch1, scratch2, scratch3, 1103 scratch1, scratch2, scratch3,
1104 name, miss); 1104 name, miss);
1105 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); 1105 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1));
1106 1106
1107 // Preserve the receiver register explicitly whenever it is different from
1108 // the holder and it is needed should the interceptor return without any
1109 // result. The CALLBACKS case needs the receiver to be passed into C++ code,
1110 // the FIELD case might cause a miss during the prototype check.
1111 bool must_perfrom_prototype_check = *interceptor_holder != lookup->holder();
1112 bool must_preserve_receiver_reg = !receiver.is(holder_reg) &&
1113 (lookup->type() == CALLBACKS || must_perfrom_prototype_check);
1114
1107 // Save necessary data before invoking an interceptor. 1115 // Save necessary data before invoking an interceptor.
1108 // Requires a frame to make GC aware of pushed pointers. 1116 // Requires a frame to make GC aware of pushed pointers.
1109 { 1117 {
1110 FrameScope frame_scope(masm(), StackFrame::INTERNAL); 1118 FrameScope frame_scope(masm(), StackFrame::INTERNAL);
1111 1119
1112 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { 1120 if (must_preserve_receiver_reg) {
1113 // CALLBACKS case needs a receiver to be passed into C++ callback.
1114 __ push(receiver); 1121 __ push(receiver);
1115 } 1122 }
1116 __ push(holder_reg); 1123 __ push(holder_reg);
1117 __ push(name_reg); 1124 __ push(name_reg);
1118 1125
1119 // Invoke an interceptor. Note: map checks from receiver to 1126 // Invoke an interceptor. Note: map checks from receiver to
1120 // interceptor's holder has been compiled before (see a caller 1127 // interceptor's holder has been compiled before (see a caller
1121 // of this method.) 1128 // of this method.)
1122 CompileCallLoadPropertyWithInterceptor(masm(), 1129 CompileCallLoadPropertyWithInterceptor(masm(),
1123 receiver, 1130 receiver,
1124 holder_reg, 1131 holder_reg,
1125 name_reg, 1132 name_reg,
1126 interceptor_holder); 1133 interceptor_holder);
1127 1134
1128 // Check if interceptor provided a value for property. If it's 1135 // Check if interceptor provided a value for property. If it's
1129 // the case, return immediately. 1136 // the case, return immediately.
1130 Label interceptor_failed; 1137 Label interceptor_failed;
1131 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); 1138 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex);
1132 __ j(equal, &interceptor_failed); 1139 __ j(equal, &interceptor_failed);
1133 frame_scope.GenerateLeaveFrame(); 1140 frame_scope.GenerateLeaveFrame();
1134 __ ret(0); 1141 __ ret(0);
1135 1142
1136 __ bind(&interceptor_failed); 1143 __ bind(&interceptor_failed);
1137 __ pop(name_reg); 1144 __ pop(name_reg);
1138 __ pop(holder_reg); 1145 __ pop(holder_reg);
1139 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { 1146 if (must_preserve_receiver_reg) {
1140 __ pop(receiver); 1147 __ pop(receiver);
1141 } 1148 }
1142 1149
1143 // Leave the internal frame. 1150 // Leave the internal frame.
1144 } 1151 }
1145 1152
1146 // Check that the maps from interceptor's holder to lookup's holder 1153 // Check that the maps from interceptor's holder to lookup's holder
1147 // haven't changed. And load lookup's holder into |holder| register. 1154 // haven't changed. And load lookup's holder into |holder| register.
1148 if (*interceptor_holder != lookup->holder()) { 1155 if (must_perfrom_prototype_check) {
1149 holder_reg = CheckPrototypes(interceptor_holder, 1156 holder_reg = CheckPrototypes(interceptor_holder,
1150 holder_reg, 1157 holder_reg,
1151 Handle<JSObject>(lookup->holder()), 1158 Handle<JSObject>(lookup->holder()),
1152 scratch1, 1159 scratch1,
1153 scratch2, 1160 scratch2,
1154 scratch3, 1161 scratch3,
1155 name, 1162 name,
1156 miss); 1163 miss);
1157 } 1164 }
1158 1165
(...skipping 2630 matching lines...) Expand 10 before | Expand all | Expand 10 after
3789 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 3796 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
3790 } 3797 }
3791 } 3798 }
3792 3799
3793 3800
3794 #undef __ 3801 #undef __
3795 3802
3796 } } // namespace v8::internal 3803 } } // namespace v8::internal
3797 3804
3798 #endif // V8_TARGET_ARCH_X64 3805 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/version.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698