Revision: 19998
Author:   [email protected]
Date:     Mon Mar 17 13:55:22 2014 UTC
Log: Utility functions for pretenure call new. These functions aren't yet called in the tree but will be in the next days. AssertUndefinedOrAllocationSite is to be used in several places where AllocationSite feedback is optional.

[email protected]

Review URL: https://codereview.chromium.org/197643008
http://code.google.com/p/v8/source/detail?r=19998

Modified:
 /branches/bleeding_edge/src/a64/macro-assembler-a64.cc
 /branches/bleeding_edge/src/a64/macro-assembler-a64.h
 /branches/bleeding_edge/src/arm/macro-assembler-arm.cc
 /branches/bleeding_edge/src/arm/macro-assembler-arm.h
 /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc
 /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.h

=======================================
--- /branches/bleeding_edge/src/a64/macro-assembler-a64.cc Thu Mar 13 15:53:08 2014 UTC +++ /branches/bleeding_edge/src/a64/macro-assembler-a64.cc Mon Mar 17 13:55:22 2014 UTC
@@ -1526,6 +1526,20 @@
     Check(ls, kOperandIsNotAName);
   }
 }
+
+
+void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
+                                                     Register scratch) {
+  if (emit_debug_code()) {
+    Label done_checking;
+    AssertNotSmi(object);
+    JumpIfRoot(object, Heap::kUndefinedValueRootIndex, &done_checking);
+    Ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
+    CompareRoot(scratch, Heap::kAllocationSiteMapRootIndex);
+    Assert(eq, kExpectedUndefinedOrCell);
+    Bind(&done_checking);
+  }
+}


 void MacroAssembler::AssertString(Register object) {
=======================================
--- /branches/bleeding_edge/src/a64/macro-assembler-a64.h Thu Mar 13 13:18:48 2014 UTC +++ /branches/bleeding_edge/src/a64/macro-assembler-a64.h Mon Mar 17 13:55:22 2014 UTC
@@ -886,6 +886,10 @@
   // Abort execution if argument is not a name, enabled via --debug-code.
   void AssertName(Register object);

+ // Abort execution if argument is not undefined or an AllocationSite, enabled
+  // via --debug-code.
+  void AssertUndefinedOrAllocationSite(Register object, Register scratch);
+
   // Abort execution if argument is not a string, enabled via --debug-code.
   void AssertString(Register object);

=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Wed Mar 12 15:56:16 2014 UTC +++ /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Mon Mar 17 13:55:22 2014 UTC
@@ -3031,6 +3031,20 @@
   }
 }

+
+void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
+                                                     Register scratch) {
+  if (emit_debug_code()) {
+    Label done_checking;
+    AssertNotSmi(object);
+    CompareRoot(object, Heap::kUndefinedValueRootIndex);
+    b(eq, &done_checking);
+    ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
+    CompareRoot(scratch, Heap::kAllocationSiteMapRootIndex);
+    Assert(eq, kExpectedUndefinedOrCell);
+    bind(&done_checking);
+  }
+}


void MacroAssembler::AssertIsRoot(Register reg, Heap::RootListIndex index) {
=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.h Wed Mar 12 15:56:16 2014 UTC +++ /branches/bleeding_edge/src/arm/macro-assembler-arm.h Mon Mar 17 13:55:22 2014 UTC
@@ -1290,6 +1290,10 @@
   // Abort execution if argument is not a name, enabled via --debug-code.
   void AssertName(Register object);

+ // Abort execution if argument is not undefined or an AllocationSite, enabled
+  // via --debug-code.
+  void AssertUndefinedOrAllocationSite(Register object, Register scratch);
+
   // Abort execution if reg is not the root value with the given index,
   // enabled via --debug-code.
   void AssertIsRoot(Register reg, Heap::RootListIndex index);
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Tue Mar 11 08:52:48 2014 UTC +++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Mon Mar 17 13:55:22 2014 UTC
@@ -1035,6 +1035,20 @@
     Check(below_equal, kOperandIsNotAName);
   }
 }
+
+
+void MacroAssembler::AssertUndefinedOrAllocationSite(Register object) {
+  if (emit_debug_code()) {
+    Label done_checking;
+    AssertNotSmi(object);
+    cmp(object, isolate()->factory()->undefined_value());
+    j(equal, &done_checking);
+    cmp(FieldOperand(object, 0),
+        Immediate(isolate()->factory()->allocation_site_map()));
+    Assert(equal, kExpectedUndefinedOrCell);
+    bind(&done_checking);
+  }
+}


 void MacroAssembler::AssertNotSmi(Register object) {
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Tue Mar 11 08:52:48 2014 UTC +++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Mon Mar 17 13:55:22 2014 UTC
@@ -549,6 +549,10 @@
   // Abort execution if argument is not a name, enabled via --debug-code.
   void AssertName(Register object);

+ // Abort execution if argument is not undefined or an AllocationSite, enabled
+  // via --debug-code.
+  void AssertUndefinedOrAllocationSite(Register object);
+
// ---------------------------------------------------------------------------
   // Exception handling

=======================================
--- /branches/bleeding_edge/src/objects.h       Mon Mar 17 08:31:21 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Mon Mar 17 13:55:22 2014 UTC
@@ -1171,6 +1171,8 @@
V(kExpectedFixedArrayInRegisterRbx, \ "Expected fixed array in register rbx") \ V(kExpectedSmiOrHeapNumber, "Expected smi or HeapNumber") \ + V(kExpectedUndefinedOrCell, \ + "Expected undefined or cell in register") \ V(kExpectingAlignmentForCopyBytes, \ "Expecting alignment for CopyBytes") \ V(kExportDeclaration, "Export declaration") \
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon Mar 10 10:39:17 2014 UTC +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon Mar 17 13:55:22 2014 UTC
@@ -3350,6 +3350,19 @@
     Check(below_equal, kOperandIsNotAName);
   }
 }
+
+
+void MacroAssembler::AssertUndefinedOrAllocationSite(Register object) {
+  if (emit_debug_code()) {
+    Label done_checking;
+    AssertNotSmi(object);
+    Cmp(object, isolate()->factory()->undefined_value());
+    j(equal, &done_checking);
+ Cmp(FieldOperand(object, 0), isolate()->factory()->allocation_site_map());
+    Assert(equal, kExpectedUndefinedOrCell);
+    bind(&done_checking);
+  }
+}


 void MacroAssembler::AssertRootValue(Register src,
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.h Mon Mar 10 10:39:17 2014 UTC +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.h Mon Mar 17 13:55:22 2014 UTC
@@ -1047,6 +1047,10 @@
   // Abort execution if argument is not a name, enabled via --debug-code.
   void AssertName(Register object);

+ // Abort execution if argument is not undefined or an AllocationSite, enabled
+  // via --debug-code.
+  void AssertUndefinedOrAllocationSite(Register object);
+
// Abort execution if argument is not the root value with the given index,
   // enabled via --debug-code.
   void AssertRootValue(Register src,

--
--
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/d/optout.

Reply via email to