ARM64: Propagate notification about aborted compilation from RegExpEngine to MacroAss...
authorishell <ishell@chromium.org>
Mon, 18 May 2015 19:41:26 +0000 (12:41 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 18 May 2015 19:41:14 +0000 (19:41 +0000)
BUG=chromium:489290
LOG=Y

Review URL: https://codereview.chromium.org/1145653004

Cr-Commit-Position: refs/heads/master@{#28455}

src/arm64/regexp-macro-assembler-arm64.h
src/jsregexp.cc
src/regexp-macro-assembler-tracer.cc
src/regexp-macro-assembler-tracer.h
src/regexp-macro-assembler.h

index da6b26b..ae4393f 100644 (file)
@@ -20,6 +20,7 @@ class RegExpMacroAssemblerARM64: public NativeRegExpMacroAssembler {
   RegExpMacroAssemblerARM64(Isolate* isolate, Zone* zone, Mode mode,
                             int registers_to_save);
   virtual ~RegExpMacroAssemblerARM64();
+  virtual void AbortedCodeGeneration() { masm_->AbortedCodeGeneration(); }
   virtual int stack_limit_slack();
   virtual void AdvanceCurrentPosition(int by);
   virtual void AdvanceRegister(int reg, int by);
index ddab751..5d34ba6 100644 (file)
@@ -1091,7 +1091,10 @@ RegExpEngine::CompilationResult RegExpCompiler::Assemble(
     node->set_on_work_list(false);
     if (!node->label()->is_bound()) node->Emit(this, &new_trace);
   }
-  if (reg_exp_too_big_) return IrregexpRegExpTooBig(isolate_);
+  if (reg_exp_too_big_) {
+    macro_assembler_->AbortedCodeGeneration();
+    return IrregexpRegExpTooBig(isolate_);
+  }
 
   Handle<HeapObject> code = macro_assembler_->GetCode(pattern);
   heap->IncreaseTotalRegexpCodeGenerated(code->Size());
index 71d0b9b..00055ed 100644 (file)
@@ -26,6 +26,12 @@ RegExpMacroAssemblerTracer::~RegExpMacroAssemblerTracer() {
 }
 
 
+void RegExpMacroAssemblerTracer::AbortedCodeGeneration() {
+  PrintF(" AbortedCodeGeneration\n");
+  assembler_->AbortedCodeGeneration();
+}
+
+
 // This is used for printing out debugging information.  It makes an integer
 // that is closely related to the address of an object.
 static int LabelToInt(Label* label) {
index 67b1710..8b8d80a 100644 (file)
@@ -13,6 +13,7 @@ class RegExpMacroAssemblerTracer: public RegExpMacroAssembler {
  public:
   RegExpMacroAssemblerTracer(Isolate* isolate, RegExpMacroAssembler* assembler);
   virtual ~RegExpMacroAssemblerTracer();
+  virtual void AbortedCodeGeneration();
   virtual int stack_limit_slack() { return assembler_->stack_limit_slack(); }
   virtual bool CanReadUnaligned() { return assembler_->CanReadUnaligned(); }
   virtual void AdvanceCurrentPosition(int by);  // Signed cp change.
index c0a8d00..df24424 100644 (file)
@@ -45,6 +45,9 @@ class RegExpMacroAssembler {
 
   RegExpMacroAssembler(Isolate* isolate, Zone* zone);
   virtual ~RegExpMacroAssembler();
+  // This function is called when code generation is aborted, so that
+  // the assembler could clean up internal data structures.
+  virtual void AbortedCodeGeneration() {}
   // The maximal number of pushes between stack checks. Users must supply
   // kCheckStackLimit flag to push operations (instead of kNoStackLimitCheck)
   // at least once for every stack_limit() pushes that are executed.