Commit f30960af authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[ia32,root] Fix counter loads to use ExternalOperand

Change-Id: I5804585565acfabc110b019c5fcecdcabbaf022e
Bug: v8:6666
Reviewed-on: https://chromium-review.googlesource.com/c/1276428
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56636}
parent d205a6a7
......@@ -180,7 +180,8 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
__ j(not_zero, &not_create_implicit_receiver);
// If not derived class constructor: Allocate the new receiver object.
__ IncrementCounter(masm->isolate()->counters()->constructed_objects(), 1);
__ IncrementCounter(masm->isolate()->counters()->constructed_objects(), 1,
eax);
__ Call(BUILTIN_CODE(masm->isolate(), FastNewObject),
RelocInfo::CODE_TARGET);
__ jmp(&post_instantiation_deopt_entry, Label::kNear);
......@@ -2323,7 +2324,10 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
const Register kExpectedNumberOfArgumentsRegister = ecx;
Label invoke, dont_adapt_arguments, stack_overflow;
__ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1);
// edi is used as a scratch register. It should be restored from the frame
// when needed.
__ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1,
edi);
Label enough, too_few;
__ cmp(kExpectedNumberOfArgumentsRegister,
......
......@@ -443,7 +443,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
// Count number of write barriers in generated code.
isolate()->counters()->write_barriers_static()->Increment();
IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1);
IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1, value);
// Clobber clobbered registers when running with the debug-code flag
// turned on to provoke errors.
......@@ -1639,10 +1639,12 @@ void MacroAssembler::LoadWeakValue(Register in_out, Label* target_if_cleared) {
and_(in_out, Immediate(~kWeakHeapObjectMask));
}
void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) {
void MacroAssembler::IncrementCounter(StatsCounter* counter, int value,
Register scratch) {
DCHECK_GT(value, 0);
if (FLAG_native_code_counters && counter->Enabled()) {
Operand operand = StaticVariable(ExternalReference::Create(counter));
Operand operand =
ExternalReferenceAsOperand(ExternalReference::Create(counter), scratch);
if (value == 1) {
inc(operand);
} else {
......@@ -1651,11 +1653,12 @@ void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) {
}
}
void MacroAssembler::DecrementCounter(StatsCounter* counter, int value) {
void MacroAssembler::DecrementCounter(StatsCounter* counter, int value,
Register scratch) {
DCHECK_GT(value, 0);
if (FLAG_native_code_counters && counter->Enabled()) {
Operand operand = StaticVariable(ExternalReference::Create(counter));
Operand operand =
ExternalReferenceAsOperand(ExternalReference::Create(counter), scratch);
if (value == 1) {
dec(operand);
} else {
......
......@@ -731,8 +731,8 @@ class MacroAssembler : public TurboAssembler {
// ---------------------------------------------------------------------------
// StatsCounter support
void IncrementCounter(StatsCounter* counter, int value);
void DecrementCounter(StatsCounter* counter, int value);
void IncrementCounter(StatsCounter* counter, int value, Register scratch);
void DecrementCounter(StatsCounter* counter, int value, Register scratch);
static int SafepointRegisterStackIndex(Register reg) {
return SafepointRegisterStackIndex(reg.code());
......
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