| 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 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 | 1268 |
| 1269 if (compile_followup_inline) { | 1269 if (compile_followup_inline) { |
| 1270 // Compile the interceptor call, followed by inline code to load the | 1270 // Compile the interceptor call, followed by inline code to load the |
| 1271 // property from further up the prototype chain if the call fails. | 1271 // property from further up the prototype chain if the call fails. |
| 1272 // Check that the maps haven't changed. | 1272 // Check that the maps haven't changed. |
| 1273 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, | 1273 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, |
| 1274 scratch1, scratch2, scratch3, | 1274 scratch1, scratch2, scratch3, |
| 1275 name, miss); | 1275 name, miss); |
| 1276 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); | 1276 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1)); |
| 1277 | 1277 |
| 1278 // Preserve the receiver register explicitly whenever it is different from |
| 1279 // the holder and it is needed should the interceptor return without any |
| 1280 // result. The CALLBACKS case needs the receiver to be passed into C++ code, |
| 1281 // the FIELD case might cause a miss during the prototype check. |
| 1282 bool must_perfrom_prototype_check = *interceptor_holder != lookup->holder(); |
| 1283 bool must_preserve_receiver_reg = !receiver.is(holder_reg) && |
| 1284 (lookup->type() == CALLBACKS || must_perfrom_prototype_check); |
| 1285 |
| 1278 // Save necessary data before invoking an interceptor. | 1286 // Save necessary data before invoking an interceptor. |
| 1279 // Requires a frame to make GC aware of pushed pointers. | 1287 // Requires a frame to make GC aware of pushed pointers. |
| 1280 { | 1288 { |
| 1281 FrameScope frame_scope(masm(), StackFrame::INTERNAL); | 1289 FrameScope frame_scope(masm(), StackFrame::INTERNAL); |
| 1282 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | 1290 if (must_preserve_receiver_reg) { |
| 1283 // CALLBACKS case needs a receiver to be passed into C++ callback. | |
| 1284 __ Push(receiver, holder_reg, name_reg); | 1291 __ Push(receiver, holder_reg, name_reg); |
| 1285 } else { | 1292 } else { |
| 1286 __ Push(holder_reg, name_reg); | 1293 __ Push(holder_reg, name_reg); |
| 1287 } | 1294 } |
| 1288 // Invoke an interceptor. Note: map checks from receiver to | 1295 // Invoke an interceptor. Note: map checks from receiver to |
| 1289 // interceptor's holder has been compiled before (see a caller | 1296 // interceptor's holder has been compiled before (see a caller |
| 1290 // of this method). | 1297 // of this method). |
| 1291 CompileCallLoadPropertyWithInterceptor(masm(), | 1298 CompileCallLoadPropertyWithInterceptor(masm(), |
| 1292 receiver, | 1299 receiver, |
| 1293 holder_reg, | 1300 holder_reg, |
| 1294 name_reg, | 1301 name_reg, |
| 1295 interceptor_holder); | 1302 interceptor_holder); |
| 1296 // Check if interceptor provided a value for property. If it's | 1303 // Check if interceptor provided a value for property. If it's |
| 1297 // the case, return immediately. | 1304 // the case, return immediately. |
| 1298 Label interceptor_failed; | 1305 Label interceptor_failed; |
| 1299 __ LoadRoot(scratch1, Heap::kNoInterceptorResultSentinelRootIndex); | 1306 __ LoadRoot(scratch1, Heap::kNoInterceptorResultSentinelRootIndex); |
| 1300 __ Branch(&interceptor_failed, eq, v0, Operand(scratch1)); | 1307 __ Branch(&interceptor_failed, eq, v0, Operand(scratch1)); |
| 1301 frame_scope.GenerateLeaveFrame(); | 1308 frame_scope.GenerateLeaveFrame(); |
| 1302 __ Ret(); | 1309 __ Ret(); |
| 1303 | 1310 |
| 1304 __ bind(&interceptor_failed); | 1311 __ bind(&interceptor_failed); |
| 1305 __ pop(name_reg); | 1312 __ pop(name_reg); |
| 1306 __ pop(holder_reg); | 1313 __ pop(holder_reg); |
| 1307 if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) { | 1314 if (must_preserve_receiver_reg) { |
| 1308 __ pop(receiver); | 1315 __ pop(receiver); |
| 1309 } | 1316 } |
| 1310 // Leave the internal frame. | 1317 // Leave the internal frame. |
| 1311 } | 1318 } |
| 1312 // Check that the maps from interceptor's holder to lookup's holder | 1319 // Check that the maps from interceptor's holder to lookup's holder |
| 1313 // haven't changed. And load lookup's holder into |holder| register. | 1320 // haven't changed. And load lookup's holder into |holder| register. |
| 1314 if (*interceptor_holder != lookup->holder()) { | 1321 if (must_perfrom_prototype_check) { |
| 1315 holder_reg = CheckPrototypes(interceptor_holder, | 1322 holder_reg = CheckPrototypes(interceptor_holder, |
| 1316 holder_reg, | 1323 holder_reg, |
| 1317 Handle<JSObject>(lookup->holder()), | 1324 Handle<JSObject>(lookup->holder()), |
| 1318 scratch1, | 1325 scratch1, |
| 1319 scratch2, | 1326 scratch2, |
| 1320 scratch3, | 1327 scratch3, |
| 1321 name, | 1328 name, |
| 1322 miss); | 1329 miss); |
| 1323 } | 1330 } |
| 1324 | 1331 |
| (...skipping 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4512 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4519 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
| 4513 } | 4520 } |
| 4514 } | 4521 } |
| 4515 | 4522 |
| 4516 | 4523 |
| 4517 #undef __ | 4524 #undef __ |
| 4518 | 4525 |
| 4519 } } // namespace v8::internal | 4526 } } // namespace v8::internal |
| 4520 | 4527 |
| 4521 #endif // V8_TARGET_ARCH_MIPS | 4528 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |