Revision: 7400
Author:   l...@chromium.org
Date:     Tue Mar 29 00:53:33 2011
Log:      Fix reference to masm_ after delete in RegExpMacroAssemblerX64.

BUG=77633

Review URL: http://codereview.chromium.org/6771002
http://code.google.com/p/v8/source/detail?r=7400

Modified:
 /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc
 /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.h

=======================================
--- /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc Wed Mar 23 02:05:13 2011 +++ /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc Tue Mar 29 00:53:33 2011
@@ -109,13 +109,13 @@
  *              bool direct_call)
  */

-#define __ ACCESS_MASM(masm_)
+#define __ ACCESS_MASM((&masm_))

 RegExpMacroAssemblerX64::RegExpMacroAssemblerX64(
     Mode mode,
     int registers_to_save)
-    : masm_(new MacroAssembler(NULL, kRegExpCodeSize)),
-      no_root_array_scope_(masm_),
+    : masm_(NULL, kRegExpCodeSize),
+      no_root_array_scope_(&masm_),
       code_relative_fixup_positions_(4),
       mode_(mode),
       num_registers_(registers_to_save),
@@ -132,7 +132,6 @@


 RegExpMacroAssemblerX64::~RegExpMacroAssemblerX64() {
-  delete masm_;
// Unuse labels in case we throw away the assembler without calling GetCode.
   entry_label_.Unuse();
   start_label_.Unuse();
@@ -428,11 +427,11 @@
     __ movq(rdx, rbx);
 #endif
     ExternalReference compare =
- ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate()); + ExternalReference::re_case_insensitive_compare_uc16(masm_.isolate());
     __ CallCFunction(compare, num_arguments);

     // Restore original values before reacting on result value.
-    __ Move(code_object_pointer(), masm_->CodeObject());
+    __ Move(code_object_pointer(), masm_.CodeObject());
     __ pop(backtrack_stackpointer());
 #ifndef _WIN64
     __ pop(rdi);
@@ -746,7 +745,7 @@
   Label stack_ok;

   ExternalReference stack_limit =
-      ExternalReference::address_of_stack_limit(masm_->isolate());
+      ExternalReference::address_of_stack_limit(masm_.isolate());
   __ movq(rcx, rsp);
   __ movq(kScratchRegister, stack_limit);
   __ subq(rcx, Operand(kScratchRegister, 0));
@@ -762,7 +761,7 @@
   __ jmp(&exit_label_);

   __ bind(&stack_limit_hit);
-  __ Move(code_object_pointer(), masm_->CodeObject());
+  __ Move(code_object_pointer(), masm_.CodeObject());
CallCheckStackGuardState(); // Preserves no registers beside rbp and rsp.
   __ testq(rax, rax);
// If returned value is non-zero, we exit with the returned value as result.
@@ -817,7 +816,7 @@
   // Initialize backtrack stack pointer.
   __ movq(backtrack_stackpointer(), Operand(rbp, kStackHighEnd));
   // Initialize code object pointer.
-  __ Move(code_object_pointer(), masm_->CodeObject());
+  __ Move(code_object_pointer(), masm_.CodeObject());
   // Load previous char as initial value of current-character.
   Label at_start;
   __ cmpb(Operand(rbp, kStartIndex), Immediate(0));
@@ -898,7 +897,7 @@
     __ j(not_zero, &exit_label_);

     // Restore registers.
-    __ Move(code_object_pointer(), masm_->CodeObject());
+    __ Move(code_object_pointer(), masm_.CodeObject());
     __ pop(rdi);
     __ pop(backtrack_stackpointer());
     // String might have moved: Reload esi from frame.
@@ -932,7 +931,7 @@
     __ lea(rsi, Operand(rbp, kStackHighEnd));  // Second argument.
 #endif
     ExternalReference grow_stack =
-        ExternalReference::re_grow_stack(masm_->isolate());
+        ExternalReference::re_grow_stack(masm_.isolate());
     __ CallCFunction(grow_stack, num_arguments);
     // If return NULL, we have failed to grow the stack, and
     // must exit with a stack-overflow exception.
@@ -941,7 +940,7 @@
     // Otherwise use return value as new stack pointer.
     __ movq(backtrack_stackpointer(), rax);
     // Restore saved registers and continue.
-    __ Move(code_object_pointer(), masm_->CodeObject());
+    __ Move(code_object_pointer(), masm_.CodeObject());
 #ifndef _WIN64
     __ pop(rdi);
     __ pop(rsi);
@@ -960,11 +959,11 @@
   FixupCodeRelativePositions();

   CodeDesc code_desc;
-  masm_->GetCode(&code_desc);
+  masm_.GetCode(&code_desc);
   Isolate* isolate = ISOLATE;
   Handle<Code> code = isolate->factory()->NewCode(
       code_desc, Code::ComputeFlags(Code::REGEXP),
-      masm_->CodeObject());
+      masm_.CodeObject());
   PROFILE(isolate, RegExpCodeCreateEvent(*code, *source));
   return Handle<Object>::cast(code);
 }
@@ -1134,7 +1133,7 @@
   __ lea(rdi, Operand(rsp, -kPointerSize));
 #endif
   ExternalReference stack_check =
-      ExternalReference::re_check_stack_guard_state(masm_->isolate());
+      ExternalReference::re_check_stack_guard_state(masm_.isolate());
   __ CallCFunction(stack_check, num_arguments);
 }

@@ -1299,8 +1298,8 @@
     // Patch the relative offset to be relative to the Code object pointer
     // instead.
     int patch_position = position - kIntSize;
-    int offset = masm_->long_at(patch_position);
-    masm_->long_at_put(patch_position,
+    int offset = masm_.long_at(patch_position);
+    masm_.long_at_put(patch_position,
                        offset
                        + position
                        + Code::kHeaderSize
@@ -1334,7 +1333,7 @@
   // Check for preemption.
   Label no_preempt;
   ExternalReference stack_limit =
-      ExternalReference::address_of_stack_limit(masm_->isolate());
+      ExternalReference::address_of_stack_limit(masm_.isolate());
   __ load_rax(stack_limit);
   __ cmpq(rsp, rax);
   __ j(above, &no_preempt);
@@ -1348,7 +1347,7 @@
 void RegExpMacroAssemblerX64::CheckStackLimit() {
   Label no_stack_overflow;
   ExternalReference stack_limit =
-      ExternalReference::address_of_regexp_stack_limit(masm_->isolate());
+      ExternalReference::address_of_regexp_stack_limit(masm_.isolate());
   __ load_rax(stack_limit);
   __ cmpq(backtrack_stackpointer(), rax);
   __ j(above, &no_stack_overflow);
=======================================
--- /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.h Wed Mar 23 02:05:13 2011 +++ /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.h Tue Mar 29 00:53:33 2011
@@ -218,7 +218,7 @@
   void BranchOrBacktrack(Condition condition, Label* to);

   void MarkPositionForCodeRelativeFixup() {
-    code_relative_fixup_positions_.Add(masm_->pc_offset());
+    code_relative_fixup_positions_.Add(masm_.pc_offset());
   }

   void FixupCodeRelativePositions();
@@ -250,7 +250,7 @@
   // Increments the stack pointer (rcx) by a word size.
   inline void Drop();

-  MacroAssembler* masm_;
+  MacroAssembler masm_;
   MacroAssembler::NoRootArrayScope no_root_array_scope_;

   ZoneList<int> code_relative_fixup_positions_;

--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to