Revision: 15739
Author:   [email protected]
Date:     Thu Jul 18 01:12:01 2013
Log:      Make deoptimization stress count global.

Store the deopt stress counter per isolate instead of per shared function info. The old field is removed.

Enable output of the counter value with a new flag.

[email protected]

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

Modified:
 /branches/bleeding_edge/src/assembler.cc
 /branches/bleeding_edge/src/assembler.h
 /branches/bleeding_edge/src/flag-definitions.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/isolate.h
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/assembler.cc    Wed Jul 17 04:50:24 2013
+++ /branches/bleeding_edge/src/assembler.cc    Thu Jul 18 01:12:01 2013
@@ -1071,6 +1071,11 @@
 ExternalReference ExternalReference::date_cache_stamp(Isolate* isolate) {
   return ExternalReference(isolate->date_cache()->stamp_address());
 }
+
+
+ExternalReference ExternalReference::stress_deopt_count(Isolate* isolate) {
+  return ExternalReference(isolate->stress_deopt_count_address());
+}


 ExternalReference ExternalReference::transcendental_cache_array_address(
=======================================
--- /branches/bleeding_edge/src/assembler.h     Wed Jul 17 04:50:24 2013
+++ /branches/bleeding_edge/src/assembler.h     Thu Jul 18 01:12:01 2013
@@ -865,6 +865,8 @@
     isolate->set_external_reference_redirector(
         reinterpret_cast<ExternalReferenceRedirectorPointer*>(redirector));
   }
+
+  static ExternalReference stress_deopt_count(Isolate* isolate);

  private:
   explicit ExternalReference(void* address)
=======================================
--- /branches/bleeding_edge/src/flag-definitions.h      Wed Jul 17 09:21:03 2013
+++ /branches/bleeding_edge/src/flag-definitions.h      Thu Jul 18 01:12:01 2013
@@ -254,6 +254,7 @@
 DEFINE_int(deopt_every_n_garbage_collections,
            0,
            "deoptimize every n garbage collections")
+DEFINE_bool(print_deopt_stress, false, "print number of possible deopt points")
 DEFINE_bool(trap_on_deopt, false, "put a break point before deoptimizing")
 DEFINE_bool(deoptimize_uncommon_cases, true, "deoptimize uncommon cases")
 DEFINE_bool(polymorphic_inlining, true, "polymorphic inlining")
=======================================
--- /branches/bleeding_edge/src/heap.cc Wed Jul 17 04:50:24 2013
+++ /branches/bleeding_edge/src/heap.cc Thu Jul 18 01:12:01 2013
@@ -3623,7 +3623,6 @@
   share->set_inferred_name(empty_string(), SKIP_WRITE_BARRIER);
   share->set_initial_map(undefined_value(), SKIP_WRITE_BARRIER);
   share->set_ast_node_count(0);
-  share->set_stress_deopt_counter(FLAG_deopt_every_n_times);
   share->set_counters(0);

   // Set integer fields (smi or int, depending on the architecture).
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Wed Jul 17 04:50:24 2013 +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Thu Jul 18 01:12:01 2013
@@ -932,30 +932,22 @@
   }

   if (FLAG_deopt_every_n_times != 0 && !info()->IsStub()) {
-    Handle<SharedFunctionInfo> shared(info()->shared_info());
+ ExternalReference count = ExternalReference::stress_deopt_count(isolate());
     Label no_deopt;
     __ pushfd();
     __ push(eax);
-    __ push(ebx);
-    __ mov(ebx, shared);
-    __ mov(eax,
- FieldOperand(ebx, SharedFunctionInfo::kStressDeoptCounterOffset));
-    __ sub(Operand(eax), Immediate(Smi::FromInt(1)));
+    __ mov(eax, Operand::StaticVariable(count));
+    __ sub(eax, Immediate(1));
     __ j(not_zero, &no_deopt, Label::kNear);
     if (FLAG_trap_on_deopt) __ int3();
-    __ mov(eax, Immediate(Smi::FromInt(FLAG_deopt_every_n_times)));
- __ mov(FieldOperand(ebx, SharedFunctionInfo::kStressDeoptCounterOffset),
-           eax);
-    __ pop(ebx);
+    __ mov(eax, Immediate(FLAG_deopt_every_n_times));
+    __ mov(Operand::StaticVariable(count), eax);
     __ pop(eax);
     __ popfd();
     ASSERT(frame_is_built_);
     __ call(entry, RelocInfo::RUNTIME_ENTRY);
-
     __ bind(&no_deopt);
- __ mov(FieldOperand(ebx, SharedFunctionInfo::kStressDeoptCounterOffset),
-           eax);
-    __ pop(ebx);
+    __ mov(Operand::StaticVariable(count), eax);
     __ pop(eax);
     __ popfd();
   }
=======================================
--- /branches/bleeding_edge/src/isolate.cc      Wed Jul 17 01:44:10 2013
+++ /branches/bleeding_edge/src/isolate.cc      Thu Jul 18 01:12:01 2013
@@ -1786,7 +1786,8 @@
       optimizing_compiler_thread_(this),
       marking_thread_(NULL),
       sweeper_thread_(NULL),
-      callback_table_(NULL) {
+      callback_table_(NULL),
+      stress_deopt_count_(0) {
   id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1);
   TRACE_ISOLATE(constructor);

@@ -1898,6 +1899,10 @@

     if (FLAG_hydrogen_stats) GetHStatistics()->Print();

+    if (FLAG_print_deopt_stress) {
+ PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_);
+    }
+
     // We must stop the logger before we tear down other components.
     Sampler* sampler = logger_->sampler();
     if (sampler && sampler->IsActive()) sampler->Stop();
@@ -2132,6 +2137,8 @@
   ASSERT(Isolate::Current() == this);
   TRACE_ISOLATE(init);

+  stress_deopt_count_ = FLAG_deopt_every_n_times;
+
   if (function_entry_hook() != NULL) {
     // When function entry hooking is in effect, we have to create the code
// stubs from scratch to get entry hooks, rather than loading the previously
=======================================
--- /branches/bleeding_edge/src/isolate.h       Wed Jul 17 09:38:49 2013
+++ /branches/bleeding_edge/src/isolate.h       Thu Jul 18 01:12:01 2013
@@ -1129,6 +1129,8 @@
   void set_function_entry_hook(FunctionEntryHook function_entry_hook) {
     function_entry_hook_ = function_entry_hook;
   }
+
+  void* stress_deopt_count_address() { return &stress_deopt_count_; }

  private:
   Isolate();
@@ -1365,6 +1367,9 @@
   SweeperThread** sweeper_thread_;
   CallbackTable* callback_table_;

+  // Counts deopt points if deopt_every_n_times is enabled.
+  unsigned int stress_deopt_count_;
+
   friend class ExecutionAccess;
   friend class HandleScopeImplementer;
   friend class IsolateInitializer;
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Wed Jul 17 04:50:24 2013
+++ /branches/bleeding_edge/src/objects-inl.h   Thu Jul 18 01:12:01 2013
@@ -4542,9 +4542,7 @@
               kCompilerHintsOffset)
 SMI_ACCESSORS(SharedFunctionInfo, opt_count, kOptCountOffset)
 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset)
-SMI_ACCESSORS(SharedFunctionInfo,
-              stress_deopt_counter,
-              kStressDeoptCounterOffset)
+
 #else

 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset)             \
@@ -4594,9 +4592,7 @@
 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, opt_count, kOptCountOffset)

 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, counters, kCountersOffset)
-PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo,
-                        stress_deopt_counter,
-                        kStressDeoptCounterOffset)
+
 #endif


=======================================
--- /branches/bleeding_edge/src/objects.h       Thu Jul 18 00:59:48 2013
+++ /branches/bleeding_edge/src/objects.h       Thu Jul 18 01:12:01 2013
@@ -6157,11 +6157,6 @@
   inline int ast_node_count();
   inline void set_ast_node_count(int count);

-  // A counter used to determine when to stress the deoptimizer with a
-  // deopt.
-  inline int stress_deopt_counter();
-  inline void set_stress_deopt_counter(int counter);
-
   inline int profiler_ticks();

// Inline cache age is used to infer whether the function survived a context
@@ -6353,10 +6348,9 @@
       kFunctionTokenPositionOffset + kPointerSize;
   static const int kOptCountOffset = kCompilerHintsOffset + kPointerSize;
   static const int kCountersOffset = kOptCountOffset + kPointerSize;
- static const int kStressDeoptCounterOffset = kCountersOffset + kPointerSize;

   // Total size.
-  static const int kSize = kStressDeoptCounterOffset + kPointerSize;
+  static const int kSize = kCountersOffset + kPointerSize;
 #else
   // The only reason to use smi fields instead of int fields
   // is to allow iteration without maps decoding during
@@ -6390,10 +6384,9 @@
   static const int kOptCountOffset = kCompilerHintsOffset + kIntSize;

   static const int kCountersOffset = kOptCountOffset + kIntSize;
-  static const int kStressDeoptCounterOffset = kCountersOffset + kIntSize;

   // Total size.
-  static const int kSize = kStressDeoptCounterOffset + kIntSize;
+  static const int kSize = kCountersOffset + kIntSize;

 #endif

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