Commit e03a2206 authored by mlippautz's avatar mlippautz Committed by Commit bot

[heap] Remove dead counters and move regexp code counter to Isolate

BUG=

Review-Url: https://codereview.chromium.org/2684233004
Cr-Commit-Position: refs/heads/master@{#43094}
parent fa4f0347
......@@ -132,8 +132,6 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
info->prologue_offset(), info->is_debug() && !is_crankshafted);
isolate->counters()->total_compiled_code_size()->Increment(
code->instruction_size());
isolate->heap()->IncrementCodeGeneratedBytes(is_crankshafted,
code->instruction_size());
return code;
}
......
......@@ -117,7 +117,6 @@ Heap::Heap()
#endif // DEBUG
old_generation_allocation_limit_(initial_old_generation_size_),
inline_allocation_disabled_(false),
total_regexp_code_generated_(0),
tracer_(nullptr),
promoted_objects_size_(0),
promotion_ratio_(0),
......@@ -141,8 +140,6 @@ Heap::Heap()
dead_object_stats_(nullptr),
scavenge_job_(nullptr),
idle_scavenge_observer_(nullptr),
full_codegen_bytes_generated_(0),
crankshaft_codegen_bytes_generated_(0),
new_space_allocation_counter_(0),
old_generation_allocation_counter_at_last_gc_(0),
old_generation_size_at_last_gc_(0),
......
......@@ -1424,19 +1424,6 @@ class Heap {
// Returns the size of objects residing in non new spaces.
size_t PromotedSpaceSizeOfObjects();
double total_regexp_code_generated() { return total_regexp_code_generated_; }
void IncreaseTotalRegexpCodeGenerated(int size) {
total_regexp_code_generated_ += size;
}
void IncrementCodeGeneratedBytes(bool is_crankshafted, int size) {
if (is_crankshafted) {
crankshaft_codegen_bytes_generated_ += size;
} else {
full_codegen_bytes_generated_ += size;
}
}
// ===========================================================================
// Prologue/epilogue callback methods.========================================
// ===========================================================================
......@@ -2255,9 +2242,6 @@ class Heap {
List<GCCallbackPair> gc_epilogue_callbacks_;
List<GCCallbackPair> gc_prologue_callbacks_;
// Total RegExp code ever generated
double total_regexp_code_generated_;
int deferred_counters_[v8::Isolate::kUseCounterFeatureCount];
GCTracer* tracer_;
......@@ -2308,10 +2292,6 @@ class Heap {
AllocationObserver* idle_scavenge_observer_;
// These two counters are monotomically increasing and never reset.
size_t full_codegen_bytes_generated_;
size_t crankshaft_codegen_bytes_generated_;
// This counter is increased before each GC and never reset.
// To account for the bytes allocated since the last GC, use the
// NewSpaceAllocationCounter() function.
......
......@@ -2240,7 +2240,8 @@ Isolate::Isolate(bool enable_serializer)
use_counter_callback_(NULL),
basic_block_profiler_(NULL),
cancelable_task_manager_(new CancelableTaskManager()),
abort_on_uncaught_exception_callback_(NULL) {
abort_on_uncaught_exception_callback_(NULL),
total_regexp_code_generated_(0) {
{
base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer());
CHECK(thread_data_table_);
......
......@@ -912,6 +912,11 @@ class Isolate {
RegExpStack* regexp_stack() { return regexp_stack_; }
size_t total_regexp_code_generated() { return total_regexp_code_generated_; }
void IncreaseTotalRegexpCodeGenerated(int size) {
total_regexp_code_generated_ += size;
}
List<int>* regexp_indices() { return &regexp_indices_; }
unibrow::Mapping<unibrow::Ecma262Canonicalize>*
......@@ -1484,6 +1489,8 @@ class Isolate {
bool allow_atomics_wait_;
size_t total_regexp_code_generated_;
friend class ExecutionAccess;
friend class HandleScopeImplementer;
friend class HeapTester;
......
......@@ -1106,12 +1106,11 @@ RegExpEngine::CompilationResult RegExpCompiler::Assemble(
RegExpNode* start,
int capture_count,
Handle<String> pattern) {
Heap* heap = pattern->GetHeap();
Isolate* isolate = pattern->GetHeap()->isolate();
#ifdef DEBUG
if (FLAG_trace_regexp_assembler)
macro_assembler_ =
new RegExpMacroAssemblerTracer(isolate(), macro_assembler);
macro_assembler_ = new RegExpMacroAssemblerTracer(isolate, macro_assembler);
else
#endif
macro_assembler_ = macro_assembler;
......@@ -1135,11 +1134,11 @@ RegExpEngine::CompilationResult RegExpCompiler::Assemble(
}
Handle<HeapObject> code = macro_assembler_->GetCode(pattern);
heap->IncreaseTotalRegexpCodeGenerated(code->Size());
isolate->IncreaseTotalRegexpCodeGenerated(code->Size());
work_list_ = NULL;
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_code) {
CodeTracer::Scope trace_scope(heap->isolate()->GetCodeTracer());
CodeTracer::Scope trace_scope(isolate->GetCodeTracer());
OFStream os(trace_scope.file());
Handle<Code>::cast(code)->Disassemble(pattern->ToCString().get(), os);
}
......@@ -6761,8 +6760,9 @@ RegExpEngine::CompilationResult RegExpEngine::Compile(
bool RegExpEngine::TooMuchRegExpCode(Handle<String> pattern) {
Heap* heap = pattern->GetHeap();
bool too_much = pattern->length() > RegExpImpl::kRegExpTooLargeToOptimize;
if (heap->total_regexp_code_generated() > RegExpImpl::kRegExpCompiledLimit &&
heap->memory_allocator()->SizeExecutable() >
if (heap->isolate()->total_regexp_code_generated() >
RegExpImpl::kRegExpCompiledLimit &&
heap->CommittedMemoryExecutable() >
RegExpImpl::kRegExpExecutableMemoryLimit) {
too_much = true;
}
......
......@@ -158,7 +158,7 @@ class RegExpImpl {
// total regexp code compiled including code that has subsequently been freed
// and the total executable memory at any point.
static const size_t kRegExpExecutableMemoryLimit = 16 * MB;
static const int kRegExpCompiledLimit = 1 * MB;
static const size_t kRegExpCompiledLimit = 1 * MB;
static const int kRegExpTooLargeToOptimize = 20 * KB;
private:
......
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