OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 8053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8064 // Get the value and receiver from the stack. | 8064 // Get the value and receiver from the stack. |
8065 Result value = frame()->Pop(); | 8065 Result value = frame()->Pop(); |
8066 value.ToRegister(); | 8066 value.ToRegister(); |
8067 Result receiver = frame()->Pop(); | 8067 Result receiver = frame()->Pop(); |
8068 receiver.ToRegister(); | 8068 receiver.ToRegister(); |
8069 | 8069 |
8070 // Allocate result register. | 8070 // Allocate result register. |
8071 result = allocator()->Allocate(); | 8071 result = allocator()->Allocate(); |
8072 ASSERT(result.is_valid() && receiver.is_valid() && value.is_valid()); | 8072 ASSERT(result.is_valid() && receiver.is_valid() && value.is_valid()); |
8073 | 8073 |
| 8074 // Cannot use r12 for receiver, because that changes |
| 8075 // the distance between a call and a fixup location, |
| 8076 // due to a special encoding of r12 as r/m in a ModR/M byte. |
| 8077 if (receiver.reg().is(r12)) { |
| 8078 frame()->Spill(receiver.reg()); // It will be overwritten with result. |
| 8079 // Swap receiver and value. |
| 8080 __ movq(result.reg(), receiver.reg()); |
| 8081 Result temp = receiver; |
| 8082 receiver = result; |
| 8083 result = temp; |
| 8084 } |
| 8085 |
8074 // Check that the receiver is a heap object. | 8086 // Check that the receiver is a heap object. |
8075 Condition is_smi = __ CheckSmi(receiver.reg()); | 8087 Condition is_smi = __ CheckSmi(receiver.reg()); |
8076 slow.Branch(is_smi, &value, &receiver); | 8088 slow.Branch(is_smi, &value, &receiver); |
8077 | 8089 |
8078 // This is the map check instruction that will be patched. | 8090 // This is the map check instruction that will be patched. |
8079 // Initially use an invalid map to force a failure. The exact | 8091 // Initially use an invalid map to force a failure. The exact |
8080 // instruction sequence is important because we use the | 8092 // instruction sequence is important because we use the |
8081 // kOffsetToStoreInstruction constant for patching. We avoid using | 8093 // kOffsetToStoreInstruction constant for patching. We avoid using |
8082 // the __ macro for the following two instructions because it | 8094 // the __ macro for the following two instructions because it |
8083 // might introduce extra instructions. | 8095 // might introduce extra instructions. |
(...skipping 4439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12523 #undef __ | 12535 #undef __ |
12524 | 12536 |
12525 void RecordWriteStub::Generate(MacroAssembler* masm) { | 12537 void RecordWriteStub::Generate(MacroAssembler* masm) { |
12526 masm->RecordWriteHelper(object_, addr_, scratch_); | 12538 masm->RecordWriteHelper(object_, addr_, scratch_); |
12527 masm->ret(0); | 12539 masm->ret(0); |
12528 } | 12540 } |
12529 | 12541 |
12530 } } // namespace v8::internal | 12542 } } // namespace v8::internal |
12531 | 12543 |
12532 #endif // V8_TARGET_ARCH_X64 | 12544 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |