Revision: 7457
Author:   [email protected]
Date:     Thu Mar 31 05:04:00 2011
Log: Remove counters from generated isolate-independent MemCopy on ia32 platform.

BUG=
TEST=

Review URL: http://codereview.chromium.org/6740019
http://code.google.com/p/v8/source/detail?r=7457

Modified:
 /branches/bleeding_edge/src/ia32/codegen-ia32.cc
 /branches/bleeding_edge/src/v8-counters.h

=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc Wed Mar 30 11:05:16 2011 +++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc Thu Mar 31 05:04:00 2011
@@ -10177,7 +10177,13 @@

 OS::MemCopyFunction CreateMemCopyFunction() {
   HandleScope scope;
-  MacroAssembler masm(NULL, 1 * KB);
+  size_t actual_size;
+  // Allocate buffer in executable space.
+  byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB,
+                                                 &actual_size,
+                                                 true));
+  if (buffer == NULL) return &MemCopyWrapper;
+  MacroAssembler masm(buffer, static_cast<int>(actual_size));

   // Generated code is put into a fixed, unmovable, buffer, and not into
   // the V8 heap. We can't, and don't, refer to any relocatable addresses
@@ -10233,7 +10239,6 @@
     __ test(Operand(src), Immediate(0x0F));
     __ j(not_zero, &unaligned_source);
     {
- __ IncrementCounter(masm.isolate()->counters()->memcopy_aligned(), 1);
       // Copy loop for aligned source and destination.
       __ mov(edx, count);
       Register loop_count = ecx;
@@ -10281,7 +10286,6 @@
       // Copy loop for unaligned source and aligned destination.
       // If source is not aligned, we can't read it as efficiently.
       __ bind(&unaligned_source);
- __ IncrementCounter(masm.isolate()->counters()->memcopy_unaligned(), 1);
       __ mov(edx, ecx);
       Register loop_count = ecx;
       Register count = edx;
@@ -10325,7 +10329,6 @@
     }

   } else {
-    __ IncrementCounter(masm.isolate()->counters()->memcopy_noxmm(), 1);
     // SSE2 not supported. Unlikely to happen in practice.
     __ push(edi);
     __ push(esi);
@@ -10372,13 +10375,8 @@
   masm.GetCode(&desc);
   ASSERT(desc.reloc_size == 0);

-  // Copy the generated code into an executable chunk and return a pointer
-  // to the first instruction in it as a C++ function pointer.
- LargeObjectChunk* chunk = LargeObjectChunk::New(desc.instr_size, EXECUTABLE);
-  if (chunk == NULL) return &MemCopyWrapper;
-  memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size);
-  CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size);
-  return FUNCTION_CAST<OS::MemCopyFunction>(chunk->GetStartAddress());
+  CPU::FlushICache(buffer, actual_size);
+  return FUNCTION_CAST<OS::MemCopyFunction>(buffer);
 }

 #undef __
=======================================
--- /branches/bleeding_edge/src/v8-counters.h   Wed Mar 23 04:13:07 2011
+++ /branches/bleeding_edge/src/v8-counters.h   Thu Mar 31 05:04:00 2011
@@ -202,9 +202,6 @@
   SC(array_function_runtime, V8.ArrayFunctionRuntime)                 \
   SC(array_function_native, V8.ArrayFunctionNative)                   \
   SC(for_in, V8.ForIn)                                                \
-  SC(memcopy_aligned, V8.MemCopyAligned)                              \
-  SC(memcopy_unaligned, V8.MemCopyUnaligned)                          \
-  SC(memcopy_noxmm, V8.MemCopyNoXMM)                                  \
   SC(enum_cache_hits, V8.EnumCacheHits)                               \
   SC(enum_cache_misses, V8.EnumCacheMisses)                           \
   SC(zone_segment_bytes, V8.ZoneSegmentBytes)                         \

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

Reply via email to