Revision: 11997
Author:   [email protected]
Date:     Fri Jul  6 01:34:48 2012
Log:      Slightly generalize AddCheckConstantFunction.

This is needed for crankshafted accessors, which are syntactically not a Call.

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

Modified:
 /branches/bleeding_edge/src/ast.h
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/hydrogen.h

=======================================
--- /branches/bleeding_edge/src/ast.h   Wed Jun 20 01:58:41 2012
+++ /branches/bleeding_edge/src/ast.h   Fri Jul  6 01:34:48 2012
@@ -1584,7 +1584,12 @@
   virtual bool IsMonomorphic() { return is_monomorphic_; }
   CheckType check_type() const { return check_type_; }
   Handle<JSFunction> target() { return target_; }
+
+ // A cache for the holder, set as a side effect of computing the target of the + // call. Note that it contains the null handle when the receiver is the same
+  // as the holder!
   Handle<JSObject> holder() { return holder_; }
+
   Handle<JSGlobalPropertyCell> cell() { return cell_; }

   bool ComputeTarget(Handle<Map> type, Handle<String> name);
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Thu Jul  5 06:54:20 2012
+++ /branches/bleeding_edge/src/hydrogen.cc     Fri Jul  6 01:34:48 2012
@@ -6284,7 +6284,7 @@
 }


-void HGraphBuilder::AddCheckConstantFunction(Call* expr,
+void HGraphBuilder::AddCheckConstantFunction(Handle<JSObject> holder,
                                              HValue* receiver,
                                              Handle<Map> receiver_map,
                                              bool smi_and_map_check) {
@@ -6296,10 +6296,9 @@
     AddInstruction(HCheckMaps::NewWithTransitions(receiver, receiver_map,
                                                   zone()));
   }
-  if (!expr->holder().is_null()) {
+  if (!holder.is_null()) {
     AddInstruction(new(zone()) HCheckPrototypeMaps(
-        Handle<JSObject>(JSObject::cast(receiver_map->prototype())),
-        expr->holder()));
+ Handle<JSObject>(JSObject::cast(receiver_map->prototype())), holder));
   }
 }

@@ -6382,7 +6381,7 @@

     set_current_block(if_true);
     expr->ComputeTarget(map, name);
-    AddCheckConstantFunction(expr, receiver, map, false);
+    AddCheckConstantFunction(expr->holder(), receiver, map, false);
     if (FLAG_trace_inlining && FLAG_polymorphic_inlining) {
       Handle<JSFunction> caller = info()->closure();
       SmartArrayPointer<char> caller_name =
@@ -6889,7 +6888,7 @@
     case kMathCos:
     case kMathTan:
       if (argument_count == 2 && check_type == RECEIVER_MAP_CHECK) {
-        AddCheckConstantFunction(expr, receiver, receiver_map, true);
+ AddCheckConstantFunction(expr->holder(), receiver, receiver_map, true);
         HValue* argument = Pop();
         HValue* context = environment()->LookupContext();
         Drop(1);  // Receiver.
@@ -6902,7 +6901,7 @@
       break;
     case kMathPow:
       if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) {
-        AddCheckConstantFunction(expr, receiver, receiver_map, true);
+ AddCheckConstantFunction(expr->holder(), receiver, receiver_map, true);
         HValue* right = Pop();
         HValue* left = Pop();
         Pop();  // Pop receiver.
@@ -6944,7 +6943,7 @@
       break;
     case kMathRandom:
       if (argument_count == 1 && check_type == RECEIVER_MAP_CHECK) {
-        AddCheckConstantFunction(expr, receiver, receiver_map, true);
+ AddCheckConstantFunction(expr->holder(), receiver, receiver_map, true);
         Drop(1);  // Receiver.
         HValue* context = environment()->LookupContext();
         HGlobalObject* global_object = new(zone()) HGlobalObject(context);
@@ -6957,7 +6956,7 @@
     case kMathMax:
     case kMathMin:
       if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) {
-        AddCheckConstantFunction(expr, receiver, receiver_map, true);
+ AddCheckConstantFunction(expr->holder(), receiver, receiver_map, true);
         HValue* right = Pop();
         HValue* left = Pop();
         Pop();  // Pop receiver.
@@ -7073,7 +7072,7 @@
   VisitForValue(prop->obj());
   if (HasStackOverflow() || current_block() == NULL) return true;
   HValue* function = Top();
-  AddCheckConstantFunction(expr, function, function_map, true);
+  AddCheckConstantFunction(expr->holder(), function, function_map, true);
   Drop(1);

   VisitForValue(args->at(0));
@@ -7192,7 +7191,7 @@
         call = PreProcessCall(
             new(zone()) HCallNamed(context, name, argument_count));
       } else {
-        AddCheckConstantFunction(expr, receiver, receiver_map, true);
+ AddCheckConstantFunction(expr->holder(), receiver, receiver_map, true);

         if (TryInlineCall(expr)) return;
         call = PreProcessCall(
=======================================
--- /branches/bleeding_edge/src/hydrogen.h      Tue Jul  3 03:42:03 2012
+++ /branches/bleeding_edge/src/hydrogen.h      Fri Jul  6 01:34:48 2012
@@ -1165,7 +1165,7 @@

   HInstruction* BuildThisFunction();

-  void AddCheckConstantFunction(Call* expr,
+  void AddCheckConstantFunction(Handle<JSObject> holder,
                                 HValue* receiver,
                                 Handle<Map> receiver_map,
                                 bool smi_and_map_check);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to