Revision: 17814
Author: [email protected]
Date: Mon Nov 18 08:39:25 2013 UTC
Log: Merged r17599 into 3.22 branch.
Do not add values to HGraph in Lithium.
BUG=298269
[email protected]
Review URL: https://chromiumcodereview.appspot.com/74893004
http://code.google.com/p/v8/source/detail?r=17814
Added:
/branches/3.22/test/mjsunit/regress/regress-298269.js
Modified:
/branches/3.22/src/arm/lithium-arm.cc
/branches/3.22/src/arm/lithium-arm.h
/branches/3.22/src/arm/lithium-codegen-arm.cc
/branches/3.22/src/hydrogen.cc
/branches/3.22/src/hydrogen.h
/branches/3.22/src/ia32/lithium-codegen-ia32.cc
/branches/3.22/src/ia32/lithium-ia32.cc
/branches/3.22/src/ia32/lithium-ia32.h
/branches/3.22/src/lithium.cc
/branches/3.22/src/mips/lithium-codegen-mips.cc
/branches/3.22/src/mips/lithium-mips.cc
/branches/3.22/src/mips/lithium-mips.h
/branches/3.22/src/version.cc
/branches/3.22/src/x64/lithium-codegen-x64.cc
/branches/3.22/src/x64/lithium-x64.cc
/branches/3.22/src/x64/lithium-x64.h
=======================================
--- /dev/null
+++ /branches/3.22/test/mjsunit/regress/regress-298269.js Mon Nov 18
08:39:25 2013 UTC
@@ -0,0 +1,45 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+function Cb(a) {
+ var f, g;
+ for(f = a.length; f--;) {
+ g = a.charCodeAt(f);
+ // This will fail after OSR if Runtime_StringCharCodeAt is modified
+ // to iterates optimized frames and visit safepoint pointers.
+ }
+ return g;
+}
+
+var s1 = "long string to make cons string 1";
+var s2 = "long string to make cons string 2";
+Cb(s1 + s2);
+Cb(s1);
+var s3 = "string for triggering osr in Cb";
+for (var i = 0; i < 16; i++) s3 = s3 + s3;
+Cb(s3);
+Cb(s1 + s2);
=======================================
--- /branches/3.22/src/arm/lithium-arm.cc Thu Oct 31 13:30:00 2013 UTC
+++ /branches/3.22/src/arm/lithium-arm.cc Mon Nov 18 08:39:25 2013 UTC
@@ -863,10 +863,12 @@
LInstruction* instr = NULL;
if (current->CanReplaceWithDummyUses()) {
- HValue* first_operand = current->OperandCount() == 0
- ? graph()->GetConstant1()
- : current->OperandAt(0);
- instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand)));
+ if (current->OperandCount() == 0) {
+ instr = DefineAsRegister(new(zone()) LDummy());
+ } else {
+ instr = DefineAsRegister(new(zone())
+ LDummyUse(UseAny(current->OperandAt(0))));
+ }
for (int i = 1; i < current->OperandCount(); ++i) {
LInstruction* dummy =
new(zone()) LDummyUse(UseAny(current->OperandAt(i)));
=======================================
--- /branches/3.22/src/arm/lithium-arm.h Thu Oct 31 13:30:00 2013 UTC
+++ /branches/3.22/src/arm/lithium-arm.h Mon Nov 18 08:39:25 2013 UTC
@@ -91,6 +91,7 @@
V(DoubleToI) \
V(DoubleToSmi) \
V(Drop) \
+ V(Dummy) \
V(DummyUse) \
V(ElementsKind) \
V(ForInCacheArray) \
@@ -423,6 +424,13 @@
};
+class LDummy V8_FINAL : public LTemplateInstruction<1, 0, 0> {
+ public:
+ explicit LDummy() { }
+ DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy")
+};
+
+
class LDummyUse V8_FINAL : public LTemplateInstruction<1, 1, 0> {
public:
explicit LDummyUse(LOperand* value) {
=======================================
--- /branches/3.22/src/arm/lithium-codegen-arm.cc Thu Oct 31 13:30:00 2013
UTC
+++ /branches/3.22/src/arm/lithium-codegen-arm.cc Mon Nov 18 08:39:25 2013
UTC
@@ -5648,6 +5648,11 @@
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
DeoptimizeIf(al, instr->environment(), type);
}
+
+
+void LCodeGen::DoDummy(LDummy* instr) {
+ // Nothing to see here, move on!
+}
void LCodeGen::DoDummyUse(LDummyUse* instr) {
=======================================
--- /branches/3.22/src/hydrogen.cc Fri Nov 15 10:35:47 2013 UTC
+++ /branches/3.22/src/hydrogen.cc Mon Nov 18 08:39:25 2013 UTC
@@ -708,6 +708,21 @@
#undef DEFINE_GET_CONSTANT
+#define DEFINE_IS_CONSTANT(Name,
name) \
+bool HGraph::IsConstant##Name(HConstant* constant)
{ \
+ return constant_##name##_.is_set() && constant ==
constant_##name##_.get(); \
+}
+DEFINE_IS_CONSTANT(Undefined, undefined)
+DEFINE_IS_CONSTANT(0, 0)
+DEFINE_IS_CONSTANT(1, 1)
+DEFINE_IS_CONSTANT(Minus1, minus1)
+DEFINE_IS_CONSTANT(True, true)
+DEFINE_IS_CONSTANT(False, false)
+DEFINE_IS_CONSTANT(Hole, the_hole)
+DEFINE_IS_CONSTANT(Null, null)
+
+#undef DEFINE_IS_CONSTANT
+
HConstant* HGraph::GetInvalidContext() {
return GetConstant(&constant_invalid_context_, 0xFFFFC0C7);
@@ -715,14 +730,14 @@
bool HGraph::IsStandardConstant(HConstant* constant) {
- if (constant == GetConstantUndefined()) return true;
- if (constant == GetConstant0()) return true;
- if (constant == GetConstant1()) return true;
- if (constant == GetConstantMinus1()) return true;
- if (constant == GetConstantTrue()) return true;
- if (constant == GetConstantFalse()) return true;
- if (constant == GetConstantHole()) return true;
- if (constant == GetConstantNull()) return true;
+ if (IsConstantUndefined(constant)) return true;
+ if (IsConstant0(constant)) return true;
+ if (IsConstant1(constant)) return true;
+ if (IsConstantMinus1(constant)) return true;
+ if (IsConstantTrue(constant)) return true;
+ if (IsConstantFalse(constant)) return true;
+ if (IsConstantHole(constant)) return true;
+ if (IsConstantNull(constant)) return true;
return false;
}
@@ -2281,7 +2296,8 @@
depends_on_empty_array_proto_elements_(false),
type_change_checksum_(0),
maximum_environment_size_(0),
- no_side_effects_scope_count_(0) {
+ no_side_effects_scope_count_(0),
+ disallow_adding_new_values_(false) {
if (info->IsStub()) {
HydrogenCodeStub* stub = info->code_stub();
CodeStubInterfaceDescriptor* descriptor =
=======================================
--- /branches/3.22/src/hydrogen.h Thu Oct 24 06:31:36 2013 UTC
+++ /branches/3.22/src/hydrogen.h Mon Nov 18 08:39:25 2013 UTC
@@ -352,6 +352,14 @@
HConstant* GetConstantNull();
HConstant* GetInvalidContext();
+ bool IsConstantUndefined(HConstant* constant);
+ bool IsConstant0(HConstant* constant);
+ bool IsConstant1(HConstant* constant);
+ bool IsConstantMinus1(HConstant* constant);
+ bool IsConstantTrue(HConstant* constant);
+ bool IsConstantFalse(HConstant* constant);
+ bool IsConstantHole(HConstant* constant);
+ bool IsConstantNull(HConstant* constant);
bool IsStandardConstant(HConstant* constant);
HBasicBlock* CreateBasicBlock();
@@ -366,6 +374,7 @@
int GetMaximumValueID() const { return values_.length(); }
int GetNextBlockID() { return next_block_id_++; }
int GetNextValueID(HValue* value) {
+ ASSERT(!disallow_adding_new_values_);
values_.Add(value, zone());
return values_.length() - 1;
}
@@ -373,6 +382,9 @@
if (id >= 0 && id < values_.length()) return values_[id];
return NULL;
}
+ void DisallowAddingNewValues() {
+ disallow_adding_new_values_ = true;
+ }
bool Optimize(BailoutReason* bailout_reason);
@@ -499,6 +511,7 @@
int type_change_checksum_;
int maximum_environment_size_;
int no_side_effects_scope_count_;
+ bool disallow_adding_new_values_;
DISALLOW_COPY_AND_ASSIGN(HGraph);
};
=======================================
--- /branches/3.22/src/ia32/lithium-codegen-ia32.cc Thu Oct 31 13:30:00
2013 UTC
+++ /branches/3.22/src/ia32/lithium-codegen-ia32.cc Mon Nov 18 08:39:25
2013 UTC
@@ -6214,6 +6214,11 @@
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
DeoptimizeIf(no_condition, instr->environment(), type);
}
+
+
+void LCodeGen::DoDummy(LDummy* instr) {
+ // Nothing to see here, move on!
+}
void LCodeGen::DoDummyUse(LDummyUse* instr) {
=======================================
--- /branches/3.22/src/ia32/lithium-ia32.cc Thu Oct 31 13:30:00 2013 UTC
+++ /branches/3.22/src/ia32/lithium-ia32.cc Mon Nov 18 08:39:25 2013 UTC
@@ -916,10 +916,12 @@
LInstruction* instr = NULL;
if (current->CanReplaceWithDummyUses()) {
- HValue* first_operand = current->OperandCount() == 0
- ? graph()->GetConstant1()
- : current->OperandAt(0);
- instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand)));
+ if (current->OperandCount() == 0) {
+ instr = DefineAsRegister(new(zone()) LDummy());
+ } else {
+ instr = DefineAsRegister(new(zone())
+ LDummyUse(UseAny(current->OperandAt(0))));
+ }
for (int i = 1; i < current->OperandCount(); ++i) {
LInstruction* dummy =
new(zone()) LDummyUse(UseAny(current->OperandAt(i)));
=======================================
--- /branches/3.22/src/ia32/lithium-ia32.h Thu Oct 31 13:30:00 2013 UTC
+++ /branches/3.22/src/ia32/lithium-ia32.h Mon Nov 18 08:39:25 2013 UTC
@@ -93,6 +93,7 @@
V(DoubleToI) \
V(DoubleToSmi) \
V(Drop) \
+ V(Dummy) \
V(DummyUse) \
V(ElementsKind) \
V(ForInCacheArray) \
@@ -431,6 +432,13 @@
};
+class LDummy V8_FINAL : public LTemplateInstruction<1, 0, 0> {
+ public:
+ explicit LDummy() { }
+ DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy")
+};
+
+
class LDummyUse V8_FINAL : public LTemplateInstruction<1, 1, 0> {
public:
explicit LDummyUse(LOperand* value) {
=======================================
--- /branches/3.22/src/lithium.cc Tue Oct 22 08:00:09 2013 UTC
+++ /branches/3.22/src/lithium.cc Mon Nov 18 08:39:25 2013 UTC
@@ -422,6 +422,7 @@
LChunk* LChunk::NewChunk(HGraph* graph) {
DisallowHandleAllocation no_handles;
DisallowHeapAllocation no_gc;
+ graph->DisallowAddingNewValues();
int values = graph->GetMaximumValueID();
CompilationInfo* info = graph->info();
if (values > LUnallocated::kMaxVirtualRegisters) {
=======================================
--- /branches/3.22/src/mips/lithium-codegen-mips.cc Tue Nov 5 17:38:56
2013 UTC
+++ /branches/3.22/src/mips/lithium-codegen-mips.cc Mon Nov 18 08:39:25
2013 UTC
@@ -5640,6 +5640,11 @@
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
DeoptimizeIf(al, instr->environment(), type, zero_reg,
Operand(zero_reg));
}
+
+
+void LCodeGen::DoDummy(LDummy* instr) {
+ // Nothing to see here, move on!
+}
void LCodeGen::DoDummyUse(LDummyUse* instr) {
=======================================
--- /branches/3.22/src/mips/lithium-mips.cc Tue Nov 5 17:38:56 2013 UTC
+++ /branches/3.22/src/mips/lithium-mips.cc Mon Nov 18 08:39:25 2013 UTC
@@ -868,10 +868,12 @@
LInstruction* instr = NULL;
if (current->CanReplaceWithDummyUses()) {
- HValue* first_operand = current->OperandCount() == 0
- ? graph()->GetConstant1()
- : current->OperandAt(0);
- instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand)));
+ if (current->OperandCount() == 0) {
+ instr = DefineAsRegister(new(zone()) LDummy());
+ } else {
+ instr = DefineAsRegister(new(zone())
+ LDummyUse(UseAny(current->OperandAt(0))));
+ }
for (int i = 1; i < current->OperandCount(); ++i) {
LInstruction* dummy =
new(zone()) LDummyUse(UseAny(current->OperandAt(i)));
=======================================
--- /branches/3.22/src/mips/lithium-mips.h Tue Nov 5 17:38:56 2013 UTC
+++ /branches/3.22/src/mips/lithium-mips.h Mon Nov 18 08:39:25 2013 UTC
@@ -91,6 +91,7 @@
V(DoubleToI) \
V(DoubleToSmi) \
V(Drop) \
+ V(Dummy) \
V(DummyUse) \
V(ElementsKind) \
V(ForInCacheArray) \
@@ -420,6 +421,13 @@
};
+class LDummy V8_FINAL : public LTemplateInstruction<1, 0, 0> {
+ public:
+ explicit LDummy() { }
+ DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy")
+};
+
+
class LDummyUse V8_FINAL : public LTemplateInstruction<1, 1, 0> {
public:
explicit LDummyUse(LOperand* value) {
=======================================
--- /branches/3.22/src/version.cc Fri Nov 15 10:35:47 2013 UTC
+++ /branches/3.22/src/version.cc Mon Nov 18 08:39:25 2013 UTC
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 22
#define BUILD_NUMBER 24
-#define PATCH_LEVEL 4
+#define PATCH_LEVEL 5
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0
=======================================
--- /branches/3.22/src/x64/lithium-codegen-x64.cc Thu Oct 31 13:30:00 2013
UTC
+++ /branches/3.22/src/x64/lithium-codegen-x64.cc Mon Nov 18 08:39:25 2013
UTC
@@ -5302,6 +5302,11 @@
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
DeoptimizeIf(no_condition, instr->environment(), type);
}
+
+
+void LCodeGen::DoDummy(LDummy* instr) {
+ // Nothing to see here, move on!
+}
void LCodeGen::DoDummyUse(LDummyUse* instr) {
=======================================
--- /branches/3.22/src/x64/lithium-x64.cc Thu Oct 31 13:30:00 2013 UTC
+++ /branches/3.22/src/x64/lithium-x64.cc Mon Nov 18 08:39:25 2013 UTC
@@ -862,10 +862,12 @@
LInstruction* instr = NULL;
if (current->CanReplaceWithDummyUses()) {
- HValue* first_operand = current->OperandCount() == 0
- ? graph()->GetConstant1()
- : current->OperandAt(0);
- instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand)));
+ if (current->OperandCount() == 0) {
+ instr = DefineAsRegister(new(zone()) LDummy());
+ } else {
+ instr = DefineAsRegister(new(zone())
+ LDummyUse(UseAny(current->OperandAt(0))));
+ }
for (int i = 1; i < current->OperandCount(); ++i) {
LInstruction* dummy =
new(zone()) LDummyUse(UseAny(current->OperandAt(i)));
=======================================
--- /branches/3.22/src/x64/lithium-x64.h Thu Oct 31 13:30:00 2013 UTC
+++ /branches/3.22/src/x64/lithium-x64.h Mon Nov 18 08:39:25 2013 UTC
@@ -92,6 +92,7 @@
V(DoubleToSmi) \
V(Drop) \
V(DummyUse) \
+ V(Dummy) \
V(ElementsKind) \
V(ForInCacheArray) \
V(ForInPrepareMap) \
@@ -422,6 +423,13 @@
};
+class LDummy V8_FINAL : public LTemplateInstruction<1, 0, 0> {
+ public:
+ explicit LDummy() { }
+ DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy")
+};
+
+
class LDummyUse V8_FINAL : public LTemplateInstruction<1, 1, 0> {
public:
explicit LDummyUse(LOperand* value) {
--
--
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.