| OLD | NEW |
| 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 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 | 1259 |
| 1260 if (compile_followup_inline) { | 1260 if (compile_followup_inline) { |
| 1261 // Compile the interceptor call, followed by inline code to load the | 1261 // Compile the interceptor call, followed by inline code to load the |
| 1262 // property from further up the prototype chain if the call fails. | 1262 // property from further up the prototype chain if the call fails. |
| 1263 // Check that the maps haven't changed. | 1263 // Check that the maps haven't changed. |
| 1264 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, | 1264 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, |
| 1265 scratch1, scratch2, scratch3, | 1265 scratch1, scratch2, scratch3, |
| 1266 name, miss); | 1266 name, miss); |
| 1267 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); | 1267 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); |
| 1268 | 1268 |
| 1269 // Preserve the receiver register explicitly whenever it is different from |
| 1270 // the holder and it is needed should the interceptor return without any |
| 1271 // result. The CALLBACKS case needs the receiver to be passed into C++ code, |
| 1272 // the FIELD case might cause a miss during the prototype check. |
| 1273 bool must_perfrom_prototype_check = *interceptor_holder != lookup->holder(); |
| 1274 bool must_preserve_receiver_reg = !receiver.is(holder_reg) && |
| 1275 (lookup->type() == CALLBACKS || must_perfrom_prototype_check); |
| 1276 |
| 1269 // Save necessary data before invoking an interceptor. | 1277 // Save necessary data before invoking an interceptor. |
| 1270 // Requires a frame to make GC aware of pushed pointers. | 1278 // Requires a frame to make GC aware of pushed pointers. |
| 1271 { | 1279 { |
| 1272 FrameScope frame_scope(masm(), StackFrame::INTERNAL); | 1280 FrameScope frame_scope(masm(), StackFrame::INTERNAL); |
| 1273 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | 1281 if (must_preserve_receiver_reg) { |
| 1274 // CALLBACKS case needs a receiver to be passed into C++ callback. | |
| 1275 __ Push(receiver, holder_reg, name_reg); | 1282 __ Push(receiver, holder_reg, name_reg); |
| 1276 } else { | 1283 } else { |
| 1277 __ Push(holder_reg, name_reg); | 1284 __ Push(holder_reg, name_reg); |
| 1278 } | 1285 } |
| 1279 // Invoke an interceptor. Note: map checks from receiver to | 1286 // Invoke an interceptor. Note: map checks from receiver to |
| 1280 // interceptor's holder has been compiled before (see a caller | 1287 // interceptor's holder has been compiled before (see a caller |
| 1281 // of this method.) | 1288 // of this method.) |
| 1282 CompileCallLoadPropertyWithInterceptor(masm(), | 1289 CompileCallLoadPropertyWithInterceptor(masm(), |
| 1283 receiver, | 1290 receiver, |
| 1284 holder_reg, | 1291 holder_reg, |
| 1285 name_reg, | 1292 name_reg, |
| 1286 interceptor_holder); | 1293 interceptor_holder); |
| 1287 // Check if interceptor provided a value for property. If it's | 1294 // Check if interceptor provided a value for property. If it's |
| 1288 // the case, return immediately. | 1295 // the case, return immediately. |
| 1289 Label interceptor_failed; | 1296 Label interceptor_failed; |
| 1290 __ LoadRoot(scratch1, Heap::kNoInterceptorResultSentinelRootIndex); | 1297 __ LoadRoot(scratch1, Heap::kNoInterceptorResultSentinelRootIndex); |
| 1291 __ cmp(r0, scratch1); | 1298 __ cmp(r0, scratch1); |
| 1292 __ b(eq, &interceptor_failed); | 1299 __ b(eq, &interceptor_failed); |
| 1293 frame_scope.GenerateLeaveFrame(); | 1300 frame_scope.GenerateLeaveFrame(); |
| 1294 __ Ret(); | 1301 __ Ret(); |
| 1295 | 1302 |
| 1296 __ bind(&interceptor_failed); | 1303 __ bind(&interceptor_failed); |
| 1297 __ pop(name_reg); | 1304 __ pop(name_reg); |
| 1298 __ pop(holder_reg); | 1305 __ pop(holder_reg); |
| 1299 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | 1306 if (must_preserve_receiver_reg) { |
| 1300 __ pop(receiver); | 1307 __ pop(receiver); |
| 1301 } | 1308 } |
| 1302 // Leave the internal frame. | 1309 // Leave the internal frame. |
| 1303 } | 1310 } |
| 1304 // Check that the maps from interceptor's holder to lookup's holder | 1311 // Check that the maps from interceptor's holder to lookup's holder |
| 1305 // haven't changed. And load lookup's holder into |holder| register. | 1312 // haven't changed. And load lookup's holder into |holder| register. |
| 1306 if (*interceptor_holder != lookup->holder()) { | 1313 if (must_perfrom_prototype_check) { |
| 1307 holder_reg = CheckPrototypes(interceptor_holder, | 1314 holder_reg = CheckPrototypes(interceptor_holder, |
| 1308 holder_reg, | 1315 holder_reg, |
| 1309 Handle<JSObject>(lookup->holder()), | 1316 Handle<JSObject>(lookup->holder()), |
| 1310 scratch1, | 1317 scratch1, |
| 1311 scratch2, | 1318 scratch2, |
| 1312 scratch3, | 1319 scratch3, |
| 1313 name, | 1320 name, |
| 1314 miss); | 1321 miss); |
| 1315 } | 1322 } |
| 1316 | 1323 |
| (...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4450 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4457 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
| 4451 } | 4458 } |
| 4452 } | 4459 } |
| 4453 | 4460 |
| 4454 | 4461 |
| 4455 #undef __ | 4462 #undef __ |
| 4456 | 4463 |
| 4457 } } // namespace v8::internal | 4464 } } // namespace v8::internal |
| 4458 | 4465 |
| 4459 #endif // V8_TARGET_ARCH_ARM | 4466 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |