Commit 634a29a0 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[cleanup][ia32] Fix kPointerSize in ia32 builtins

Bug: v8:8477, v8:8834
Change-Id: If613bc4a32cdce68d9bcf747bf0bf528e3c2a90c
Reviewed-on: https://chromium-review.googlesource.com/c/1473290Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59620}
parent b3e0efc7
This diff is collapsed.
...@@ -4012,7 +4012,7 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) { ...@@ -4012,7 +4012,7 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
Label* const table = AddJumpTable(cases, case_count); Label* const table = AddJumpTable(cases, case_count);
__ cmp(input, Immediate(case_count)); __ cmp(input, Immediate(case_count));
__ j(above_equal, GetLabel(i.InputRpo(1))); __ j(above_equal, GetLabel(i.InputRpo(1)));
__ jmp(Operand::JumpTable(input, times_4, table)); __ jmp(Operand::JumpTable(input, times_system_pointer_size, table));
} }
// The calling convention for JSFunctions on IA32 passes arguments on the // The calling convention for JSFunctions on IA32 passes arguments on the
...@@ -4307,7 +4307,8 @@ void CodeGenerator::AssembleReturn(InstructionOperand* pop) { ...@@ -4307,7 +4307,8 @@ void CodeGenerator::AssembleReturn(InstructionOperand* pop) {
Register pop_reg = g.ToRegister(pop); Register pop_reg = g.ToRegister(pop);
Register scratch_reg = pop_reg == ecx ? edx : ecx; Register scratch_reg = pop_reg == ecx ? edx : ecx;
__ pop(scratch_reg); __ pop(scratch_reg);
__ lea(esp, Operand(esp, pop_reg, times_4, static_cast<int>(pop_size))); __ lea(esp, Operand(esp, pop_reg, times_system_pointer_size,
static_cast<int>(pop_size)));
__ jmp(scratch_reg); __ jmp(scratch_reg);
} }
} }
......
...@@ -204,9 +204,11 @@ enum ScaleFactor { ...@@ -204,9 +204,11 @@ enum ScaleFactor {
times_4 = 2, times_4 = 2,
times_8 = 3, times_8 = 3,
times_int_size = times_4, times_int_size = times_4,
times_half_pointer_size = times_2,
times_pointer_size = times_4, times_half_system_pointer_size = times_2,
times_twice_pointer_size = times_8 times_system_pointer_size = times_4,
times_tagged_size = times_4,
}; };
class V8_EXPORT_PRIVATE Operand { class V8_EXPORT_PRIVATE Operand {
...@@ -298,7 +300,7 @@ class V8_EXPORT_PRIVATE Operand { ...@@ -298,7 +300,7 @@ class V8_EXPORT_PRIVATE Operand {
friend class Assembler; friend class Assembler;
}; };
ASSERT_TRIVIALLY_COPYABLE(Operand); ASSERT_TRIVIALLY_COPYABLE(Operand);
static_assert(sizeof(Operand) <= 2 * kPointerSize, static_assert(sizeof(Operand) <= 2 * kSystemPointerSize,
"Operand must be small enough to pass it by value"); "Operand must be small enough to pass it by value");
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -417,11 +419,11 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { ...@@ -417,11 +419,11 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
Address pc, Address target, Address pc, Address target,
RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE); RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
static constexpr int kSpecialTargetSize = kPointerSize; static constexpr int kSpecialTargetSize = kSystemPointerSize;
// Distance between the address of the code target in the call instruction // Distance between the address of the code target in the call instruction
// and the return address // and the return address
static constexpr int kCallTargetAddressOffset = kPointerSize; static constexpr int kCallTargetAddressOffset = kSystemPointerSize;
// One byte opcode for test al, 0xXX. // One byte opcode for test al, 0xXX.
static constexpr byte kTestAlByte = 0xA8; static constexpr byte kTestAlByte = 0xA8;
......
...@@ -33,7 +33,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -33,7 +33,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ movsd(Operand(esp, offset), xmm_reg); __ movsd(Operand(esp, offset), xmm_reg);
} }
STATIC_ASSERT(kFloatSize == kPointerSize); STATIC_ASSERT(kFloatSize == kSystemPointerSize);
const int kFloatRegsSize = kFloatSize * XMMRegister::kNumRegisters; const int kFloatRegsSize = kFloatSize * XMMRegister::kNumRegisters;
__ sub(esp, Immediate(kFloatRegsSize)); __ sub(esp, Immediate(kFloatRegsSize));
for (int i = 0; i < config->num_allocatable_float_registers(); ++i) { for (int i = 0; i < config->num_allocatable_float_registers(); ++i) {
...@@ -49,15 +49,15 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -49,15 +49,15 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
ExternalReference::Create(IsolateAddressId::kCEntryFPAddress, isolate); ExternalReference::Create(IsolateAddressId::kCEntryFPAddress, isolate);
__ mov(masm->ExternalReferenceAsOperand(c_entry_fp_address, esi), ebp); __ mov(masm->ExternalReferenceAsOperand(c_entry_fp_address, esi), ebp);
const int kSavedRegistersAreaSize = const int kSavedRegistersAreaSize = kNumberOfRegisters * kSystemPointerSize +
kNumberOfRegisters * kPointerSize + kDoubleRegsSize + kFloatRegsSize; kDoubleRegsSize + kFloatRegsSize;
// The bailout id is passed in ebx by the caller. // The bailout id is passed in ebx by the caller.
// Get the address of the location in the code object // Get the address of the location in the code object
// and compute the fp-to-sp delta in register edx. // and compute the fp-to-sp delta in register edx.
__ mov(ecx, Operand(esp, kSavedRegistersAreaSize)); __ mov(ecx, Operand(esp, kSavedRegistersAreaSize));
__ lea(edx, Operand(esp, kSavedRegistersAreaSize + 1 * kPointerSize)); __ lea(edx, Operand(esp, kSavedRegistersAreaSize + 1 * kSystemPointerSize));
__ sub(edx, ebp); __ sub(edx, ebp);
__ neg(edx); __ neg(edx);
...@@ -70,13 +70,13 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -70,13 +70,13 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ JumpIfSmi(edi, &context_check); __ JumpIfSmi(edi, &context_check);
__ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
__ bind(&context_check); __ bind(&context_check);
__ mov(Operand(esp, 0 * kPointerSize), eax); // Function. __ mov(Operand(esp, 0 * kSystemPointerSize), eax); // Function.
__ mov(Operand(esp, 1 * kPointerSize), __ mov(Operand(esp, 1 * kSystemPointerSize),
Immediate(static_cast<int>(deopt_kind))); Immediate(static_cast<int>(deopt_kind)));
__ mov(Operand(esp, 2 * kPointerSize), ebx); // Bailout id. __ mov(Operand(esp, 2 * kSystemPointerSize), ebx); // Bailout id.
__ mov(Operand(esp, 3 * kPointerSize), ecx); // Code address or 0. __ mov(Operand(esp, 3 * kSystemPointerSize), ecx); // Code address or 0.
__ mov(Operand(esp, 4 * kPointerSize), edx); // Fp-to-sp delta. __ mov(Operand(esp, 4 * kSystemPointerSize), edx); // Fp-to-sp delta.
__ mov(Operand(esp, 5 * kPointerSize), __ mov(Operand(esp, 5 * kSystemPointerSize),
Immediate(ExternalReference::isolate_address(isolate))); Immediate(ExternalReference::isolate_address(isolate)));
{ {
AllowExternalCallThatCantCauseGC scope(masm); AllowExternalCallThatCantCauseGC scope(masm);
...@@ -89,7 +89,8 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -89,7 +89,8 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
// Fill in the input registers. // Fill in the input registers.
for (int i = kNumberOfRegisters - 1; i >= 0; i--) { for (int i = kNumberOfRegisters - 1; i >= 0; i--) {
int offset = (i * kPointerSize) + FrameDescription::registers_offset(); int offset =
(i * kSystemPointerSize) + FrameDescription::registers_offset();
__ pop(Operand(esi, offset)); __ pop(Operand(esi, offset));
} }
...@@ -116,7 +117,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -116,7 +117,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ fnclex(); __ fnclex();
// Remove the return address and the double registers. // Remove the return address and the double registers.
__ add(esp, Immediate(kDoubleRegsSize + 1 * kPointerSize)); __ add(esp, Immediate(kDoubleRegsSize + 1 * kSystemPointerSize));
// Compute a pointer to the unwinding limit in register ecx; that is // Compute a pointer to the unwinding limit in register ecx; that is
// the first stack slot not part of the input frame. // the first stack slot not part of the input frame.
...@@ -140,7 +141,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -140,7 +141,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
// Compute the output frame in the deoptimizer. // Compute the output frame in the deoptimizer.
__ push(eax); __ push(eax);
__ PrepareCallCFunction(1, esi); __ PrepareCallCFunction(1, esi);
__ mov(Operand(esp, 0 * kPointerSize), eax); __ mov(Operand(esp, 0 * kSystemPointerSize), eax);
{ {
AllowExternalCallThatCantCauseGC scope(masm); AllowExternalCallThatCantCauseGC scope(masm);
__ CallCFunction(ExternalReference::compute_output_frames_function(), 1); __ CallCFunction(ExternalReference::compute_output_frames_function(), 1);
...@@ -156,7 +157,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -156,7 +157,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
// past the last FrameDescription**. // past the last FrameDescription**.
__ mov(edx, Operand(eax, Deoptimizer::output_count_offset())); __ mov(edx, Operand(eax, Deoptimizer::output_count_offset()));
__ mov(eax, Operand(eax, Deoptimizer::output_offset())); __ mov(eax, Operand(eax, Deoptimizer::output_offset()));
__ lea(edx, Operand(eax, edx, times_4, 0)); __ lea(edx, Operand(eax, edx, times_system_pointer_size, 0));
__ jmp(&outer_loop_header); __ jmp(&outer_loop_header);
__ bind(&outer_push_loop); __ bind(&outer_push_loop);
// Inner loop state: esi = current FrameDescription*, ecx = loop // Inner loop state: esi = current FrameDescription*, ecx = loop
...@@ -170,7 +171,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -170,7 +171,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ bind(&inner_loop_header); __ bind(&inner_loop_header);
__ test(ecx, ecx); __ test(ecx, ecx);
__ j(not_zero, &inner_push_loop); __ j(not_zero, &inner_push_loop);
__ add(eax, Immediate(kPointerSize)); __ add(eax, Immediate(kSystemPointerSize));
__ bind(&outer_loop_header); __ bind(&outer_loop_header);
__ cmp(eax, edx); __ cmp(eax, edx);
__ j(below, &outer_push_loop); __ j(below, &outer_push_loop);
...@@ -189,7 +190,8 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -189,7 +190,8 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
// Push the registers from the last output frame. // Push the registers from the last output frame.
for (int i = 0; i < kNumberOfRegisters; i++) { for (int i = 0; i < kNumberOfRegisters; i++) {
int offset = (i * kPointerSize) + FrameDescription::registers_offset(); int offset =
(i * kSystemPointerSize) + FrameDescription::registers_offset();
__ push(Operand(esi, offset)); __ push(Operand(esi, offset));
} }
......
...@@ -15,21 +15,21 @@ class EntryFrameConstants : public AllStatic { ...@@ -15,21 +15,21 @@ class EntryFrameConstants : public AllStatic {
public: public:
// This is the offset to where JSEntry pushes the current value of // This is the offset to where JSEntry pushes the current value of
// Isolate::c_entry_fp onto the stack. // Isolate::c_entry_fp onto the stack.
static constexpr int kCallerFPOffset = -6 * kPointerSize; static constexpr int kCallerFPOffset = -6 * kSystemPointerSize;
// EntryFrame is used by JSEntry, JSConstructEntry and JSRunMicrotasksEntry. // EntryFrame is used by JSEntry, JSConstructEntry and JSRunMicrotasksEntry.
// All of them take |root_register_value| as the first parameter. // All of them take |root_register_value| as the first parameter.
static constexpr int kRootRegisterValueOffset = +2 * kPointerSize; static constexpr int kRootRegisterValueOffset = +2 * kSystemPointerSize;
// Rest of parameters passed to JSEntry and JSConstructEntry. // Rest of parameters passed to JSEntry and JSConstructEntry.
static constexpr int kNewTargetArgOffset = +3 * kPointerSize; static constexpr int kNewTargetArgOffset = +3 * kSystemPointerSize;
static constexpr int kFunctionArgOffset = +4 * kPointerSize; static constexpr int kFunctionArgOffset = +4 * kSystemPointerSize;
static constexpr int kReceiverArgOffset = +5 * kPointerSize; static constexpr int kReceiverArgOffset = +5 * kSystemPointerSize;
static constexpr int kArgcOffset = +6 * kPointerSize; static constexpr int kArgcOffset = +6 * kSystemPointerSize;
static constexpr int kArgvOffset = +7 * kPointerSize; static constexpr int kArgvOffset = +7 * kSystemPointerSize;
// Rest of parameters passed to JSRunMicrotasksEntry. // Rest of parameters passed to JSRunMicrotasksEntry.
static constexpr int kMicrotaskQueueArgOffset = +3 * kPointerSize; static constexpr int kMicrotaskQueueArgOffset = +3 * kSystemPointerSize;
}; };
class ExitFrameConstants : public TypedFrameConstants { class ExitFrameConstants : public TypedFrameConstants {
...@@ -38,12 +38,12 @@ class ExitFrameConstants : public TypedFrameConstants { ...@@ -38,12 +38,12 @@ class ExitFrameConstants : public TypedFrameConstants {
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1); static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2); DEFINE_TYPED_FRAME_SIZES(2);
static constexpr int kCallerFPOffset = 0 * kPointerSize; static constexpr int kCallerFPOffset = 0 * kSystemPointerSize;
static constexpr int kCallerPCOffset = +1 * kPointerSize; static constexpr int kCallerPCOffset = +1 * kSystemPointerSize;
// FP-relative displacement of the caller's SP. It points just // FP-relative displacement of the caller's SP. It points just
// below the saved PC. // below the saved PC.
static constexpr int kCallerSPDisplacement = +2 * kPointerSize; static constexpr int kCallerSPDisplacement = +2 * kSystemPointerSize;
static constexpr int kConstantPoolOffset = 0; // Not used static constexpr int kConstantPoolOffset = 0; // Not used
}; };
...@@ -57,7 +57,7 @@ class WasmCompileLazyFrameConstants : public TypedFrameConstants { ...@@ -57,7 +57,7 @@ class WasmCompileLazyFrameConstants : public TypedFrameConstants {
static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0); static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kFixedFrameSizeFromFp = static constexpr int kFixedFrameSizeFromFp =
TypedFrameConstants::kFixedFrameSizeFromFp + TypedFrameConstants::kFixedFrameSizeFromFp +
kNumberOfSavedGpParamRegs * kPointerSize + kNumberOfSavedGpParamRegs * kSystemPointerSize +
kNumberOfSavedFpParamRegs * kSimd128Size; kNumberOfSavedFpParamRegs * kSimd128Size;
}; };
...@@ -66,13 +66,13 @@ class JavaScriptFrameConstants : public AllStatic { ...@@ -66,13 +66,13 @@ class JavaScriptFrameConstants : public AllStatic {
// FP-relative. // FP-relative.
static constexpr int kLocal0Offset = static constexpr int kLocal0Offset =
StandardFrameConstants::kExpressionsOffset; StandardFrameConstants::kExpressionsOffset;
static constexpr int kLastParameterOffset = +2 * kPointerSize; static constexpr int kLastParameterOffset = +2 * kSystemPointerSize;
static constexpr int kFunctionOffset = static constexpr int kFunctionOffset =
StandardFrameConstants::kFunctionOffset; StandardFrameConstants::kFunctionOffset;
// Caller SP-relative. // Caller SP-relative.
static constexpr int kParam0Offset = -2 * kPointerSize; static constexpr int kParam0Offset = -2 * kSystemPointerSize;
static constexpr int kReceiverOffset = -1 * kPointerSize; static constexpr int kReceiverOffset = -1 * kSystemPointerSize;
}; };
} // namespace internal } // namespace internal
......
This diff is collapsed.
...@@ -708,18 +708,12 @@ inline Operand FieldOperand(Register object, Register index, ScaleFactor scale, ...@@ -708,18 +708,12 @@ inline Operand FieldOperand(Register object, Register index, ScaleFactor scale,
return Operand(object, index, scale, offset - kHeapObjectTag); return Operand(object, index, scale, offset - kHeapObjectTag);
} }
inline Operand FixedArrayElementOperand(Register array, Register index_as_smi,
int additional_offset = 0) {
int offset = FixedArray::kHeaderSize + additional_offset * kPointerSize;
return FieldOperand(array, index_as_smi, times_half_pointer_size, offset);
}
inline Operand ContextOperand(Register context, int index) { inline Operand ContextOperand(Register context, int index) {
return Operand(context, Context::SlotOffset(index)); return Operand(context, Context::SlotOffset(index));
} }
inline Operand ContextOperand(Register context, Register index) { inline Operand ContextOperand(Register context, Register index) {
return Operand(context, index, times_pointer_size, Context::SlotOffset(0)); return Operand(context, index, times_tagged_size, Context::SlotOffset(0));
} }
inline Operand NativeContextOperand() { inline Operand NativeContextOperand() {
......
...@@ -187,7 +187,7 @@ void RegExpMacroAssemblerIA32::CheckGreedyLoop(Label* on_equal) { ...@@ -187,7 +187,7 @@ void RegExpMacroAssemblerIA32::CheckGreedyLoop(Label* on_equal) {
Label fallthrough; Label fallthrough;
__ cmp(edi, Operand(backtrack_stackpointer(), 0)); __ cmp(edi, Operand(backtrack_stackpointer(), 0));
__ j(not_equal, &fallthrough); __ j(not_equal, &fallthrough);
__ add(backtrack_stackpointer(), Immediate(kPointerSize)); // Pop. __ add(backtrack_stackpointer(), Immediate(kSystemPointerSize)); // Pop.
BranchOrBacktrack(no_condition, on_equal); BranchOrBacktrack(no_condition, on_equal);
__ bind(&fallthrough); __ bind(&fallthrough);
} }
...@@ -278,7 +278,7 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase( ...@@ -278,7 +278,7 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase(
// Restore original value before continuing. // Restore original value before continuing.
__ pop(backtrack_stackpointer()); __ pop(backtrack_stackpointer());
// Drop original value of character position. // Drop original value of character position.
__ add(esp, Immediate(kPointerSize)); __ add(esp, Immediate(kSystemPointerSize));
// Compute new value of character position after the matched part. // Compute new value of character position after the matched part.
__ sub(edi, esi); __ sub(edi, esi);
if (read_backward) { if (read_backward) {
...@@ -306,15 +306,15 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase( ...@@ -306,15 +306,15 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase(
// Set isolate. // Set isolate.
#ifdef V8_INTL_SUPPORT #ifdef V8_INTL_SUPPORT
if (unicode) { if (unicode) {
__ mov(Operand(esp, 3 * kPointerSize), Immediate(0)); __ mov(Operand(esp, 3 * kSystemPointerSize), Immediate(0));
} else // NOLINT } else // NOLINT
#endif // V8_INTL_SUPPORT #endif // V8_INTL_SUPPORT
{ {
__ mov(Operand(esp, 3 * kPointerSize), __ mov(Operand(esp, 3 * kSystemPointerSize),
Immediate(ExternalReference::isolate_address(isolate()))); Immediate(ExternalReference::isolate_address(isolate())));
} }
// Set byte_length. // Set byte_length.
__ mov(Operand(esp, 2 * kPointerSize), ebx); __ mov(Operand(esp, 2 * kSystemPointerSize), ebx);
// Set byte_offset2. // Set byte_offset2.
// Found by adding negative string-end offset of current position (edi) // Found by adding negative string-end offset of current position (edi)
// to end of string. // to end of string.
...@@ -322,11 +322,11 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase( ...@@ -322,11 +322,11 @@ void RegExpMacroAssemblerIA32::CheckNotBackReferenceIgnoreCase(
if (read_backward) { if (read_backward) {
__ sub(edi, ebx); // Offset by length when matching backwards. __ sub(edi, ebx); // Offset by length when matching backwards.
} }
__ mov(Operand(esp, 1 * kPointerSize), edi); __ mov(Operand(esp, 1 * kSystemPointerSize), edi);
// Set byte_offset1. // Set byte_offset1.
// Start of capture, where edx already holds string-end negative offset. // Start of capture, where edx already holds string-end negative offset.
__ add(edx, esi); __ add(edx, esi);
__ mov(Operand(esp, 0 * kPointerSize), edx); __ mov(Operand(esp, 0 * kSystemPointerSize), edx);
{ {
AllowExternalCallThatCantCauseGC scope(masm_); AllowExternalCallThatCantCauseGC scope(masm_);
...@@ -691,7 +691,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { ...@@ -691,7 +691,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
__ j(below_equal, &stack_limit_hit); __ j(below_equal, &stack_limit_hit);
// Check if there is room for the variable number of registers above // Check if there is room for the variable number of registers above
// the stack limit. // the stack limit.
__ cmp(ecx, num_registers_ * kPointerSize); __ cmp(ecx, num_registers_ * kSystemPointerSize);
__ j(above_equal, &stack_ok); __ j(above_equal, &stack_ok);
// Exit with OutOfMemory exception. There is not enough space on the stack // Exit with OutOfMemory exception. There is not enough space on the stack
// for our working registers. // for our working registers.
...@@ -709,7 +709,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { ...@@ -709,7 +709,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
__ mov(ebx, Operand(ebp, kStartIndex)); __ mov(ebx, Operand(ebp, kStartIndex));
// Allocate space on stack for registers. // Allocate space on stack for registers.
__ sub(esp, Immediate(num_registers_ * kPointerSize)); __ sub(esp, Immediate(num_registers_ * kSystemPointerSize));
// Load string length. // Load string length.
__ mov(esi, Operand(ebp, kInputEnd)); __ mov(esi, Operand(ebp, kInputEnd));
// Load input position. // Load input position.
...@@ -733,7 +733,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { ...@@ -733,7 +733,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
// Ensure that we write to each stack page, in order. Skipping a page // Ensure that we write to each stack page, in order. Skipping a page
// on Windows can cause segmentation faults. Assuming page size is 4k. // on Windows can cause segmentation faults. Assuming page size is 4k.
const int kPageSize = 4096; const int kPageSize = 4096;
const int kRegistersPerPage = kPageSize / kPointerSize; const int kRegistersPerPage = kPageSize / kSystemPointerSize;
for (int i = num_saved_registers_ + kRegistersPerPage - 1; for (int i = num_saved_registers_ + kRegistersPerPage - 1;
i < num_registers_; i < num_registers_;
i += kRegistersPerPage) { i += kRegistersPerPage) {
...@@ -764,8 +764,8 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { ...@@ -764,8 +764,8 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
Label init_loop; Label init_loop;
__ bind(&init_loop); __ bind(&init_loop);
__ mov(Operand(ebp, ecx, times_1, 0), eax); __ mov(Operand(ebp, ecx, times_1, 0), eax);
__ sub(ecx, Immediate(kPointerSize)); __ sub(ecx, Immediate(kSystemPointerSize));
__ cmp(ecx, kRegisterZero - num_saved_registers_ * kPointerSize); __ cmp(ecx, kRegisterZero - num_saved_registers_ * kSystemPointerSize);
__ j(greater, &init_loop); __ j(greater, &init_loop);
} else { // Unroll the loop. } else { // Unroll the loop.
for (int i = 0; i < num_saved_registers_; i++) { for (int i = 0; i < num_saved_registers_; i++) {
...@@ -805,7 +805,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { ...@@ -805,7 +805,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
if (mode_ == UC16) { if (mode_ == UC16) {
__ sar(eax, 1); // Convert byte index to character index. __ sar(eax, 1); // Convert byte index to character index.
} }
__ mov(Operand(ebx, i * kPointerSize), eax); __ mov(Operand(ebx, i * kSystemPointerSize), eax);
} }
} }
...@@ -824,7 +824,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { ...@@ -824,7 +824,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
__ mov(Operand(ebp, kNumOutputRegisters), ecx); __ mov(Operand(ebp, kNumOutputRegisters), ecx);
// Advance the location for output. // Advance the location for output.
__ add(Operand(ebp, kRegisterOutput), __ add(Operand(ebp, kRegisterOutput),
Immediate(num_saved_registers_ * kPointerSize)); Immediate(num_saved_registers_ * kSystemPointerSize));
// Prepare eax to initialize registers with its value in the next run. // Prepare eax to initialize registers with its value in the next run.
__ mov(eax, Operand(ebp, kStringStartMinusOne)); __ mov(eax, Operand(ebp, kStringStartMinusOne));
...@@ -911,11 +911,11 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { ...@@ -911,11 +911,11 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
// Call GrowStack(backtrack_stackpointer()) // Call GrowStack(backtrack_stackpointer())
static const int num_arguments = 3; static const int num_arguments = 3;
__ PrepareCallCFunction(num_arguments, ebx); __ PrepareCallCFunction(num_arguments, ebx);
__ mov(Operand(esp, 2 * kPointerSize), __ mov(Operand(esp, 2 * kSystemPointerSize),
Immediate(ExternalReference::isolate_address(isolate()))); Immediate(ExternalReference::isolate_address(isolate())));
__ lea(eax, Operand(ebp, kStackHighEnd)); __ lea(eax, Operand(ebp, kStackHighEnd));
__ mov(Operand(esp, 1 * kPointerSize), eax); __ mov(Operand(esp, 1 * kSystemPointerSize), eax);
__ mov(Operand(esp, 0 * kPointerSize), backtrack_stackpointer()); __ mov(Operand(esp, 0 * kSystemPointerSize), backtrack_stackpointer());
ExternalReference grow_stack = ExternalReference grow_stack =
ExternalReference::re_grow_stack(isolate()); ExternalReference::re_grow_stack(isolate());
__ CallCFunction(grow_stack, num_arguments); __ CallCFunction(grow_stack, num_arguments);
...@@ -1097,12 +1097,12 @@ void RegExpMacroAssemblerIA32::CallCheckStackGuardState(Register scratch) { ...@@ -1097,12 +1097,12 @@ void RegExpMacroAssemblerIA32::CallCheckStackGuardState(Register scratch) {
static const int num_arguments = 3; static const int num_arguments = 3;
__ PrepareCallCFunction(num_arguments, scratch); __ PrepareCallCFunction(num_arguments, scratch);
// RegExp code frame pointer. // RegExp code frame pointer.
__ mov(Operand(esp, 2 * kPointerSize), ebp); __ mov(Operand(esp, 2 * kSystemPointerSize), ebp);
// Code of self. // Code of self.
__ mov(Operand(esp, 1 * kPointerSize), Immediate(masm_->CodeObject())); __ mov(Operand(esp, 1 * kSystemPointerSize), Immediate(masm_->CodeObject()));
// Next address on the stack (will be address of return address). // Next address on the stack (will be address of return address).
__ lea(eax, Operand(esp, -kPointerSize)); __ lea(eax, Operand(esp, -kSystemPointerSize));
__ mov(Operand(esp, 0 * kPointerSize), eax); __ mov(Operand(esp, 0 * kSystemPointerSize), eax);
ExternalReference check_stack_guard = ExternalReference check_stack_guard =
ExternalReference::re_check_stack_guard_state(isolate()); ExternalReference::re_check_stack_guard_state(isolate());
__ CallCFunction(check_stack_guard, num_arguments); __ CallCFunction(check_stack_guard, num_arguments);
...@@ -1143,7 +1143,7 @@ Operand RegExpMacroAssemblerIA32::register_location(int register_index) { ...@@ -1143,7 +1143,7 @@ Operand RegExpMacroAssemblerIA32::register_location(int register_index) {
if (num_registers_ <= register_index) { if (num_registers_ <= register_index) {
num_registers_ = register_index + 1; num_registers_ = register_index + 1;
} }
return Operand(ebp, kRegisterZero - register_index * kPointerSize); return Operand(ebp, kRegisterZero - register_index * kSystemPointerSize);
} }
...@@ -1201,14 +1201,14 @@ void RegExpMacroAssemblerIA32::SafeCallTarget(Label* name) { ...@@ -1201,14 +1201,14 @@ void RegExpMacroAssemblerIA32::SafeCallTarget(Label* name) {
void RegExpMacroAssemblerIA32::Push(Register source) { void RegExpMacroAssemblerIA32::Push(Register source) {
DCHECK(source != backtrack_stackpointer()); DCHECK(source != backtrack_stackpointer());
// Notice: This updates flags, unlike normal Push. // Notice: This updates flags, unlike normal Push.
__ sub(backtrack_stackpointer(), Immediate(kPointerSize)); __ sub(backtrack_stackpointer(), Immediate(kSystemPointerSize));
__ mov(Operand(backtrack_stackpointer(), 0), source); __ mov(Operand(backtrack_stackpointer(), 0), source);
} }
void RegExpMacroAssemblerIA32::Push(Immediate value) { void RegExpMacroAssemblerIA32::Push(Immediate value) {
// Notice: This updates flags, unlike normal Push. // Notice: This updates flags, unlike normal Push.
__ sub(backtrack_stackpointer(), Immediate(kPointerSize)); __ sub(backtrack_stackpointer(), Immediate(kSystemPointerSize));
__ mov(Operand(backtrack_stackpointer(), 0), value); __ mov(Operand(backtrack_stackpointer(), 0), value);
} }
...@@ -1217,7 +1217,7 @@ void RegExpMacroAssemblerIA32::Pop(Register target) { ...@@ -1217,7 +1217,7 @@ void RegExpMacroAssemblerIA32::Pop(Register target) {
DCHECK(target != backtrack_stackpointer()); DCHECK(target != backtrack_stackpointer());
__ mov(target, Operand(backtrack_stackpointer(), 0)); __ mov(target, Operand(backtrack_stackpointer(), 0));
// Notice: This updates flags, unlike normal Pop. // Notice: This updates flags, unlike normal Pop.
__ add(backtrack_stackpointer(), Immediate(kPointerSize)); __ add(backtrack_stackpointer(), Immediate(kSystemPointerSize));
} }
......
...@@ -96,31 +96,32 @@ class RegExpMacroAssemblerIA32: public NativeRegExpMacroAssembler { ...@@ -96,31 +96,32 @@ class RegExpMacroAssemblerIA32: public NativeRegExpMacroAssembler {
// Offsets from ebp of function parameters and stored registers. // Offsets from ebp of function parameters and stored registers.
static const int kFramePointer = 0; static const int kFramePointer = 0;
// Above the frame pointer - function parameters and return address. // Above the frame pointer - function parameters and return address.
static const int kReturn_eip = kFramePointer + kPointerSize; static const int kReturn_eip = kFramePointer + kSystemPointerSize;
static const int kFrameAlign = kReturn_eip + kPointerSize; static const int kFrameAlign = kReturn_eip + kSystemPointerSize;
// Parameters. // Parameters.
static const int kInputString = kFrameAlign; static const int kInputString = kFrameAlign;
static const int kStartIndex = kInputString + kPointerSize; static const int kStartIndex = kInputString + kSystemPointerSize;
static const int kInputStart = kStartIndex + kPointerSize; static const int kInputStart = kStartIndex + kSystemPointerSize;
static const int kInputEnd = kInputStart + kPointerSize; static const int kInputEnd = kInputStart + kSystemPointerSize;
static const int kRegisterOutput = kInputEnd + kPointerSize; static const int kRegisterOutput = kInputEnd + kSystemPointerSize;
// For the case of global regular expression, we have room to store at least // For the case of global regular expression, we have room to store at least
// one set of capture results. For the case of non-global regexp, we ignore // one set of capture results. For the case of non-global regexp, we ignore
// this value. // this value.
static const int kNumOutputRegisters = kRegisterOutput + kPointerSize; static const int kNumOutputRegisters = kRegisterOutput + kSystemPointerSize;
static const int kStackHighEnd = kNumOutputRegisters + kPointerSize; static const int kStackHighEnd = kNumOutputRegisters + kSystemPointerSize;
static const int kDirectCall = kStackHighEnd + kPointerSize; static const int kDirectCall = kStackHighEnd + kSystemPointerSize;
static const int kIsolate = kDirectCall + kPointerSize; static const int kIsolate = kDirectCall + kSystemPointerSize;
// Below the frame pointer - local stack variables. // Below the frame pointer - local stack variables.
// When adding local variables remember to push space for them in // When adding local variables remember to push space for them in
// the frame in GetCode. // the frame in GetCode.
static const int kBackup_esi = kFramePointer - kPointerSize; static const int kBackup_esi = kFramePointer - kSystemPointerSize;
static const int kBackup_edi = kBackup_esi - kPointerSize; static const int kBackup_edi = kBackup_esi - kSystemPointerSize;
static const int kBackup_ebx = kBackup_edi - kPointerSize; static const int kBackup_ebx = kBackup_edi - kSystemPointerSize;
static const int kSuccessfulCaptures = kBackup_ebx - kPointerSize; static const int kSuccessfulCaptures = kBackup_ebx - kSystemPointerSize;
static const int kStringStartMinusOne = kSuccessfulCaptures - kPointerSize; static const int kStringStartMinusOne =
kSuccessfulCaptures - kSystemPointerSize;
// First register address. Following registers are below it on the stack. // First register address. Following registers are below it on the stack.
static const int kRegisterZero = kStringStartMinusOne - kPointerSize; static const int kRegisterZero = kStringStartMinusOne - kSystemPointerSize;
// Initial size of code buffer. // Initial size of code buffer.
static const int kRegExpCodeSize = 1024; static const int kRegExpCodeSize = 1024;
......
...@@ -250,8 +250,8 @@ TEST(AssemblerIa326) { ...@@ -250,8 +250,8 @@ TEST(AssemblerIa326) {
Assembler assm(AssemblerOptions{}, Assembler assm(AssemblerOptions{},
ExternalAssemblerBuffer(buffer, sizeof buffer)); ExternalAssemblerBuffer(buffer, sizeof buffer));
__ movsd(xmm0, Operand(esp, 1 * kPointerSize)); __ movsd(xmm0, Operand(esp, 1 * kSystemPointerSize));
__ movsd(xmm1, Operand(esp, 3 * kPointerSize)); __ movsd(xmm1, Operand(esp, 3 * kSystemPointerSize));
__ addsd(xmm0, xmm1); __ addsd(xmm0, xmm1);
__ mulsd(xmm0, xmm1); __ mulsd(xmm0, xmm1);
__ subsd(xmm0, xmm1); __ subsd(xmm0, xmm1);
...@@ -522,8 +522,8 @@ TEST(AssemblerIa32SSE) { ...@@ -522,8 +522,8 @@ TEST(AssemblerIa32SSE) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes, MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes,
ExternalAssemblerBuffer(buffer, sizeof(buffer))); ExternalAssemblerBuffer(buffer, sizeof(buffer)));
{ {
__ movss(xmm0, Operand(esp, kPointerSize)); __ movss(xmm0, Operand(esp, kSystemPointerSize));
__ movss(xmm1, Operand(esp, 2 * kPointerSize)); __ movss(xmm1, Operand(esp, 2 * kSystemPointerSize));
__ shufps(xmm0, xmm0, 0x0); __ shufps(xmm0, xmm0, 0x0);
__ shufps(xmm1, xmm1, 0x0); __ shufps(xmm1, xmm1, 0x0);
__ movaps(xmm2, xmm1); __ movaps(xmm2, xmm1);
...@@ -559,8 +559,8 @@ TEST(AssemblerIa32SSE3) { ...@@ -559,8 +559,8 @@ TEST(AssemblerIa32SSE3) {
ExternalAssemblerBuffer(buffer, sizeof(buffer))); ExternalAssemblerBuffer(buffer, sizeof(buffer)));
{ {
CpuFeatureScope fscope(&assm, SSE3); CpuFeatureScope fscope(&assm, SSE3);
__ movss(xmm0, Operand(esp, kPointerSize)); __ movss(xmm0, Operand(esp, kSystemPointerSize));
__ movss(xmm1, Operand(esp, 2 * kPointerSize)); __ movss(xmm1, Operand(esp, 2 * kSystemPointerSize));
__ shufps(xmm0, xmm0, 0x0); __ shufps(xmm0, xmm0, 0x0);
__ shufps(xmm1, xmm1, 0x0); __ shufps(xmm1, xmm1, 0x0);
__ haddps(xmm1, xmm0); __ haddps(xmm1, xmm0);
...@@ -594,9 +594,9 @@ TEST(AssemblerX64FMA_sd) { ...@@ -594,9 +594,9 @@ TEST(AssemblerX64FMA_sd) {
{ {
CpuFeatureScope fscope(&assm, FMA3); CpuFeatureScope fscope(&assm, FMA3);
Label exit; Label exit;
__ movsd(xmm0, Operand(esp, 1 * kPointerSize)); __ movsd(xmm0, Operand(esp, 1 * kSystemPointerSize));
__ movsd(xmm1, Operand(esp, 3 * kPointerSize)); __ movsd(xmm1, Operand(esp, 3 * kSystemPointerSize));
__ movsd(xmm2, Operand(esp, 5 * kPointerSize)); __ movsd(xmm2, Operand(esp, 5 * kSystemPointerSize));
// argument in xmm0, xmm1 and xmm2 // argument in xmm0, xmm1 and xmm2
// xmm0 * xmm1 + xmm2 // xmm0 * xmm1 + xmm2
__ movaps(xmm3, xmm0); __ movaps(xmm3, xmm0);
...@@ -823,9 +823,9 @@ TEST(AssemblerX64FMA_ss) { ...@@ -823,9 +823,9 @@ TEST(AssemblerX64FMA_ss) {
{ {
CpuFeatureScope fscope(&assm, FMA3); CpuFeatureScope fscope(&assm, FMA3);
Label exit; Label exit;
__ movss(xmm0, Operand(esp, 1 * kPointerSize)); __ movss(xmm0, Operand(esp, 1 * kSystemPointerSize));
__ movss(xmm1, Operand(esp, 2 * kPointerSize)); __ movss(xmm1, Operand(esp, 2 * kSystemPointerSize));
__ movss(xmm2, Operand(esp, 3 * kPointerSize)); __ movss(xmm2, Operand(esp, 3 * kSystemPointerSize));
// arguments in xmm0, xmm1 and xmm2 // arguments in xmm0, xmm1 and xmm2
// xmm0 * xmm1 + xmm2 // xmm0 * xmm1 + xmm2
__ movaps(xmm3, xmm0); __ movaps(xmm3, xmm0);
...@@ -1403,7 +1403,7 @@ TEST(AssemblerIa32JumpTables1) { ...@@ -1403,7 +1403,7 @@ TEST(AssemblerIa32JumpTables1) {
Label done, table; Label done, table;
__ mov(eax, Operand(esp, 4)); __ mov(eax, Operand(esp, 4));
__ jmp(Operand::JumpTable(eax, times_4, &table)); __ jmp(Operand::JumpTable(eax, times_system_pointer_size, &table));
__ ud2(); __ ud2();
__ bind(&table); __ bind(&table);
for (int i = 0; i < kNumCases; ++i) { for (int i = 0; i < kNumCases; ++i) {
...@@ -1450,7 +1450,7 @@ TEST(AssemblerIa32JumpTables2) { ...@@ -1450,7 +1450,7 @@ TEST(AssemblerIa32JumpTables2) {
Label done, table; Label done, table;
__ mov(eax, Operand(esp, 4)); __ mov(eax, Operand(esp, 4));
__ jmp(Operand::JumpTable(eax, times_4, &table)); __ jmp(Operand::JumpTable(eax, times_system_pointer_size, &table));
__ ud2(); __ ud2();
for (int i = 0; i < kNumCases; ++i) { for (int i = 0; i < kNumCases; ++i) {
......
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