Index: src/x64/ic-x64.cc |
diff --git a/src/x64/ic-x64.cc b/src/x64/ic-x64.cc |
index 0632ce439f3c2c91171dc70380e52b1893c9330d..6ba5fb6e2ce0ab10b01612f86a50dd5fa51e9843 100644 |
--- a/src/x64/ic-x64.cc |
+++ b/src/x64/ic-x64.cc |
@@ -1741,11 +1741,11 @@ void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { |
// Activate inlined smi code. |
if (previous_state == UNINITIALIZED) { |
- PatchInlinedSmiCode(address()); |
+ PatchInlinedSmiCode(address(), ENABLE_INLINED_SMI_CHECK); |
} |
} |
-void PatchInlinedSmiCode(Address address) { |
+void PatchInlinedSmiCode(Address address, InlinedSmiCheck check) { |
// The address of the instruction following the call. |
Address test_instruction_address = |
address + Assembler::kCallTargetAddressOffset; |
@@ -1766,14 +1766,18 @@ void PatchInlinedSmiCode(Address address) { |
address, test_instruction_address, delta); |
} |
- // Patch with a short conditional jump. There must be a |
- // short jump-if-carry/not-carry at this position. |
+ // Patch with a short conditional jump. Enabling means switching from a short |
+ // jump-if-carry/not-carry to jump-if-zero/not-zero, whereas disabling is the |
+ // reverse operation of that. |
Address jmp_address = test_instruction_address - delta; |
- ASSERT(*jmp_address == Assembler::kJncShortOpcode || |
- *jmp_address == Assembler::kJcShortOpcode); |
- Condition cc = *jmp_address == Assembler::kJncShortOpcode |
- ? not_zero |
- : zero; |
+ ASSERT((check == ENABLE_INLINED_SMI_CHECK) |
+ ? (*jmp_address == Assembler::kJncShortOpcode || |
+ *jmp_address == Assembler::kJcShortOpcode) |
+ : (*jmp_address == Assembler::kJnzShortOpcode || |
+ *jmp_address == Assembler::kJzShortOpcode)); |
+ Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
+ ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
+ : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
*jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
} |