[regexp] Simplify allocation of RegExpMacroAssemblerTracer
This change is motivated by SpiderMonkey's policy against bare new/delete. (I also think it's just a nicer way to write this.) R=jgruber@chromium.org here is the same as the change I made in the equivalent SM code. Note: I'm not importing regexp.cc into SpiderMonkey, but the change Bug: v8:10303 Change-Id: I3c81727eb7dea9c0ec78241e3c82ffc9e7007827 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2091858 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#66713}
This commit is contained in:
parent
7695c860ab
commit
e5fd9cba7b
@ -8,7 +8,6 @@
|
||||
#include "src/execution/isolate.h"
|
||||
#include "src/objects/objects-inl.h"
|
||||
#include "src/regexp/regexp-macro-assembler-arch.h"
|
||||
#include "src/regexp/regexp-macro-assembler-tracer.h"
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#include "src/regexp/special-case.h"
|
||||
#endif // V8_INTL_SUPPORT
|
||||
@ -245,12 +244,7 @@ RegExpCompiler::RegExpCompiler(Isolate* isolate, Zone* zone, int capture_count,
|
||||
RegExpCompiler::CompilationResult RegExpCompiler::Assemble(
|
||||
Isolate* isolate, RegExpMacroAssembler* macro_assembler, RegExpNode* start,
|
||||
int capture_count, Handle<String> pattern) {
|
||||
#ifdef DEBUG
|
||||
if (FLAG_trace_regexp_assembler)
|
||||
macro_assembler_ = new RegExpMacroAssemblerTracer(isolate, macro_assembler);
|
||||
else
|
||||
#endif
|
||||
macro_assembler_ = macro_assembler;
|
||||
macro_assembler_ = macro_assembler;
|
||||
|
||||
ZoneVector<RegExpNode*> work_list(zone());
|
||||
work_list_ = &work_list;
|
||||
@ -275,11 +269,6 @@ RegExpCompiler::CompilationResult RegExpCompiler::Assemble(
|
||||
isolate->IncreaseTotalRegexpCodeGenerated(code);
|
||||
work_list_ = nullptr;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (FLAG_trace_regexp_assembler) {
|
||||
delete macro_assembler_;
|
||||
}
|
||||
#endif
|
||||
return {*code, next_register_};
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "src/regexp/regexp-dotprinter.h"
|
||||
#include "src/regexp/regexp-interpreter.h"
|
||||
#include "src/regexp/regexp-macro-assembler-arch.h"
|
||||
#include "src/regexp/regexp-macro-assembler-tracer.h"
|
||||
#include "src/regexp/regexp-parser.h"
|
||||
#include "src/strings/string-search.h"
|
||||
#include "src/utils/ostreams.h"
|
||||
@ -878,8 +879,18 @@ bool RegExpImpl::Compile(Isolate* isolate, Zone* zone, RegExpCompileData* data,
|
||||
macro_assembler->set_global_mode(mode);
|
||||
}
|
||||
|
||||
RegExpMacroAssembler* macro_assembler_ptr = macro_assembler.get();
|
||||
#ifdef DEBUG
|
||||
std::unique_ptr<RegExpMacroAssembler> tracer_macro_assembler;
|
||||
if (FLAG_trace_regexp_assembler) {
|
||||
tracer_macro_assembler.reset(
|
||||
new RegExpMacroAssemblerTracer(isolate, macro_assembler_ptr));
|
||||
macro_assembler_ptr = tracer_macro_assembler.get();
|
||||
}
|
||||
#endif
|
||||
|
||||
RegExpCompiler::CompilationResult result = compiler.Assemble(
|
||||
isolate, macro_assembler.get(), node, data->capture_count, pattern);
|
||||
isolate, macro_assembler_ptr, node, data->capture_count, pattern);
|
||||
|
||||
// Code / bytecode printing.
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user