Revision: 15241
Author:   [email protected]
Date:     Thu Jun 20 06:09:43 2013
Log:      Add soft-deopt for uninitialized assignment

[email protected]

Review URL: https://chromiumcodereview.appspot.com/17071002
http://code.google.com/p/v8/source/detail?r=15241

Modified:
 /branches/bleeding_edge/src/ast.cc
 /branches/bleeding_edge/src/ast.h
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/type-info.cc
 /branches/bleeding_edge/src/type-info.h

=======================================
--- /branches/bleeding_edge/src/ast.cc  Fri Jun 14 10:02:39 2013
+++ /branches/bleeding_edge/src/ast.cc  Thu Jun 20 06:09:43 2013
@@ -135,6 +135,7 @@
       binary_operation_(NULL),
       assignment_id_(GetNextId(isolate)),
       is_monomorphic_(false),
+      is_uninitialized_(false),
       store_mode_(STANDARD_STORE) { }


@@ -465,6 +466,8 @@
   Property* prop = target()->AsProperty();
   ASSERT(prop != NULL);
   TypeFeedbackId id = AssignmentFeedbackId();
+  is_uninitialized_ = oracle->StoreIsUninitialized(id);
+  if (is_uninitialized_) return;
   is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id);
   receiver_types_.Clear();
   if (prop->key()->IsPropertyName()) {
=======================================
--- /branches/bleeding_edge/src/ast.h   Fri Jun 14 10:02:39 2013
+++ /branches/bleeding_edge/src/ast.h   Thu Jun 20 06:09:43 2013
@@ -2096,6 +2096,7 @@
   TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); }
   void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
   virtual bool IsMonomorphic() { return is_monomorphic_; }
+  bool IsUninitialized() { return is_uninitialized_; }
   virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
   virtual KeyedAccessStoreMode GetStoreMode() {
     return store_mode_;
@@ -2126,6 +2127,7 @@
   const BailoutId assignment_id_;

   bool is_monomorphic_ : 1;
+  bool is_uninitialized_ : 1;
   KeyedAccessStoreMode store_mode_ : 5;  // Windows treats as signed,
                                          // must have extra bit.
   SmallMapList receiver_types_;
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Thu Jun 20 03:48:14 2013
+++ /branches/bleeding_edge/src/hydrogen.cc     Thu Jun 20 06:09:43 2013
@@ -6516,6 +6516,7 @@
     HValue* value = environment()->ExpressionStackAt(0);
     HValue* object = environment()->ExpressionStackAt(1);

+    if (expr->IsUninitialized()) AddSoftDeoptimize();
     return BuildStoreNamed(expr, expr->id(), expr->position(),
                            expr->AssignmentId(), prop, object, value);
   } else {
@@ -6988,8 +6989,6 @@
     Property* expr) {
   if (expr->IsUninitialized()) {
     AddSoftDeoptimize();
-  } else {
-    // OS::DebugBreak();
   }
   HValue* context = environment()->LookupContext();
   return new(zone()) HLoadNamedGeneric(context, object, name);
=======================================
--- /branches/bleeding_edge/src/type-info.cc    Thu Jun 20 05:07:56 2013
+++ /branches/bleeding_edge/src/type-info.cc    Thu Jun 20 06:09:43 2013
@@ -136,6 +136,15 @@
   }
   return false;
 }
+
+
+bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) {
+  Handle<Object> map_or_code = GetInfo(ast_id);
+  if (map_or_code->IsMap()) return false;
+  if (!map_or_code->IsCode()) return true;
+  Handle<Code> code = Handle<Code>::cast(map_or_code);
+  return code->ic_state() == UNINITIALIZED;
+}


 bool TypeFeedbackOracle::StoreIsMonomorphicNormal(TypeFeedbackId ast_id) {
=======================================
--- /branches/bleeding_edge/src/type-info.h     Fri Jun 14 10:02:39 2013
+++ /branches/bleeding_edge/src/type-info.h     Thu Jun 20 06:09:43 2013
@@ -244,6 +244,7 @@
   bool LoadIsMonomorphicNormal(Property* expr);
   bool LoadIsUninitialized(Property* expr);
   bool LoadIsPolymorphic(Property* expr);
+  bool StoreIsUninitialized(TypeFeedbackId ast_id);
   bool StoreIsMonomorphicNormal(TypeFeedbackId ast_id);
   bool StoreIsPolymorphic(TypeFeedbackId ast_id);
   bool CallIsMonomorphic(Call* expr);

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