Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: src/regexp/jsregexp.cc

Issue 1847543002: Expose a lower bound of malloc'd memory via heap statistics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/regexp/jsregexp.h" 5 #include "src/regexp/jsregexp.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/compilation-cache.h" 9 #include "src/compilation-cache.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 130
131 // Generic RegExp methods. Dispatches to implementation specific methods. 131 // Generic RegExp methods. Dispatches to implementation specific methods.
132 132
133 133
134 MaybeHandle<Object> RegExpImpl::Compile(Handle<JSRegExp> re, 134 MaybeHandle<Object> RegExpImpl::Compile(Handle<JSRegExp> re,
135 Handle<String> pattern, 135 Handle<String> pattern,
136 JSRegExp::Flags flags) { 136 JSRegExp::Flags flags) {
137 Isolate* isolate = re->GetIsolate(); 137 Isolate* isolate = re->GetIsolate();
138 Zone zone; 138 Zone zone(isolate->allocator());
139 CompilationCache* compilation_cache = isolate->compilation_cache(); 139 CompilationCache* compilation_cache = isolate->compilation_cache();
140 MaybeHandle<FixedArray> maybe_cached = 140 MaybeHandle<FixedArray> maybe_cached =
141 compilation_cache->LookupRegExp(pattern, flags); 141 compilation_cache->LookupRegExp(pattern, flags);
142 Handle<FixedArray> cached; 142 Handle<FixedArray> cached;
143 bool in_cache = maybe_cached.ToHandle(&cached); 143 bool in_cache = maybe_cached.ToHandle(&cached);
144 LOG(isolate, RegExpCompileEvent(re, in_cache)); 144 LOG(isolate, RegExpCompileEvent(re, in_cache));
145 145
146 Handle<Object> result; 146 Handle<Object> result;
147 if (in_cache) { 147 if (in_cache) {
148 re->set_data(*cached); 148 re->set_data(*cached);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 return CompileIrregexp(re, sample_subject, is_one_byte); 340 return CompileIrregexp(re, sample_subject, is_one_byte);
341 } 341 }
342 342
343 343
344 bool RegExpImpl::CompileIrregexp(Handle<JSRegExp> re, 344 bool RegExpImpl::CompileIrregexp(Handle<JSRegExp> re,
345 Handle<String> sample_subject, 345 Handle<String> sample_subject,
346 bool is_one_byte) { 346 bool is_one_byte) {
347 // Compile the RegExp. 347 // Compile the RegExp.
348 Isolate* isolate = re->GetIsolate(); 348 Isolate* isolate = re->GetIsolate();
349 Zone zone; 349 Zone zone(isolate->allocator());
350 PostponeInterruptsScope postpone(isolate); 350 PostponeInterruptsScope postpone(isolate);
351 // If we had a compilation error the last time this is saved at the 351 // If we had a compilation error the last time this is saved at the
352 // saved code index. 352 // saved code index.
353 Object* entry = re->DataAt(JSRegExp::code_index(is_one_byte)); 353 Object* entry = re->DataAt(JSRegExp::code_index(is_one_byte));
354 // When arriving here entry can only be a smi, either representing an 354 // When arriving here entry can only be a smi, either representing an
355 // uncompiled regexp, a previous compilation error, or code that has 355 // uncompiled regexp, a previous compilation error, or code that has
356 // been flushed. 356 // been flushed.
357 DCHECK(entry->IsSmi()); 357 DCHECK(entry->IsSmi());
358 int entry_value = Smi::cast(entry)->value(); 358 int entry_value = Smi::cast(entry)->value();
359 DCHECK(entry_value == JSRegExp::kUninitializedValue || 359 DCHECK(entry_value == JSRegExp::kUninitializedValue ||
(...skipping 6504 matching lines...) Expand 10 before | Expand all | Expand 10 after
6864 6864
6865 6865
6866 void RegExpResultsCache::Clear(FixedArray* cache) { 6866 void RegExpResultsCache::Clear(FixedArray* cache) {
6867 for (int i = 0; i < kRegExpResultsCacheSize; i++) { 6867 for (int i = 0; i < kRegExpResultsCacheSize; i++) {
6868 cache->set(i, Smi::FromInt(0)); 6868 cache->set(i, Smi::FromInt(0));
6869 } 6869 }
6870 } 6870 }
6871 6871
6872 } // namespace internal 6872 } // namespace internal
6873 } // namespace v8 6873 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698