// codegen-ia32.cc / codegen-arm.cc
DEFINE_bool(trace, false, "trace function calls")
DEFINE_bool(defer_negation, true, "defer negation operation")
+DEFINE_bool(mask_constants_with_cookie,
+ true,
+ "use random jit cookie to mask large constants")
// codegen.cc
DEFINE_bool(lazy, true, "use lazy compilation")
in_safe_int32_mode_(false),
safe_int32_mode_enabled_(true),
function_return_is_shadowed_(false),
- in_spilled_code_(false) {
+ in_spilled_code_(false),
+ jit_cookie_((FLAG_mask_constants_with_cookie) ? V8::Random() : 0) {
}
void CodeGenerator::PushUnsafeSmi(Handle<Object> value) {
ASSERT(value->IsSmi());
int bits = reinterpret_cast<int>(*value);
- __ push(Immediate(bits & 0x0000FFFF));
- __ or_(Operand(esp, 0), Immediate(bits & 0xFFFF0000));
+ __ push(Immediate(bits ^ jit_cookie_));
+ __ xor_(Operand(esp, 0), Immediate(jit_cookie_));
}
void CodeGenerator::StoreUnsafeSmiToLocal(int offset, Handle<Object> value) {
ASSERT(value->IsSmi());
int bits = reinterpret_cast<int>(*value);
- __ mov(Operand(ebp, offset), Immediate(bits & 0x0000FFFF));
- __ or_(Operand(ebp, offset), Immediate(bits & 0xFFFF0000));
+ __ mov(Operand(ebp, offset), Immediate(bits ^ jit_cookie_));
+ __ xor_(Operand(ebp, offset), Immediate(jit_cookie_));
}
ASSERT(target.is_valid());
ASSERT(value->IsSmi());
int bits = reinterpret_cast<int>(*value);
- __ Set(target, Immediate(bits & 0x0000FFFF));
- __ or_(target, bits & 0xFFFF0000);
+ __ Set(target, Immediate(bits ^ jit_cookie_));
+ __ xor_(target, jit_cookie_);
}