Revision: 17626
Author:   [email protected]
Date:     Mon Nov 11 18:00:52 2013 UTC
Log:      Simplify current inline allocation tracking mechanism.

[email protected]

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

Modified:
 /branches/bleeding_edge/src/assembler.cc
 /branches/bleeding_edge/src/assembler.h
 /branches/bleeding_edge/src/heap-profiler.cc
 /branches/bleeding_edge/src/heap-profiler.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/serialize.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.h

=======================================
--- /branches/bleeding_edge/src/assembler.cc    Fri Nov  8 10:55:01 2013 UTC
+++ /branches/bleeding_edge/src/assembler.cc    Mon Nov 11 18:00:52 2013 UTC
@@ -1333,14 +1333,6 @@
   return ExternalReference(
       reinterpret_cast<void*>(&double_constants.the_hole_nan));
 }
-
-
-ExternalReference ExternalReference::record_object_allocation_function(
-  Isolate* isolate) {
-  return ExternalReference(
-      Redirect(isolate,
- FUNCTION_ADDR(HeapProfiler::RecordObjectAllocationFromMasm)));
-}


 ExternalReference ExternalReference::address_of_uint32_bias() {
=======================================
--- /branches/bleeding_edge/src/assembler.h     Fri Nov  8 10:55:01 2013 UTC
+++ /branches/bleeding_edge/src/assembler.h     Mon Nov 11 18:00:52 2013 UTC
@@ -725,9 +725,6 @@
   static ExternalReference get_make_code_young_function(Isolate* isolate);
static ExternalReference get_mark_code_as_executed_function(Isolate* isolate);

-  // New heap objects tracking support.
- static ExternalReference record_object_allocation_function(Isolate* isolate);
-
   // Deoptimization support.
   static ExternalReference new_deoptimizer_function(Isolate* isolate);
static ExternalReference compute_output_frames_function(Isolate* isolate);
=======================================
--- /branches/bleeding_edge/src/heap-profiler.cc Mon Oct 14 12:41:28 2013 UTC +++ /branches/bleeding_edge/src/heap-profiler.cc Mon Nov 11 18:00:52 2013 UTC
@@ -169,13 +169,6 @@
   is_tracking_allocations_ = false;
   DropCompiledCode();
 }
-
-
-void HeapProfiler::RecordObjectAllocationFromMasm(Isolate* isolate,
-                                                  Address obj,
-                                                  int size) {
-  isolate->heap_profiler()->NewObjectEvent(obj, size);
-}


 void HeapProfiler::DropCompiledCode() {
=======================================
--- /branches/bleeding_edge/src/heap-profiler.h Wed Oct 16 14:33:04 2013 UTC
+++ /branches/bleeding_edge/src/heap-profiler.h Mon Nov 11 18:00:52 2013 UTC
@@ -56,10 +56,6 @@
   void StartHeapObjectsTracking();
   void StopHeapObjectsTracking();

-  static void RecordObjectAllocationFromMasm(Isolate* isolate,
-                                             Address obj,
-                                             int size);
-
   SnapshotObjectId PushHeapObjectsStats(OutputStream* stream);
   int GetSnapshotsCount();
   HeapSnapshot* GetSnapshot(int index);
=======================================
--- /branches/bleeding_edge/src/heap.cc Mon Nov 11 17:46:08 2013 UTC
+++ /branches/bleeding_edge/src/heap.cc Mon Nov 11 18:00:52 2013 UTC
@@ -840,9 +840,7 @@
 }


-void Heap::ReserveSpace(
-    int *sizes,
-    Address *locations_out) {
+void Heap::ReserveSpace(int *sizes, Address *locations_out) {
   bool gc_performed = true;
   int counter = 0;
   static const int kThreshold = 20;
=======================================
--- /branches/bleeding_edge/src/serialize.cc    Fri Nov  8 10:55:01 2013 UTC
+++ /branches/bleeding_edge/src/serialize.cc    Mon Nov 11 18:00:52 2013 UTC
@@ -568,17 +568,13 @@
       UNCLASSIFIED,
       61,
       "Heap::allocation_sites_list_address()");
- Add(ExternalReference::record_object_allocation_function(isolate).address(),
-      UNCLASSIFIED,
-      62,
-      "HeapProfiler::RecordObjectAllocationFromMasm");
   Add(ExternalReference::address_of_uint32_bias().address(),
       UNCLASSIFIED,
-      63,
+      62,
       "uint32_bias");
Add(ExternalReference::get_mark_code_as_executed_function(isolate).address(),
       UNCLASSIFIED,
-      64,
+      63,
       "Code::MarkCodeAsExecuted");

// Add a small set of deopt entry addresses to encoder without generating the
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Fri Nov 8 17:35:58 2013 UTC +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon Nov 11 18:00:52 2013 UTC
@@ -4081,7 +4081,10 @@
                               AllocationFlags flags) {
   ASSERT((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0);
   ASSERT(object_size <= Page::kMaxNonCodeHeapObjectSize);
-  if (!FLAG_inline_new) {
+  if (!FLAG_inline_new ||
+      // TODO(mstarzinger): Implement more efficiently by keeping then
+      // bump-pointer allocation area empty instead of recompiling code.
+      isolate()->heap_profiler()->is_tracking_allocations()) {
     if (emit_debug_code()) {
       // Trash the registers to simulate an allocation failure.
       movl(result, Immediate(0x7091));
@@ -4100,10 +4103,6 @@
   // Load address of new object into result.
   LoadAllocationTopHelper(result, scratch, flags);

-  if (isolate()->heap_profiler()->is_tracking_allocations()) {
-    RecordObjectAllocation(isolate(), result, object_size);
-  }
-
// Align the next allocation. Storing the filler map without checking top is
   // safe in new-space because the limit of the heap is aligned there.
   if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) {
@@ -4165,7 +4164,10 @@
                               Label* gc_required,
                               AllocationFlags flags) {
   ASSERT((flags & SIZE_IN_WORDS) == 0);
-  if (!FLAG_inline_new) {
+  if (!FLAG_inline_new ||
+      // TODO(mstarzinger): Implement more efficiently by keeping then
+      // bump-pointer allocation area empty instead of recompiling code.
+      isolate()->heap_profiler()->is_tracking_allocations()) {
     if (emit_debug_code()) {
       // Trash the registers to simulate an allocation failure.
       movl(result, Immediate(0x7091));
@@ -4183,10 +4185,6 @@
   // Load address of new object into result.
   LoadAllocationTopHelper(result, scratch, flags);

-  if (isolate()->heap_profiler()->is_tracking_allocations()) {
-    RecordObjectAllocation(isolate(), result, object_size);
-  }
-
// Align the next allocation. Storing the filler map without checking top is
   // safe in new-space because the limit of the heap is aligned there.
   if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) {
@@ -4945,38 +4943,6 @@
   CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize),
               Heap::kAllocationMementoMapRootIndex);
 }
-
-
-void MacroAssembler::RecordObjectAllocation(Isolate* isolate,
-                                            Register object,
-                                            Register object_size) {
-  FrameScope frame(this, StackFrame::EXIT);
-  PushSafepointRegisters();
-  PrepareCallCFunction(3);
-  // In case object is rdx
-  movq(kScratchRegister, object);
-  movq(arg_reg_3, object_size);
-  movq(arg_reg_2, kScratchRegister);
-  movq(arg_reg_1, isolate, RelocInfo::EXTERNAL_REFERENCE);
-  CallCFunction(
-      ExternalReference::record_object_allocation_function(isolate), 3);
-  PopSafepointRegisters();
-}
-
-
-void MacroAssembler::RecordObjectAllocation(Isolate* isolate,
-                                            Register object,
-                                            int object_size) {
-  FrameScope frame(this, StackFrame::EXIT);
-  PushSafepointRegisters();
-  PrepareCallCFunction(3);
-  movq(arg_reg_2, object);
-  movq(arg_reg_3, Immediate(object_size));
-  movq(arg_reg_1, isolate, RelocInfo::EXTERNAL_REFERENCE);
-  CallCFunction(
-      ExternalReference::record_object_allocation_function(isolate), 3);
-  PopSafepointRegisters();
-}


 void MacroAssembler::JumpIfDictionaryInPrototypeChain(
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.h Fri Nov 8 10:52:07 2013 UTC +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.h Mon Nov 11 18:00:52 2013 UTC
@@ -1116,15 +1116,6 @@
                 Label* gc_required,
                 AllocationFlags flags);

-  // Record a JS object allocation if allocations tracking mode is on.
-  void RecordObjectAllocation(Isolate* isolate,
-                              Register object,
-                              Register object_size);
-
-  void RecordObjectAllocation(Isolate* isolate,
-                              Register object,
-                              int object_size);
-
// Undo allocation in new space. The object passed and objects allocated after // it will no longer be allocated. Make sure that no pointers are left to the // object(s) no longer allocated as they would be invalid when allocation is

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