Index: src/ia32/ic-ia32.cc |
diff --git a/src/ia32/ic-ia32.cc b/src/ia32/ic-ia32.cc |
index 33f247a349e0641b60c57bb56c67f80ed831d6aa..3a7ba4c9a793ff0f2d89bcb59ec26d38ed2712e0 100644 |
--- a/src/ia32/ic-ia32.cc |
+++ b/src/ia32/ic-ia32.cc |
@@ -1735,12 +1735,12 @@ 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; |
@@ -1761,14 +1761,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); |
} |