Revision: 11769
Author:   [email protected]
Date:     Mon Jun 11 23:43:13 2012
Log:      MIPS: Remove TLS access for current Zone.

Port r11761 (769624bf)

Original commit message:
By passing around a Zone object explicitly we no longer need to do a
TLS access at the sites that allocate memory from the current Zone.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10537108
Patch from Akos Palfi <[email protected]>.
http://code.google.com/p/v8/source/detail?r=11769

Modified:
 /branches/bleeding_edge/src/jsregexp.cc
 /branches/bleeding_edge/src/mips/full-codegen-mips.cc
 /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
 /branches/bleeding_edge/src/mips/lithium-codegen-mips.h
 /branches/bleeding_edge/src/mips/lithium-gap-resolver-mips.cc
 /branches/bleeding_edge/src/mips/lithium-mips.cc
 /branches/bleeding_edge/src/mips/lithium-mips.h
 /branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.cc
 /branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.h

=======================================
--- /branches/bleeding_edge/src/jsregexp.cc     Mon Jun 11 05:42:31 2012
+++ /branches/bleeding_edge/src/jsregexp.cc     Mon Jun 11 23:43:13 2012
@@ -5980,7 +5980,8 @@
RegExpMacroAssemblerARM macro_assembler(mode, (data->capture_count + 1) * 2,
                                           zone);
 #elif V8_TARGET_ARCH_MIPS
- RegExpMacroAssemblerMIPS macro_assembler(mode, (data->capture_count + 1) * 2); + RegExpMacroAssemblerMIPS macro_assembler(mode, (data->capture_count + 1) * 2,
+                                           zone);
 #endif

 #else  // V8_INTERPRETED_REGEXP
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Mon Jun 11 23:15:59 2012 +++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Mon Jun 11 23:43:13 2012
@@ -817,10 +817,11 @@
   bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET;
   switch (variable->location()) {
     case Variable::UNALLOCATED:
-      globals_->Add(variable->name());
+      globals_->Add(variable->name(), zone());
       globals_->Add(variable->binding_needs_init()
                         ? isolate()->factory()->the_hole_value()
-                        : isolate()->factory()->undefined_value());
+                        : isolate()->factory()->undefined_value(),
+                    zone());
       break;

     case Variable::PARAMETER:
@@ -877,12 +878,12 @@
   Variable* variable = proxy->var();
   switch (variable->location()) {
     case Variable::UNALLOCATED: {
-      globals_->Add(variable->name());
+      globals_->Add(variable->name(), zone());
       Handle<SharedFunctionInfo> function =
           Compiler::BuildFunctionInfo(declaration->fun(), script());
       // Check for stack-overflow exception.
       if (function.is_null()) return SetStackOverflow();
-      globals_->Add(function);
+      globals_->Add(function, zone());
       break;
     }

@@ -936,8 +937,8 @@
   switch (variable->location()) {
     case Variable::UNALLOCATED: {
       Comment cmnt(masm_, "[ ModuleDeclaration");
-      globals_->Add(variable->name());
-      globals_->Add(instance);
+      globals_->Add(variable->name(), zone());
+      globals_->Add(instance, zone());
       Visit(declaration->module());
       break;
     }
@@ -1611,7 +1612,7 @@
   // Mark all computed expressions that are bound to a key that
   // is shadowed by a later occurrence of the same key. For the
   // marked expressions, no store code is emitted.
-  expr->CalculateEmitStore();
+  expr->CalculateEmitStore(zone());

   AccessorTable accessor_table(isolate()->zone());
   for (int i = 0; i < expr->properties()->length(); i++) {
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed Jun 6 04:44:54 2012 +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Mon Jun 11 23:43:13 2012
@@ -599,7 +599,7 @@
     environment->Register(deoptimization_index,
                           translation.index(),
(mode == Safepoint::kLazyDeopt) ? pc_offset : -1);
-    deoptimizations_.Add(environment);
+    deoptimizations_.Add(environment, zone());
   }
 }

@@ -678,7 +678,7 @@
   for (int i = 0; i < deoptimization_literals_.length(); ++i) {
     if (deoptimization_literals_[i].is_identical_to(literal)) return i;
   }
-  deoptimization_literals_.Add(literal);
+  deoptimization_literals_.Add(literal, zone());
   return result;
 }

@@ -726,12 +726,12 @@
     if (pointer->IsStackSlot()) {
       safepoint.DefinePointerSlot(pointer->index(), zone());
} else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) {
-      safepoint.DefinePointerRegister(ToRegister(pointer));
+      safepoint.DefinePointerRegister(ToRegister(pointer), zone());
     }
   }
   if (kind & Safepoint::kWithRegisters) {
     // Register cp always contains a pointer to the context.
-    safepoint.DefinePointerRegister(cp);
+    safepoint.DefinePointerRegister(cp, zone());
   }
 }

@@ -743,7 +743,7 @@


 void LCodeGen::RecordSafepoint(Safepoint::DeoptMode deopt_mode) {
-  LPointerMap empty_pointers(RelocInfo::kNoPosition);
+  LPointerMap empty_pointers(RelocInfo::kNoPosition, zone());
   RecordSafepoint(&empty_pointers, deopt_mode);
 }

@@ -2044,7 +2044,7 @@
   };

   DeferredInstanceOfKnownGlobal* deferred;
-  deferred = new DeferredInstanceOfKnownGlobal(this, instr);
+  deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr);

   Label done, false_result;
   Register object = ToRegister(instr->InputAt(0));
@@ -3025,7 +3025,7 @@
   } else {
     // Representation is tagged.
     DeferredMathAbsTaggedHeapNumber* deferred =
-        new DeferredMathAbsTaggedHeapNumber(this, instr);
+        new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
     Register input = ToRegister(instr->InputAt(0));
     // Smi check.
     __ JumpIfNotSmi(input, deferred->entry());
@@ -3216,7 +3216,7 @@
     LRandom* instr_;
   };

-  DeferredDoRandom* deferred = new DeferredDoRandom(this, instr);
+  DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr);
   // Having marked this instruction as a call we can use any
   // registers.
   ASSERT(ToDoubleRegister(instr->result()).is(f0));
@@ -3777,7 +3777,7 @@
   };

   DeferredStringCharCodeAt* deferred =
-      new DeferredStringCharCodeAt(this, instr);
+      new(zone()) DeferredStringCharCodeAt(this, instr);
   StringCharLoadGenerator::Generate(masm(),
                                     ToRegister(instr->string()),
                                     ToRegister(instr->index()),
@@ -3831,7 +3831,7 @@
   };

   DeferredStringCharFromCode* deferred =
-      new DeferredStringCharFromCode(this, instr);
+      new(zone()) DeferredStringCharFromCode(this, instr);

   ASSERT(instr->hydrogen()->value()->representation().IsInteger32());
   Register char_code = ToRegister(instr->char_code());
@@ -3907,7 +3907,7 @@
   Register dst = ToRegister(instr->result());
   Register overflow = scratch0();

-  DeferredNumberTagI* deferred = new DeferredNumberTagI(this, instr);
+ DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr);
   __ SmiTagCheckOverflow(dst, src, overflow);
   __ BranchOnOverflow(deferred->entry(), overflow);
   __ bind(deferred->exit());
@@ -3975,7 +3975,7 @@
   Register temp1 = ToRegister(instr->TempAt(0));
   Register temp2 = ToRegister(instr->TempAt(1));

-  DeferredNumberTagD* deferred = new DeferredNumberTagD(this, instr);
+ DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr);
   if (FLAG_inline_new) {
     __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex);
     __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry());
@@ -4169,7 +4169,7 @@

   Register input_reg = ToRegister(input);

-  DeferredTaggedToI* deferred = new DeferredTaggedToI(this, instr);
+  DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr);

   // Let the deferred code handle the HeapObject case.
   __ JumpIfNotSmi(input_reg, deferred->entry());
@@ -4420,7 +4420,8 @@
     LAllocateObject* instr_;
   };

- DeferredAllocateObject* deferred = new DeferredAllocateObject(this, instr);
+  DeferredAllocateObject* deferred =
+      new(zone()) DeferredAllocateObject(this, instr);

   Register result = ToRegister(instr->result());
   Register scratch = ToRegister(instr->TempAt(0));
@@ -5065,7 +5066,7 @@
     ASSERT(instr->hydrogen()->is_backwards_branch());
     // Perform stack overflow check if this goto needs it before jumping.
     DeferredStackCheck* deferred_stack_check =
-        new DeferredStackCheck(this, instr);
+        new(zone()) DeferredStackCheck(this, instr);
     __ LoadRoot(at, Heap::kStackLimitRootIndex);
     __ Branch(deferred_stack_check->entry(), lo, sp, Operand(at));
     EnsureSpaceForLazyDeopt();
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.h Wed Jun 6 04:44:54 2012 +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.h Mon Jun 11 23:43:13 2012
@@ -51,20 +51,20 @@
         current_block_(-1),
         current_instruction_(-1),
         instructions_(chunk->instructions()),
-        deoptimizations_(4),
-        deopt_jump_table_(4),
-        deoptimization_literals_(8),
+        deoptimizations_(4, zone),
+        deopt_jump_table_(4, zone),
+        deoptimization_literals_(8, zone),
         inlined_function_count_(0),
         scope_(info->scope()),
         status_(UNUSED),
         translations_(zone),
-        deferred_(8),
+        deferred_(8, zone),
         osr_pc_offset_(-1),
         last_lazy_deopt_pc_(0),
         safepoints_(zone),
+        zone_(zone),
         resolver_(this),
-        expected_safepoint_kind_(Safepoint::kSimple),
-        zone_(zone) {
+        expected_safepoint_kind_(Safepoint::kSimple) {
     PopulateDeoptimizationLiteralsWithInlinedFunctions();
   }

@@ -178,7 +178,7 @@
   void Abort(const char* format, ...);
   void Comment(const char* format, ...);

-  void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); }
+ void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); }

   // Code generation passes.  Returns true if code generation should
   // continue.
@@ -375,13 +375,13 @@
   // itself is emitted at the end of the generated code.
   SafepointTableBuilder safepoints_;

+  Zone* zone_;
+
   // Compiler from a set of parallel moves to a sequential list of moves.
   LGapResolver resolver_;

   Safepoint::Kind expected_safepoint_kind_;

-  Zone* zone_;
-
   class PushSafepointRegistersScope BASE_EMBEDDED {
    public:
     PushSafepointRegistersScope(LCodeGen* codegen,
=======================================
--- /branches/bleeding_edge/src/mips/lithium-gap-resolver-mips.cc Thu Apr 5 08:18:22 2012 +++ /branches/bleeding_edge/src/mips/lithium-gap-resolver-mips.cc Mon Jun 11 23:43:13 2012
@@ -35,7 +35,7 @@

 LGapResolver::LGapResolver(LCodeGen* owner)
     : cgen_(owner),
-      moves_(32),
+      moves_(32, owner->zone()),
       root_index_(0),
       in_cycle_(false),
       saved_destination_(NULL) {}
@@ -80,7 +80,7 @@
   const ZoneList<LMoveOperands>* moves = parallel_move->move_operands();
   for (int i = 0; i < moves->length(); ++i) {
     LMoveOperands move = moves->at(i);
-    if (!move.IsRedundant()) moves_.Add(move);
+    if (!move.IsRedundant()) moves_.Add(move, cgen_->zone());
   }
   Verify();
 }
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.cc Wed Jun 6 04:44:54 2012 +++ /branches/bleeding_edge/src/mips/lithium-mips.cc Mon Jun 11 23:43:13 2012
@@ -411,9 +411,9 @@
     : spill_slot_count_(0),
       info_(info),
       graph_(graph),
-      instructions_(32),
-      pointer_maps_(8),
-      inlined_closures_(1) {
+      instructions_(32, graph->zone()),
+      pointer_maps_(8, graph->zone()),
+      inlined_closures_(1, graph->zone()) {
 }


@@ -427,9 +427,9 @@
 LOperand* LChunk::GetNextSpillSlot(bool is_double)  {
   int index = GetNextSpillIndex(is_double);
   if (is_double) {
-    return LDoubleStackSlot::Create(index);
+    return LDoubleStackSlot::Create(index, zone());
   } else {
-    return LStackSlot::Create(index);
+    return LStackSlot::Create(index, zone());
   }
 }

@@ -474,23 +474,23 @@
   LInstructionGap* gap = new(graph_->zone()) LInstructionGap(block);
   int index = -1;
   if (instr->IsControl()) {
-    instructions_.Add(gap);
+    instructions_.Add(gap, zone());
     index = instructions_.length();
-    instructions_.Add(instr);
+    instructions_.Add(instr, zone());
   } else {
     index = instructions_.length();
-    instructions_.Add(instr);
-    instructions_.Add(gap);
+    instructions_.Add(instr, zone());
+    instructions_.Add(gap, zone());
   }
   if (instr->HasPointerMap()) {
-    pointer_maps_.Add(instr->pointer_map());
+    pointer_maps_.Add(instr->pointer_map(), zone());
     instr->pointer_map()->set_lithium_position(index);
   }
 }


 LConstantOperand* LChunk::DefineConstantOperand(HConstant* constant) {
-  return LConstantOperand::Create(constant->id());
+  return LConstantOperand::Create(constant->id(), zone());
 }


@@ -529,7 +529,8 @@


 void LChunk::AddGapMove(int index, LOperand* from, LOperand* to) {
-  GetGapAt(index)->GetOrCreateParallelMove(LGap::START)->AddMove(from, to);
+  GetGapAt(index)->GetOrCreateParallelMove(
+      LGap::START, zone())->AddMove(from, to, zone());
 }


@@ -762,7 +763,7 @@

 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
   ASSERT(!instr->HasPointerMap());
-  instr->set_pointer_map(new(zone()) LPointerMap(position_));
+  instr->set_pointer_map(new(zone()) LPointerMap(position_, zone()));
   return instr;
 }

@@ -1596,7 +1597,8 @@

 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
   LOperand* object = UseFixed(instr->value(), a0);
- LDateField* result = new LDateField(object, FixedTemp(a1), instr->index());
+  LDateField* result =
+      new(zone()) LDateField(object, FixedTemp(a1), instr->index());
   return MarkAsCall(DefineFixed(result, v0), instr);
 }

@@ -2111,8 +2113,8 @@


 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) {
-  LAllocateObject* result = new(zone()) LAllocateObject(
-      TempRegister(), TempRegister());
+  LAllocateObject* result =
+      new(zone()) LAllocateObject(TempRegister(), TempRegister());
   return AssignPointerMap(DefineAsRegister(result));
 }

=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.h     Wed Jun  6 04:44:54 2012
+++ /branches/bleeding_edge/src/mips/lithium-mips.h     Mon Jun 11 23:43:13 2012
@@ -332,8 +332,10 @@
     LAST_INNER_POSITION = AFTER
   };

-  LParallelMove* GetOrCreateParallelMove(InnerPosition pos)  {
- if (parallel_moves_[pos] == NULL) parallel_moves_[pos] = new LParallelMove;
+  LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone)  {
+    if (parallel_moves_[pos] == NULL) {
+      parallel_moves_[pos] = new(zone) LParallelMove(zone);
+    }
     return parallel_moves_[pos];
   }

@@ -2233,8 +2235,10 @@
   }

   void AddInlinedClosure(Handle<JSFunction> closure) {
-    inlined_closures_.Add(closure);
-  }
+    inlined_closures_.Add(closure, zone());
+  }
+
+  Zone* zone() const { return graph_->zone(); }

  private:
   int spill_slot_count_;
=======================================
--- /branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.cc Mon Jun 11 23:13:14 2012 +++ /branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.cc Mon Jun 11 23:43:13 2012
@@ -119,8 +119,10 @@

 RegExpMacroAssemblerMIPS::RegExpMacroAssemblerMIPS(
     Mode mode,
-    int registers_to_save)
-    : masm_(new MacroAssembler(Isolate::Current(), NULL, kRegExpCodeSize)),
+    int registers_to_save,
+    Zone* zone)
+    : NativeRegExpMacroAssembler(zone),
+      masm_(new MacroAssembler(Isolate::Current(), NULL, kRegExpCodeSize)),
       mode_(mode),
       num_registers_(registers_to_save),
       num_saved_registers_(registers_to_save),
=======================================
--- /branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.h Wed Jun 6 00:50:22 2012 +++ /branches/bleeding_edge/src/mips/regexp-macro-assembler-mips.h Mon Jun 11 23:43:13 2012
@@ -47,7 +47,7 @@
 #else  // V8_INTERPRETED_REGEXP
 class RegExpMacroAssemblerMIPS: public NativeRegExpMacroAssembler {
  public:
-  RegExpMacroAssemblerMIPS(Mode mode, int registers_to_save);
+  RegExpMacroAssemblerMIPS(Mode mode, int registers_to_save, Zone* zone);
   virtual ~RegExpMacroAssemblerMIPS();
   virtual int stack_limit_slack();
   virtual void AdvanceCurrentPosition(int by);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to