A64: clean up pending reloc info if code generation was aborted.
authorulan@chromium.org <ulan@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 20 Mar 2014 09:10:15 +0000 (09:10 +0000)
committerulan@chromium.org <ulan@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 20 Mar 2014 09:10:15 +0000 (09:10 +0000)
This fixes assertion failure in destructor of Assembler.

BUG=352659
LOG=N
R=jochen@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20100 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/a64/assembler-a64.h
src/assembler.h
src/lithium.cc

index c4a0260..3da4382 100644 (file)
@@ -743,6 +743,10 @@ class Assembler : public AssemblerBase {
 
   virtual ~Assembler();
 
+  virtual void AbortedCodeGeneration() {
+    num_pending_reloc_info_ = 0;
+  }
+
   // System functions ---------------------------------------------------------
   // Start generating code from the beginning of the buffer, discarding any code
   // and data that has already been emitted into the buffer.
index 5a00d44..4d46a25 100644 (file)
@@ -82,6 +82,10 @@ class AssemblerBase: public Malloced {
 
   int pc_offset() const { return static_cast<int>(pc_ - buffer_); }
 
+  // This function is called when code generation is aborted, so that
+  // the assembler could clean up internal data structures.
+  virtual void AbortedCodeGeneration() { }
+
   static const int kMinimalBufferSize = 4*KB;
 
  protected:
index 9ccdc7a..24b4d1b 100644 (file)
@@ -446,6 +446,7 @@ Handle<Code> LChunk::Codegen() {
     CodeGenerator::PrintCode(code, info());
     return code;
   }
+  assembler.AbortedCodeGeneration();
   return Handle<Code>::null();
 }