Reviewers: mvstanton,

Description:
Make sure HCallNewArray uses right ElementsKind

Close a small gc window that exists between when a HNewArrayCall instruction is
created and the ElementsKind type feedback for the construction function is
accesses.

[email protected]

Please review this at https://codereview.chromium.org/18059005/

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

Affected files:
  M src/hydrogen-instructions.h
  M src/hydrogen.cc


Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index c765d62cd75b06220e9c84b9ad583bc613bd3019..950f6a28152063a842b109e04475f8cb520d3de9 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -2488,12 +2488,10 @@ class HCallNew: public HBinaryCall {
 class HCallNewArray: public HCallNew {
  public:
   HCallNewArray(HValue* context, HValue* constructor, int argument_count,
-                Handle<Cell> type_cell)
+                Handle<Cell> type_cell, ElementsKind elements_kind)
       : HCallNew(context, constructor, argument_count),
-        type_cell_(type_cell) {
-    elements_kind_ = static_cast<ElementsKind>(
-        Smi::cast(type_cell->value())->value());
-  }
+        elements_kind_(elements_kind),
+        type_cell_(type_cell) {}

   Handle<Cell> property_cell() const {
     return type_cell_;
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 0fe0173428534f77253488f03cd10dea7049f436..870aa83ae89c275b7fc6ebc4c6260c5a14f1b0ed 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -8873,7 +8873,7 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
       Handle<Cell> cell = expr->allocation_info_cell();
AddInstruction(new(zone()) HCheckFunction(constructor, array_function)); call = new(zone()) HCallNewArray(context, constructor, argument_count,
-                                       cell);
+                                       cell, expr->elements_kind());
     } else {
       call = new(zone()) HCallNew(context, constructor, argument_count);
     }


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