Revision: 16340
Author:   [email protected]
Date:     Mon Aug 26 17:30:41 2013 UTC
Log:      Factor out HSimulate::ReplayEnvironment.

[email protected]

Review URL: https://codereview.chromium.org/23005027
http://code.google.com/p/v8/source/detail?r=16340

Modified:
 /branches/bleeding_edge/src/arm/lithium-arm.cc
 /branches/bleeding_edge/src/hydrogen-instructions.cc
 /branches/bleeding_edge/src/hydrogen-instructions.h
 /branches/bleeding_edge/src/ia32/lithium-ia32.cc
 /branches/bleeding_edge/src/mips/lithium-mips.cc
 /branches/bleeding_edge/src/x64/lithium-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Mon Aug 26 16:43:19 2013 UTC +++ /branches/bleeding_edge/src/arm/lithium-arm.cc Mon Aug 26 17:30:41 2013 UTC
@@ -2435,8 +2435,7 @@


 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
-  HEnvironment* env = current_block_->last_environment();
-  instr->ReplayEnvironment(env);
+  instr->ReplayEnvironment(current_block_->last_environment());

   // There are no real uses of a captured object.
   return NULL;
@@ -2484,20 +2483,7 @@


 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
-  HEnvironment* env = current_block_->last_environment();
-  ASSERT(env != NULL);
-
-  env->set_ast_id(instr->ast_id());
-
-  env->Drop(instr->pop_count());
-  for (int i = instr->values()->length() - 1; i >= 0; --i) {
-    HValue* value = instr->values()->at(i);
-    if (instr->HasAssignedIndexAt(i)) {
-      env->Bind(instr->GetAssignedIndexAt(i), value);
-    } else {
-      env->Push(value);
-    }
-  }
+  instr->ReplayEnvironment(current_block_->last_environment());

   // If there is an instruction pending deoptimization environment create a
   // lazy bailout instruction to capture the environment.
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Mon Aug 26 16:43:19 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Mon Aug 26 17:30:41 2013 UTC
@@ -2287,6 +2287,21 @@
     }
   }
 }
+
+
+void HSimulate::ReplayEnvironment(HEnvironment* env) {
+  ASSERT(env != NULL);
+  env->set_ast_id(ast_id());
+  env->Drop(pop_count());
+  for (int i = values()->length() - 1; i >= 0; --i) {
+    HValue* value = values()->at(i);
+    if (HasAssignedIndexAt(i)) {
+      env->Bind(GetAssignedIndexAt(i), value);
+    } else {
+      env->Push(value);
+    }
+  }
+}


 // Replay captured objects by replacing all captured objects with the
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Mon Aug 26 16:43:19 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.h Mon Aug 26 17:30:41 2013 UTC
@@ -1675,6 +1675,9 @@

   void MergeWith(ZoneList<HSimulate*>* list);
bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; }
+
+  // Replay effects of this instruction on the given environment.
+  void ReplayEnvironment(HEnvironment* env);

   DECLARE_CONCRETE_INSTRUCTION(Simulate)

=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Mon Aug 26 16:43:19 2013 UTC +++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Mon Aug 26 17:30:41 2013 UTC
@@ -2564,8 +2564,7 @@


 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
-  HEnvironment* env = current_block_->last_environment();
-  instr->ReplayEnvironment(env);
+  instr->ReplayEnvironment(current_block_->last_environment());

   // There are no real uses of a captured object.
   return NULL;
@@ -2615,20 +2614,7 @@


 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
-  HEnvironment* env = current_block_->last_environment();
-  ASSERT(env != NULL);
-
-  env->set_ast_id(instr->ast_id());
-
-  env->Drop(instr->pop_count());
-  for (int i = instr->values()->length() - 1; i >= 0; --i) {
-    HValue* value = instr->values()->at(i);
-    if (instr->HasAssignedIndexAt(i)) {
-      env->Bind(instr->GetAssignedIndexAt(i), value);
-    } else {
-      env->Push(value);
-    }
-  }
+  instr->ReplayEnvironment(current_block_->last_environment());

   // If there is an instruction pending deoptimization environment create a
   // lazy bailout instruction to capture the environment.
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.cc Mon Aug 26 16:43:19 2013 UTC +++ /branches/bleeding_edge/src/mips/lithium-mips.cc Mon Aug 26 17:30:41 2013 UTC
@@ -2361,8 +2361,7 @@


 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
-  HEnvironment* env = current_block_->last_environment();
-  instr->ReplayEnvironment(env);
+  instr->ReplayEnvironment(current_block_->last_environment());

   // There are no real uses of a captured object.
   return NULL;
@@ -2410,20 +2409,7 @@


 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
-  HEnvironment* env = current_block_->last_environment();
-  ASSERT(env != NULL);
-
-  env->set_ast_id(instr->ast_id());
-
-  env->Drop(instr->pop_count());
-  for (int i = instr->values()->length() - 1; i >= 0; --i) {
-    HValue* value = instr->values()->at(i);
-    if (instr->HasAssignedIndexAt(i)) {
-      env->Bind(instr->GetAssignedIndexAt(i), value);
-    } else {
-      env->Push(value);
-    }
-  }
+  instr->ReplayEnvironment(current_block_->last_environment());

   // If there is an instruction pending deoptimization environment create a
   // lazy bailout instruction to capture the environment.
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Mon Aug 26 16:43:19 2013 UTC +++ /branches/bleeding_edge/src/x64/lithium-x64.cc Mon Aug 26 17:30:41 2013 UTC
@@ -2374,8 +2374,7 @@


 LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) {
-  HEnvironment* env = current_block_->last_environment();
-  instr->ReplayEnvironment(env);
+  instr->ReplayEnvironment(current_block_->last_environment());

   // There are no real uses of a captured object.
   return NULL;
@@ -2423,20 +2422,7 @@


 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
-  HEnvironment* env = current_block_->last_environment();
-  ASSERT(env != NULL);
-
-  env->set_ast_id(instr->ast_id());
-
-  env->Drop(instr->pop_count());
-  for (int i = instr->values()->length() - 1; i >= 0; --i) {
-    HValue* value = instr->values()->at(i);
-    if (instr->HasAssignedIndexAt(i)) {
-      env->Bind(instr->GetAssignedIndexAt(i), value);
-    } else {
-      env->Push(value);
-    }
-  }
+  instr->ReplayEnvironment(current_block_->last_environment());

   // If there is an instruction pending deoptimization environment create a
   // lazy bailout instruction to capture the environment.

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to