Reviewers: Jakob,

Description:
Merged r17599 into 3.21 branch.

Do not add values to HGraph in Lithium.

BUG=298269
[email protected]

Please review this at https://chromiumcodereview.appspot.com/82553010/

SVN Base: https://v8.googlecode.com/svn/branches/3.21

Affected files (+43, -13 lines):
  M src/hydrogen.h
  M src/hydrogen.cc
  M src/lithium.cc
  M src/version.cc


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index a4e76b140c718d68fc100c1b5d27ce1ccef79ecf..0b4fb26c199cd6f411f4d7af7b13470e32d20b6b 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -671,6 +671,21 @@ DEFINE_GET_CONSTANT(Null, null, HType::Tagged(), false)

 #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);
@@ -678,14 +693,14 @@ HConstant* HGraph::GetInvalidContext() {


 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;
 }

@@ -2113,7 +2128,8 @@ HGraph::HGraph(CompilationInfo* info)
       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 =
Index: src/hydrogen.h
diff --git a/src/hydrogen.h b/src/hydrogen.h
index c1dafa8b5a7a73171c3c6c693f60210656ccac27..0ecbbca1bf66cc24f80b614fbfd406fa9cedd4ea 100644
--- a/src/hydrogen.h
+++ b/src/hydrogen.h
@@ -333,9 +333,9 @@ class HGraph V8_FINAL : public ZoneObject {
   void CollectPhis();

   void set_undefined_constant(HConstant* constant) {
-    undefined_constant_.set(constant);
+    constant_undefined_.set(constant);
   }
- HConstant* GetConstantUndefined() const { return undefined_constant_.get(); } + HConstant* GetConstantUndefined() const { return constant_undefined_.get(); }
   HConstant* GetConstant0();
   HConstant* GetConstant1();
   HConstant* GetConstantMinus1();
@@ -345,6 +345,14 @@ class HGraph V8_FINAL : public ZoneObject {
   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();
@@ -359,6 +367,7 @@ class HGraph V8_FINAL : public ZoneObject {
   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;
   }
@@ -366,6 +375,9 @@ class HGraph V8_FINAL : public ZoneObject {
     if (id >= 0 && id < values_.length()) return values_[id];
     return NULL;
   }
+  void DisallowAddingNewValues() {
+    disallow_adding_new_values_ = true;
+  }

   bool Optimize(BailoutReason* bailout_reason);

@@ -477,7 +489,7 @@ class HGraph V8_FINAL : public ZoneObject {
   ZoneList<HValue*> values_;
   ZoneList<HPhi*>* phi_list_;
   ZoneList<HInstruction*>* uint32_instructions_;
-  SetOncePointer<HConstant> undefined_constant_;
+  SetOncePointer<HConstant> constant_undefined_;
   SetOncePointer<HConstant> constant_0_;
   SetOncePointer<HConstant> constant_1_;
   SetOncePointer<HConstant> constant_minus1_;
@@ -500,6 +512,7 @@ class HGraph V8_FINAL : public ZoneObject {
   int type_change_checksum_;
   int maximum_environment_size_;
   int no_side_effects_scope_count_;
+  bool disallow_adding_new_values_;

   DISALLOW_COPY_AND_ASSIGN(HGraph);
 };
Index: src/lithium.cc
diff --git a/src/lithium.cc b/src/lithium.cc
index e2cadf3ec4d8027aed20261baa85efed07e86397..95310bffd3fdbd4d89735c44192daa0bce54a17b 100644
--- a/src/lithium.cc
+++ b/src/lithium.cc
@@ -392,6 +392,7 @@ Representation LChunk::LookupLiteralRepresentation(
 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) {
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index 83109de104ef7f35e87c36e6b4d41ae618d57352..7f7cb0156d0471b09b0a0d3f0745463122734d26 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     21
 #define BUILD_NUMBER      18
-#define PATCH_LEVEL       12
+#define PATCH_LEVEL       13
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0


--
--
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