Commit 41ea0372 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[ia32,root] DoubleToI, MathPow, InterruptCheck, StackCheck

This also adds checks that ebx contains the root pointer during indirect load.
And we work around a few spots where we create an ebx Register but do not
actually reference it (e.g. when emitting xmm3, which has the same code as
ebx).

Bug: v8:6666
Change-Id: I7ec9e644c2e9c59d6395a71c6c5f479fac711d8d
Reviewed-on: https://chromium-review.googlesource.com/1231093
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56037}
parent 72ee72aa
......@@ -24,10 +24,16 @@ using TNode = compiler::TNode<T>;
// Interrupt and stack checks.
void Builtins::Generate_InterruptCheck(MacroAssembler* masm) {
#ifdef V8_TARGET_ARCH_IA32
Assembler::SupportsRootRegisterScope supports_root_register(masm);
#endif
masm->TailCallRuntime(Runtime::kInterrupt);
}
void Builtins::Generate_StackCheck(MacroAssembler* masm) {
#ifdef V8_TARGET_ARCH_IA32
Assembler::SupportsRootRegisterScope supports_root_register(masm);
#endif
masm->TailCallRuntime(Runtime::kStackGuard);
}
......
......@@ -2621,6 +2621,8 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
}
void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
Assembler::SupportsRootRegisterScope supports_root_register(masm);
Label check_negative, process_64_bits, done;
// Account for return address and saved regs.
......@@ -2634,6 +2636,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
MemOperand return_operand = mantissa_operand;
Register scratch1 = ebx;
Assembler::AllowExplicitEbxAccessScope root_is_spilled(masm);
// Since we must use ecx for shifts below, use some other register (eax)
// to calculate the result.
......@@ -2714,6 +2717,8 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
}
void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
Assembler::SupportsRootRegisterScope supports_root_register(masm);
const Register exponent = eax;
const Register scratch = ecx;
const XMMRegister double_result = xmm3;
......
......@@ -1876,6 +1876,7 @@ void Assembler::fld_d(Operand adr) {
}
void Assembler::fstp_s(Operand adr) {
AllowExplicitEbxAccessScope register_used_for_regcode(this);
EnsureSpace ensure_space(this);
EMIT(0xD9);
emit_operand(ebx, adr);
......@@ -1888,6 +1889,7 @@ void Assembler::fst_s(Operand adr) {
}
void Assembler::fstp_d(Operand adr) {
AllowExplicitEbxAccessScope register_used_for_regcode(this);
EnsureSpace ensure_space(this);
EMIT(0xDD);
emit_operand(ebx, adr);
......@@ -1912,6 +1914,7 @@ void Assembler::fild_d(Operand adr) {
}
void Assembler::fistp_s(Operand adr) {
AllowExplicitEbxAccessScope register_used_for_regcode(this);
EnsureSpace ensure_space(this);
EMIT(0xDB);
emit_operand(ebx, adr);
......@@ -3180,6 +3183,7 @@ void Assembler::vinstr(byte op, XMMRegister dst, XMMRegister src1, Operand src2,
}
void Assembler::emit_sse_operand(XMMRegister reg, Operand adr) {
AllowExplicitEbxAccessScope accessing_xmm_register(this);
Register ireg = Register::from_code(reg.code());
emit_operand(ireg, adr);
}
......
......@@ -114,6 +114,7 @@ void MacroAssembler::PushRoot(Heap::RootListIndex index) {
void TurboAssembler::LoadFromConstantsTable(Register destination,
int constant_index) {
DCHECK(!is_ebx_addressable_);
DCHECK(isolate()->heap()->RootCanBeTreatedAsConstant(
Heap::kBuiltinsConstantsTableRootIndex));
// TODO(jgruber): LoadRoot should be a register-relative load once we have
......@@ -126,6 +127,7 @@ void TurboAssembler::LoadFromConstantsTable(Register destination,
void TurboAssembler::LoadRootRegisterOffset(Register destination,
intptr_t offset) {
DCHECK(!is_ebx_addressable_);
DCHECK(is_int32(offset));
// TODO(jgruber): Register-relative load once kRootRegister exists.
mov(destination, Immediate(ExternalReference::roots_array_start(isolate())));
......@@ -135,6 +137,7 @@ void TurboAssembler::LoadRootRegisterOffset(Register destination,
}
void TurboAssembler::LoadRootRelative(Register destination, int32_t offset) {
DCHECK(!is_ebx_addressable_);
// TODO(jgruber): Register-relative load once kRootRegister exists.
LoadRootRegisterOffset(destination, offset);
mov(destination, Operand(destination, 0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment