Revision: 17082
Author:   [email protected]
Date:     Wed Oct  2 15:27:51 2013 UTC
Log:      Fix test262 failures and x64 compile failure.

[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Wed Oct 2 11:43:41 2013 UTC +++ /branches/bleeding_edge/src/arm/lithium-arm.cc Wed Oct 2 15:27:51 2013 UTC
@@ -876,6 +876,9 @@
   } else {
     instr = current->CompileToLithium(this);
   }
+
+  argument_count_ += current->argument_delta();
+  ASSERT(argument_count_ >= 0);

   if (instr != NULL) {
     // Associate the hydrogen instruction first, since we may need it for
@@ -1107,7 +1110,6 @@


 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
-  ++argument_count_;
   LOperand* argument = Use(instr->argument());
   return new(zone()) LPushArgument(argument);
 }
@@ -1174,7 +1176,6 @@

 LInstruction* LChunkBuilder::DoCallConstantFunction(
     HCallConstantFunction* instr) {
-  argument_count_ -= instr->argument_count();
return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, r0), instr);
 }

@@ -1182,7 +1183,6 @@
 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
   LOperand* context = UseFixed(instr->context(), cp);
   LOperand* function = UseFixed(instr->function(), r1);
-  argument_count_ -= instr->argument_count();
   LInvokeFunction* result = new(zone()) LInvokeFunction(context, function);
return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
 }
@@ -1291,7 +1291,6 @@
 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
   ASSERT(instr->key()->representation().IsTagged());
   LOperand* context = UseFixed(instr->context(), cp);
-  argument_count_ -= instr->argument_count();
   LOperand* key = UseFixed(instr->key(), r2);
   return MarkAsCall(
         DefineFixed(new(zone()) LCallKeyed(context, key), r0), instr);
@@ -1300,20 +1299,17 @@

 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
   LOperand* context = UseFixed(instr->context(), cp);
-  argument_count_ -= instr->argument_count();
return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), r0), instr);
 }


 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
   LOperand* context = UseFixed(instr->context(), cp);
-  argument_count_ -= instr->argument_count();
return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), r0), instr);
 }


 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
-  argument_count_ -= instr->argument_count();
   return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, r0), instr);
 }

@@ -1321,7 +1317,6 @@
 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
   LOperand* context = UseFixed(instr->context(), cp);
   LOperand* constructor = UseFixed(instr->constructor(), r1);
-  argument_count_ -= instr->argument_count();
   LCallNew* result = new(zone()) LCallNew(context, constructor);
   return MarkAsCall(DefineFixed(result, r0), instr);
 }
@@ -1330,7 +1325,6 @@
 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
   LOperand* context = UseFixed(instr->context(), cp);
   LOperand* constructor = UseFixed(instr->constructor(), r1);
-  argument_count_ -= instr->argument_count();
   LCallNewArray* result = new(zone()) LCallNewArray(context, constructor);
   return MarkAsCall(DefineFixed(result, r0), instr);
 }
@@ -1339,14 +1333,12 @@
 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
   LOperand* context = UseFixed(instr->context(), cp);
   LOperand* function = UseFixed(instr->function(), r1);
-  argument_count_ -= instr->argument_count();
   return MarkAsCall(
DefineFixed(new(zone()) LCallFunction(context, function), r0), instr);
 }


 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
-  argument_count_ -= instr->argument_count();
   LOperand* context = UseFixed(instr->context(), cp);
return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), r0), instr);
 }
@@ -2517,7 +2509,6 @@

 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
   LOperand* context = UseFixed(instr->context(), cp);
-  argument_count_ -= instr->argument_count();
return MarkAsCall(DefineFixed(new(zone()) LCallStub(context), r0), instr);
 }

@@ -2642,7 +2633,7 @@
   if (env->entry()->arguments_pushed()) {
     int argument_count = env->arguments_environment()->parameter_count();
     pop = new(zone()) LDrop(argument_count);
-    argument_count_ -= argument_count;
+    ASSERT(instr->argument_delta() == -argument_count);
   }

   HEnvironment* outer = current_block_->last_environment()->
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Wed Oct 2 13:27:53 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.h Wed Oct 2 15:27:51 2013 UTC
@@ -722,6 +722,8 @@
   }

   bool CanReplaceWithDummyUses();
+
+  virtual int argument_delta() const { return 0; }

   // A purely informative definition is an idef that will not emit code and
   // should therefore be removed from the graph in the RestoreActualValues
@@ -1930,13 +1932,18 @@

 class HLeaveInlined V8_FINAL : public HTemplateInstruction<0> {
  public:
-  HLeaveInlined() { }
+  explicit HLeaveInlined(int drop_count) : drop_count_(drop_count) { }

virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
     return Representation::None();
   }
+
+  virtual int argument_delta() const V8_OVERRIDE { return -drop_count_; }

   DECLARE_CONCRETE_INSTRUCTION(LeaveInlined)
+
+ private:
+  int drop_count_;
 };


@@ -1948,6 +1955,7 @@
     return Representation::Tagged();
   }

+  virtual int argument_delta() const V8_OVERRIDE { return 1; }
   HValue* argument() { return OperandAt(0); }

   DECLARE_CONCRETE_INSTRUCTION(PushArgument)
@@ -2097,7 +2105,13 @@
     return HType::Tagged();
   }

-  virtual int argument_count() const { return argument_count_; }
+  virtual int argument_count() const {
+    return argument_count_;
+  }
+
+  virtual int argument_delta() const V8_OVERRIDE {
+    return -argument_count();
+  }

   virtual bool IsCall() V8_FINAL V8_OVERRIDE { return true; }

=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Wed Oct  2 13:24:08 2013 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc     Wed Oct  2 15:27:51 2013 UTC
@@ -216,7 +216,10 @@
       state->inlining_kind() == DROP_EXTRA_ON_RETURN;

   if (block->IsInlineReturnTarget()) {
-    AddInstruction(new(zone()) HLeaveInlined());
+    HEnvironment* env = last_environment();
+    int argument_count = state->entry()->arguments_pushed()
+        ? env->arguments_environment()->parameter_count() : 0;
+    AddInstruction(new(zone()) HLeaveInlined(argument_count));
     UpdateEnvironment(last_environment()->DiscardInlined(drop_extra));
   }

@@ -233,7 +236,10 @@

   ASSERT(target->IsInlineReturnTarget());
   ASSERT(return_value != NULL);
-  AddInstruction(new(zone()) HLeaveInlined());
+  HEnvironment* env = last_environment();
+  int argument_count = state->entry()->arguments_pushed()
+      ? env->arguments_environment()->parameter_count() : 0;
+  AddInstruction(new(zone()) HLeaveInlined(argument_count));
   UpdateEnvironment(last_environment()->DiscardInlined(drop_extra));
   last_environment()->Push(return_value);
   AddNewSimulate(BailoutId::None());
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Wed Oct 2 11:43:41 2013 UTC +++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Wed Oct 2 15:27:51 2013 UTC
@@ -925,6 +925,9 @@
   } else {
     instr = current->CompileToLithium(this);
   }
+
+  argument_count_ += current->argument_delta();
+  ASSERT(argument_count_ >= 0);

   if (instr != NULL) {
     // Associate the hydrogen instruction first, since we may need it for
@@ -1177,7 +1180,6 @@


 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
-  ++argument_count_;
   LOperand* argument = UseAny(instr->argument());
   return new(zone()) LPushArgument(argument);
 }
@@ -1244,7 +1246,6 @@

 LInstruction* LChunkBuilder::DoCallConstantFunction(
     HCallConstantFunction* instr) {
-  argument_count_ -= instr->argument_count();
return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, eax), instr);
 }

@@ -1252,7 +1253,6 @@
 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
   LOperand* context = UseFixed(instr->context(), esi);
   LOperand* function = UseFixed(instr->function(), edi);
-  argument_count_ -= instr->argument_count();
   LInvokeFunction* result = new(zone()) LInvokeFunction(context, function);
return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
 }
@@ -1362,7 +1362,6 @@
   ASSERT(instr->key()->representation().IsTagged());
   LOperand* context = UseFixed(instr->context(), esi);
   LOperand* key = UseFixed(instr->key(), ecx);
-  argument_count_ -= instr->argument_count();
   LCallKeyed* result = new(zone()) LCallKeyed(context, key);
   return MarkAsCall(DefineFixed(result, eax), instr);
 }
@@ -1370,7 +1369,6 @@

 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
   LOperand* context = UseFixed(instr->context(), esi);
-  argument_count_ -= instr->argument_count();
   LCallNamed* result = new(zone()) LCallNamed(context);
   return MarkAsCall(DefineFixed(result, eax), instr);
 }
@@ -1378,14 +1376,12 @@

 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
   LOperand* context = UseFixed(instr->context(), esi);
-  argument_count_ -= instr->argument_count();
   LCallGlobal* result = new(zone()) LCallGlobal(context);
   return MarkAsCall(DefineFixed(result, eax), instr);
 }


 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
-  argument_count_ -= instr->argument_count();
   return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, eax), instr);
 }

@@ -1393,7 +1389,6 @@
 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
   LOperand* context = UseFixed(instr->context(), esi);
   LOperand* constructor = UseFixed(instr->constructor(), edi);
-  argument_count_ -= instr->argument_count();
   LCallNew* result = new(zone()) LCallNew(context, constructor);
   return MarkAsCall(DefineFixed(result, eax), instr);
 }
@@ -1402,7 +1397,6 @@
 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
   LOperand* context = UseFixed(instr->context(), esi);
   LOperand* constructor = UseFixed(instr->constructor(), edi);
-  argument_count_ -= instr->argument_count();
   LCallNewArray* result = new(zone()) LCallNewArray(context, constructor);
   return MarkAsCall(DefineFixed(result, eax), instr);
 }
@@ -1411,14 +1405,12 @@
 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
   LOperand* context = UseFixed(instr->context(), esi);
   LOperand* function = UseFixed(instr->function(), edi);
-  argument_count_ -= instr->argument_count();
   LCallFunction* result = new(zone()) LCallFunction(context, function);
   return MarkAsCall(DefineFixed(result, eax), instr);
 }


 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
-  argument_count_ -= instr->argument_count();
   LOperand* context = UseFixed(instr->context(), esi);
return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), eax), instr);
 }
@@ -2577,7 +2569,6 @@

 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
   LOperand* context = UseFixed(instr->context(), esi);
-  argument_count_ -= instr->argument_count();
   LCallStub* result = new(zone()) LCallStub(context);
   return MarkAsCall(DefineFixed(result, eax), instr);
 }
@@ -2706,7 +2697,7 @@
   if (env->entry()->arguments_pushed()) {
     int argument_count = env->arguments_environment()->parameter_count();
     pop = new(zone()) LDrop(argument_count);
-    argument_count_ -= argument_count;
+    ASSERT(instr->argument_delta() == -argument_count);
   }

   HEnvironment* outer = current_block_->last_environment()->
=======================================
--- /branches/bleeding_edge/src/lithium-codegen.cc Wed Oct 2 11:43:41 2013 UTC +++ /branches/bleeding_edge/src/lithium-codegen.cc Wed Oct 2 15:27:51 2013 UTC
@@ -127,7 +127,7 @@
   // Copy the string before recording it in the assembler to avoid
   // issues when the stack allocated buffer goes out of scope.
   size_t length = builder.position();
-  Vector<char> copy = Vector<char>::New(length + 1);
+  Vector<char> copy = Vector<char>::New(static_cast<int>(length) + 1);
   OS::MemCopy(copy.start(), builder.Finalize(), copy.length());
   masm()->RecordComment(copy.start());
 }
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Wed Oct 2 13:27:53 2013 UTC +++ /branches/bleeding_edge/src/x64/lithium-x64.cc Wed Oct 2 15:27:51 2013 UTC
@@ -876,6 +876,9 @@
   } else {
     instr = current->CompileToLithium(this);
   }
+
+  argument_count_ += current->argument_delta();
+  ASSERT(argument_count_ >= 0);

   if (instr != NULL) {
     // Associate the hydrogen instruction first, since we may need it for
@@ -1102,7 +1105,6 @@


 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
-  ++argument_count_;
   LOperand* argument = UseOrConstant(instr->argument());
   return new(zone()) LPushArgument(argument);
 }
@@ -1168,14 +1170,12 @@

 LInstruction* LChunkBuilder::DoCallConstantFunction(
     HCallConstantFunction* instr) {
-  argument_count_ -= instr->argument_count();
return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, rax), instr);
 }


 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
   LOperand* function = UseFixed(instr->function(), rdi);
-  argument_count_ -= instr->argument_count();
   LInvokeFunction* result = new(zone()) LInvokeFunction(function);
return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
 }
@@ -1277,33 +1277,28 @@
 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
   ASSERT(instr->key()->representation().IsTagged());
   LOperand* key = UseFixed(instr->key(), rcx);
-  argument_count_ -= instr->argument_count();
   LCallKeyed* result = new(zone()) LCallKeyed(key);
   return MarkAsCall(DefineFixed(result, rax), instr);
 }


 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
-  argument_count_ -= instr->argument_count();
   return MarkAsCall(DefineFixed(new(zone()) LCallNamed, rax), instr);
 }


 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
-  argument_count_ -= instr->argument_count();
   return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, rax), instr);
 }


 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
-  argument_count_ -= instr->argument_count();
   return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, rax), instr);
 }


 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
   LOperand* constructor = UseFixed(instr->constructor(), rdi);
-  argument_count_ -= instr->argument_count();
   LCallNew* result = new(zone()) LCallNew(constructor);
   return MarkAsCall(DefineFixed(result, rax), instr);
 }
@@ -1311,7 +1306,6 @@

 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
   LOperand* constructor = UseFixed(instr->constructor(), rdi);
-  argument_count_ -= instr->argument_count();
   LCallNewArray* result = new(zone()) LCallNewArray(constructor);
   return MarkAsCall(DefineFixed(result, rax), instr);
 }
@@ -1319,14 +1313,12 @@

 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
   LOperand* function = UseFixed(instr->function(), rdi);
-  argument_count_ -= instr->argument_count();
   LCallFunction* result = new(zone()) LCallFunction(function);
   return MarkAsCall(DefineFixed(result, rax), instr);
 }


 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
-  argument_count_ -= instr->argument_count();
   return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, rax), instr);
 }

@@ -2396,7 +2388,6 @@


 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
-  argument_count_ -= instr->argument_count();
   return MarkAsCall(DefineFixed(new(zone()) LCallStub, rax), instr);
 }

@@ -2518,7 +2509,7 @@
   if (env->entry()->arguments_pushed()) {
     int argument_count = env->arguments_environment()->parameter_count();
     pop = new(zone()) LDrop(argument_count);
-    argument_count_ -= argument_count;
+    ASSERT(instr->argument_delta() == -argument_count);
   }

   HEnvironment* outer = current_block_->last_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