Make sure HCallNewArray uses right ElementsKind
authordanno@chromium.org <danno@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 27 Jun 2013 14:22:07 +0000 (14:22 +0000)
committerdanno@chromium.org <danno@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 27 Jun 2013 14:22:07 +0000 (14:22 +0000)
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.

R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/18059005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15359 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/hydrogen-instructions.h
src/hydrogen.cc

index c765d62..950f6a2 100644 (file)
@@ -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 0fe0173..870aa83 100644 (file)
@@ -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);
     }