[write-barrier] Generalise write-barrier native counter.
We would only increment write barrier counters from the the MacroAssembler's RecordWrite method which is only used in limited cases. Instead, we should increment it inside the RecordWrite stub, this way we catch all uses, including WASM. Also, we had a static counter aimed at telling us how many barriers exist in generated code, as opposed to how many are executed. This counter was not functional since the compiler isn't aware of counters at the moment. Let's just remove it to avoid confusion. Change-Id: I6b173ab858c8984ef03ede225afdc999ba82b5c9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1524483 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Sigurd Schneider <sigurds@chromium.org> Commit-Queue: Pierre Langlois <pierre.langlois@arm.com> Cr-Commit-Position: refs/heads/master@{#60673}
This commit is contained in:
parent
8a23a3a290
commit
2ead93fe27
@ -802,14 +802,6 @@ void MacroAssembler::RecordWrite(Register object, Register address,
|
||||
|
||||
bind(&done);
|
||||
|
||||
// Count number of write barriers in generated code.
|
||||
isolate()->counters()->write_barriers_static()->Increment();
|
||||
{
|
||||
UseScratchRegisterScope temps(this);
|
||||
IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1,
|
||||
temps.Acquire(), value);
|
||||
}
|
||||
|
||||
// Clobber clobbered registers when running with the debug-code flag
|
||||
// turned on to provoke errors.
|
||||
if (emit_debug_code()) {
|
||||
|
@ -3159,11 +3159,6 @@ void MacroAssembler::RecordWrite(Register object, Register address,
|
||||
|
||||
Bind(&done);
|
||||
|
||||
// Count number of write barriers in generated code.
|
||||
isolate()->counters()->write_barriers_static()->Increment();
|
||||
IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1, address,
|
||||
value);
|
||||
|
||||
// Clobber clobbered registers when running with the debug-code flag
|
||||
// turned on to provoke errors.
|
||||
if (emit_debug_code()) {
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "src/builtins/builtins-utils-gen.h"
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/code-stub-assembler.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/heap/heap-inl.h" // crbug.com/v8/8499
|
||||
#include "src/ic/accessor-assembler.h"
|
||||
#include "src/ic/keyed-store-generic.h"
|
||||
@ -446,6 +447,7 @@ TF_BUILTIN(RecordWrite, RecordWriteCodeStubAssembler) {
|
||||
}
|
||||
|
||||
BIND(&exit);
|
||||
IncrementCounter(isolate()->counters()->write_barriers(), 1);
|
||||
Return(TrueConstant());
|
||||
}
|
||||
|
||||
@ -465,6 +467,7 @@ TF_BUILTIN(EphemeronKeyBarrier, RecordWriteCodeStubAssembler) {
|
||||
fp_mode, &exit);
|
||||
|
||||
BIND(&exit);
|
||||
IncrementCounter(isolate()->counters()->write_barriers(), 1);
|
||||
Return(TrueConstant());
|
||||
}
|
||||
|
||||
|
@ -302,10 +302,6 @@ namespace internal {
|
||||
SC(soft_deopts_requested, V8.SoftDeoptsRequested) \
|
||||
SC(soft_deopts_inserted, V8.SoftDeoptsInserted) \
|
||||
SC(soft_deopts_executed, V8.SoftDeoptsExecuted) \
|
||||
/* Number of write barriers in generated code. */ \
|
||||
/* TODO: This isn't functional at the moment, we should teach the */ \
|
||||
/* compiler about this counter. */ \
|
||||
SC(write_barriers_static, V8.WriteBarriersStatic) \
|
||||
SC(new_space_bytes_available, V8.MemoryNewSpaceBytesAvailable) \
|
||||
SC(new_space_bytes_committed, V8.MemoryNewSpaceBytesCommitted) \
|
||||
SC(new_space_bytes_used, V8.MemoryNewSpaceBytesUsed) \
|
||||
@ -337,7 +333,7 @@ namespace internal {
|
||||
// a separate list to be able to relocate them.
|
||||
#define STATS_COUNTER_NATIVE_CODE_LIST(SC) \
|
||||
/* Number of write barriers executed at runtime. */ \
|
||||
SC(write_barriers_dynamic, V8.WriteBarriersDynamic) \
|
||||
SC(write_barriers, V8.WriteBarriers) \
|
||||
SC(constructed_objects, V8.ConstructedObjects) \
|
||||
SC(fast_new_closure_total, V8.FastNewClosureTotal) \
|
||||
SC(regexp_entry_native, V8.RegExpEntryNative) \
|
||||
|
@ -513,10 +513,6 @@ void MacroAssembler::RecordWrite(Register object, Register address,
|
||||
|
||||
bind(&done);
|
||||
|
||||
// Count number of write barriers in generated code.
|
||||
isolate()->counters()->write_barriers_static()->Increment();
|
||||
IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1, value);
|
||||
|
||||
// Clobber clobbered registers when running with the debug-code flag
|
||||
// turned on to provoke errors.
|
||||
if (emit_debug_code()) {
|
||||
|
@ -361,15 +361,6 @@ void MacroAssembler::RecordWrite(Register object, Register address,
|
||||
|
||||
bind(&done);
|
||||
|
||||
{
|
||||
// Count number of write barriers in generated code.
|
||||
isolate()->counters()->write_barriers_static()->Increment();
|
||||
UseScratchRegisterScope temps(this);
|
||||
Register scratch = temps.Acquire();
|
||||
IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1,
|
||||
scratch, value);
|
||||
}
|
||||
|
||||
// Clobber clobbered registers when running with the debug-code flag
|
||||
// turned on to provoke errors.
|
||||
if (emit_debug_code()) {
|
||||
|
@ -359,15 +359,6 @@ void MacroAssembler::RecordWrite(Register object, Register address,
|
||||
|
||||
bind(&done);
|
||||
|
||||
{
|
||||
// Count number of write barriers in generated code.
|
||||
UseScratchRegisterScope temps(this);
|
||||
Register scratch = temps.Acquire();
|
||||
isolate()->counters()->write_barriers_static()->Increment();
|
||||
IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1,
|
||||
scratch, value);
|
||||
}
|
||||
|
||||
// Clobber clobbered registers when running with the debug-code flag
|
||||
// turned on to provoke errors.
|
||||
if (emit_debug_code()) {
|
||||
|
@ -591,11 +591,6 @@ void MacroAssembler::RecordWrite(Register object, Register address,
|
||||
|
||||
bind(&done);
|
||||
|
||||
// Count number of write barriers in generated code.
|
||||
isolate()->counters()->write_barriers_static()->Increment();
|
||||
IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1, ip,
|
||||
value);
|
||||
|
||||
// Clobber clobbered registers when running with the debug-code flag
|
||||
// turned on to provoke errors.
|
||||
if (emit_debug_code()) {
|
||||
|
@ -605,11 +605,6 @@ void MacroAssembler::RecordWrite(Register object, Register address,
|
||||
|
||||
bind(&done);
|
||||
|
||||
// Count number of write barriers in generated code.
|
||||
isolate()->counters()->write_barriers_static()->Increment();
|
||||
IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1, ip,
|
||||
value);
|
||||
|
||||
// Clobber clobbered registers when running with the debug-code flag
|
||||
// turned on to provoke errors.
|
||||
if (emit_debug_code()) {
|
||||
|
@ -516,10 +516,6 @@ void MacroAssembler::RecordWrite(Register object, Register address,
|
||||
|
||||
bind(&done);
|
||||
|
||||
// Count number of write barriers in generated code.
|
||||
isolate()->counters()->write_barriers_static()->Increment();
|
||||
IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1);
|
||||
|
||||
// Clobber clobbered registers when running with the debug-code flag
|
||||
// turned on to provoke errors.
|
||||
if (emit_debug_code()) {
|
||||
|
@ -821,5 +821,17 @@ TEST_F(SnapshotNativeCounterTest, SubStringNative) {
|
||||
PrintAll();
|
||||
}
|
||||
|
||||
TEST_F(SnapshotNativeCounterTest, WriteBarrier) {
|
||||
RunJS("let o = {a: 42};");
|
||||
|
||||
if (SupportsNativeCounters()) {
|
||||
EXPECT_NE(0, write_barriers());
|
||||
} else {
|
||||
EXPECT_EQ(0, write_barriers());
|
||||
}
|
||||
|
||||
PrintAll();
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
Loading…
Reference in New Issue
Block a user