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 8258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8269 // Get the value and receiver from the stack. | 8269 // Get the value and receiver from the stack. |
8270 Result value = frame()->Pop(); | 8270 Result value = frame()->Pop(); |
8271 value.ToRegister(); | 8271 value.ToRegister(); |
8272 Result receiver = frame()->Pop(); | 8272 Result receiver = frame()->Pop(); |
8273 receiver.ToRegister(); | 8273 receiver.ToRegister(); |
8274 | 8274 |
8275 // Allocate result register. | 8275 // Allocate result register. |
8276 result = allocator()->Allocate(); | 8276 result = allocator()->Allocate(); |
8277 ASSERT(result.is_valid() && receiver.is_valid() && value.is_valid()); | 8277 ASSERT(result.is_valid() && receiver.is_valid() && value.is_valid()); |
8278 | 8278 |
8279 // Cannot use r12 for receiver, because that changes | 8279 // r12 is now a reserved register, so it cannot be the receiver. |
8280 // the distance between a call and a fixup location, | 8280 // If it was, the distance to the fixup location would not be constant. |
8281 // due to a special encoding of r12 as r/m in a ModR/M byte. | 8281 ASSERT(!receiver.reg().is(r12)); |
8282 if (receiver.reg().is(r12)) { | |
8283 frame()->Spill(receiver.reg()); // It will be overwritten with result. | |
8284 // Swap receiver and value. | |
8285 __ movq(result.reg(), receiver.reg()); | |
8286 Result temp = receiver; | |
8287 receiver = result; | |
8288 result = temp; | |
8289 } | |
8290 | 8282 |
8291 // Check that the receiver is a heap object. | 8283 // Check that the receiver is a heap object. |
8292 Condition is_smi = masm()->CheckSmi(receiver.reg()); | 8284 Condition is_smi = masm()->CheckSmi(receiver.reg()); |
8293 slow.Branch(is_smi, &value, &receiver); | 8285 slow.Branch(is_smi, &value, &receiver); |
8294 | 8286 |
8295 // This is the map check instruction that will be patched. | 8287 // This is the map check instruction that will be patched. |
8296 // Initially use an invalid map to force a failure. The exact | 8288 // Initially use an invalid map to force a failure. The exact |
8297 // instruction sequence is important because we use the | 8289 // instruction sequence is important because we use the |
8298 // kOffsetToStoreInstruction constant for patching. We avoid using | 8290 // kOffsetToStoreInstruction constant for patching. We avoid using |
8299 // the __ macro for the following two instructions because it | 8291 // the __ macro for the following two instructions because it |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8837 } | 8829 } |
8838 | 8830 |
8839 #endif | 8831 #endif |
8840 | 8832 |
8841 | 8833 |
8842 #undef __ | 8834 #undef __ |
8843 | 8835 |
8844 } } // namespace v8::internal | 8836 } } // namespace v8::internal |
8845 | 8837 |
8846 #endif // V8_TARGET_ARCH_X64 | 8838 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |