Revision: 22226
Author:   [email protected]
Date:     Mon Jul  7 08:17:56 2014 UTC
Log:      Version 3.28.15 (based on bleeding_edge revision r22225)

Remove a bunch of Isolate::UncheckedCurrent calls.

Performance and stability improvements on all platforms.
http://code.google.com/p/v8/source/detail?r=22226

Modified:
 /trunk/ChangeLog
 /trunk/include/v8.h
 /trunk/src/api.cc
 /trunk/src/arguments.h
 /trunk/src/counters.cc
 /trunk/src/counters.h
 /trunk/src/d8.cc
 /trunk/src/d8.h
 /trunk/src/isolate.cc
 /trunk/src/messages.js
 /trunk/src/ostreams.cc
 /trunk/src/version.cc
 /trunk/test/cctest/test-api.cc
 /trunk/test/cctest/test-types.cc

=======================================
--- /trunk/ChangeLog    Mon Jul  7 00:05:07 2014 UTC
+++ /trunk/ChangeLog    Mon Jul  7 08:17:56 2014 UTC
@@ -1,3 +1,10 @@
+2014-07-07: Version 3.28.15
+
+        Remove a bunch of Isolate::UncheckedCurrent calls.
+
+        Performance and stability improvements on all platforms.
+
+
 2014-07-07: Version 3.28.14

Use the HeapObjectIterator to scan-on-scavenge map pages (Chromium issue
=======================================
--- /trunk/include/v8.h Mon Jul  7 00:05:07 2014 UTC
+++ /trunk/include/v8.h Mon Jul  7 08:17:56 2014 UTC
@@ -4430,6 +4430,21 @@
    */
   void SetUseCounterCallback(UseCounterCallback callback);

+  /**
+   * Enables the host application to provide a mechanism for recording
+   * statistics counters.
+   */
+  void SetCounterFunction(CounterLookupCallback);
+
+  /**
+   * Enables the host application to provide a mechanism for recording
+   * histograms. The CreateHistogram function returns a
+   * histogram which will later be passed to the AddHistogramSample
+   * function.
+   */
+  void SetCreateHistogramFunction(CreateHistogramCallback);
+  void SetAddHistogramSampleFunction(AddHistogramSampleCallback);
+
  private:
   template<class K, class V, class Traits> friend class PersistentValueMap;

@@ -4744,6 +4759,8 @@
   /**
    * Enables the host application to provide a mechanism for recording
    * statistics counters.
+   *
+   * Deprecated, use Isolate::SetCounterFunction instead.
    */
   static void SetCounterFunction(CounterLookupCallback);

@@ -4752,8 +4769,13 @@
    * histograms. The CreateHistogram function returns a
    * histogram which will later be passed to the AddHistogramSample
    * function.
+   *
+   * Deprecated, use Isolate::SetCreateHistogramFunction instead.
+   * Isolate::SetAddHistogramSampleFunction instead.
    */
   static void SetCreateHistogramFunction(CreateHistogramCallback);
+
+  /** Deprecated, use Isolate::SetAddHistogramSampleFunction instead. */
   static void SetAddHistogramSampleFunction(AddHistogramSampleCallback);

   /** Callback function for reporting failed access checks.*/
=======================================
--- /trunk/src/api.cc   Mon Jul  7 00:05:07 2014 UTC
+++ /trunk/src/api.cc   Mon Jul  7 08:17:56 2014 UTC
@@ -370,14 +370,14 @@


 void V8::SetFatalErrorHandler(FatalErrorCallback that) {
-  i::Isolate* isolate = i::Isolate::UncheckedCurrent();
+  i::Isolate* isolate = i::Isolate::Current();
   isolate->set_exception_behavior(that);
 }


 void V8::SetAllowCodeGenerationFromStringsCallback(
     AllowCodeGenerationFromStringsCallback callback) {
-  i::Isolate* isolate = i::Isolate::UncheckedCurrent();
+  i::Isolate* isolate = i::Isolate::Current();
   isolate->set_allow_code_gen_callback(callback);
 }

@@ -6602,7 +6602,7 @@


 Isolate* Isolate::GetCurrent() {
-  i::Isolate* isolate = i::Isolate::UncheckedCurrent();
+  i::Isolate* isolate = i::Isolate::Current();
   return reinterpret_cast<Isolate*>(isolate);
 }

@@ -6766,6 +6766,30 @@
 void Isolate::SetUseCounterCallback(UseCounterCallback callback) {
   reinterpret_cast<i::Isolate*>(this)->SetUseCounterCallback(callback);
 }
+
+
+void Isolate::SetCounterFunction(CounterLookupCallback callback) {
+  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
+  isolate->stats_table()->SetCounterFunction(callback);
+  isolate->InitializeLoggingAndCounters();
+  isolate->counters()->ResetCounters();
+}
+
+
+void Isolate::SetCreateHistogramFunction(CreateHistogramCallback callback) {
+  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
+  isolate->stats_table()->SetCreateHistogramFunction(callback);
+  isolate->InitializeLoggingAndCounters();
+  isolate->counters()->ResetHistograms();
+}
+
+
+void Isolate::SetAddHistogramSampleFunction(
+    AddHistogramSampleCallback callback) {
+  reinterpret_cast<i::Isolate*>(this)
+      ->stats_table()
+      ->SetAddHistogramSampleFunction(callback);
+}


 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj)
=======================================
--- /trunk/src/arguments.h      Fri Jun  6 13:09:06 2014 UTC
+++ /trunk/src/arguments.h      Mon Jul  7 08:17:56 2014 UTC
@@ -6,6 +6,7 @@
 #define V8_ARGUMENTS_H_

 #include "src/allocation.h"
+#include "src/isolate.h"

 namespace v8 {
 namespace internal {
=======================================
--- /trunk/src/counters.cc      Tue Jul  1 11:58:10 2014 UTC
+++ /trunk/src/counters.cc      Mon Jul  7 08:17:56 2014 UTC
@@ -107,6 +107,38 @@
     CODE_AGE_LIST_COMPLETE(SC)
 #undef SC
 }
+
+
+void Counters::ResetCounters() {
+#define SC(name, caption) name##_.Reset();
+  STATS_COUNTER_LIST_1(SC)
+  STATS_COUNTER_LIST_2(SC)
+#undef SC
+
+#define SC(name)              \
+  count_of_##name##_.Reset(); \
+  size_of_##name##_.Reset();
+  INSTANCE_TYPE_LIST(SC)
+#undef SC
+
+#define SC(name)                        \
+  count_of_CODE_TYPE_##name##_.Reset(); \
+  size_of_CODE_TYPE_##name##_.Reset();
+  CODE_KIND_LIST(SC)
+#undef SC
+
+#define SC(name)                          \
+  count_of_FIXED_ARRAY_##name##_.Reset(); \
+  size_of_FIXED_ARRAY_##name##_.Reset();
+  FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
+#undef SC
+
+#define SC(name)                       \
+  count_of_CODE_AGE_##name##_.Reset(); \
+  size_of_CODE_AGE_##name##_.Reset();
+  CODE_AGE_LIST_COMPLETE(SC)
+#undef SC
+}


 void Counters::ResetHistograms() {
=======================================
--- /trunk/src/counters.h       Tue Jul  1 11:58:10 2014 UTC
+++ /trunk/src/counters.h       Mon Jul  7 08:17:56 2014 UTC
@@ -142,6 +142,9 @@
     ASSERT(loc != NULL);
     return loc;
   }
+
+  // Reset the cached internal pointer.
+  void Reset() { lookup_done_ = false; }

  protected:
   // Returns the cached address of this counter location.
@@ -629,6 +632,7 @@
     stats_counter_count
   };

+  void ResetCounters();
   void ResetHistograms();

  private:
=======================================
--- /trunk/src/d8.cc    Mon Jul  7 00:05:07 2014 UTC
+++ /trunk/src/d8.cc    Mon Jul  7 08:17:56 2014 UTC
@@ -677,7 +677,7 @@
 }


-void Shell::MapCounters(const char* name) {
+void Shell::MapCounters(v8::Isolate* isolate, const char* name) {
   counters_file_ = base::OS::MemoryMappedFile::create(
       name, sizeof(CounterCollection), &local_counters_);
   void* memory = (counters_file_ == NULL) ?
@@ -687,9 +687,9 @@
     Exit(1);
   }
   counters_ = static_cast<CounterCollection*>(memory);
-  V8::SetCounterFunction(LookupCounter);
-  V8::SetCreateHistogramFunction(CreateHistogram);
-  V8::SetAddHistogramSampleFunction(AddHistogramSample);
+  isolate->SetCounterFunction(LookupCounter);
+  isolate->SetCreateHistogramFunction(CreateHistogram);
+  isolate->SetAddHistogramSampleFunction(AddHistogramSample);
 }


@@ -897,7 +897,7 @@
   Shell::counter_map_ = new CounterMap();
   // Set up counters
   if (i::StrLength(i::FLAG_map_counters) != 0)
-    MapCounters(i::FLAG_map_counters);
+    MapCounters(isolate, i::FLAG_map_counters);
   if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) {
     V8::SetCounterFunction(LookupCounter);
     V8::SetCreateHistogramFunction(CreateHistogram);
=======================================
--- /trunk/src/d8.h     Tue Jul  1 11:58:10 2014 UTC
+++ /trunk/src/d8.h     Mon Jul  7 08:17:56 2014 UTC
@@ -269,7 +269,7 @@
                                int max,
                                size_t buckets);
   static void AddHistogramSample(void* histogram, int sample);
-  static void MapCounters(const char* name);
+  static void MapCounters(v8::Isolate* isolate, const char* name);

   static Local<Object> DebugMessageDetails(Isolate* isolate,
                                            Handle<String> message);
=======================================
--- /trunk/src/isolate.cc       Mon Jul  7 00:05:07 2014 UTC
+++ /trunk/src/isolate.cc       Mon Jul  7 08:17:56 2014 UTC
@@ -2046,16 +2046,6 @@
       return;
     }
   }
-
- // Threads can have default isolate set into TLS as Current but not yet have
-  // PerIsolateThreadData for it, as it requires more advanced phase of the
- // initialization. For example, a thread might be the one that system used for - // static initializers - in this case the default isolate is set in TLS but - // the thread did not yet Enter the isolate. If PerisolateThreadData is not
-  // there, use the isolate set in TLS.
-  if (current_isolate == NULL) {
-    current_isolate = Isolate::UncheckedCurrent();
-  }

   PerIsolateThreadData* data = FindOrAllocatePerThreadDataForThisThread();
   ASSERT(data != NULL);
=======================================
--- /trunk/src/messages.js      Mon Jul  7 00:05:07 2014 UTC
+++ /trunk/src/messages.js      Mon Jul  7 08:17:56 2014 UTC
@@ -1189,7 +1189,7 @@
         if (!IS_UNDEFINED(m)) {
           %AddProperty(this, 'message', ToString(m), DONT_ENUM);
         }
-        captureStackTrace(this, f);
+        try { captureStackTrace(this, f); } catch (e) { }
       } else {
         return new f(m);
       }
=======================================
--- /trunk/src/ostreams.cc      Mon Jun 30 00:04:54 2014 UTC
+++ /trunk/src/ostreams.cc      Mon Jul  7 08:17:56 2014 UTC
@@ -6,7 +6,7 @@

 #include "src/ostreams.h"

-#if V8_CC_MSVC
+#if V8_OS_WIN
 #define snprintf sprintf_s
 #endif

=======================================
--- /trunk/src/version.cc       Mon Jul  7 00:05:07 2014 UTC
+++ /trunk/src/version.cc       Mon Jul  7 08:17:56 2014 UTC
@@ -34,7 +34,7 @@
 // system so their names cannot be changed without changing the scripts.
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     28
-#define BUILD_NUMBER      14
+#define BUILD_NUMBER      15
 #define PATCH_LEVEL       0
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
=======================================
--- /trunk/test/cctest/test-api.cc      Mon Jul  7 00:05:07 2014 UTC
+++ /trunk/test/cctest/test-api.cc      Mon Jul  7 08:17:56 2014 UTC
@@ -19495,15 +19495,15 @@
         break;

       case SetCounterFunction:
-        v8::V8::SetCounterFunction(NULL);
+        CcTest::isolate()->SetCounterFunction(NULL);
         break;

       case SetCreateHistogramFunction:
-        v8::V8::SetCreateHistogramFunction(NULL);
+        CcTest::isolate()->SetCreateHistogramFunction(NULL);
         break;

       case SetAddHistogramSampleFunction:
-        v8::V8::SetAddHistogramSampleFunction(NULL);
+        CcTest::isolate()->SetAddHistogramSampleFunction(NULL);
         break;
     }
     isolate->Exit();
@@ -20886,6 +20886,7 @@
 }


+#ifdef DEBUG
 static int probes_counter = 0;
 static int misses_counter = 0;
 static int updates_counter = 0;
@@ -20915,11 +20916,10 @@
     "  fooify(a);"
     "  fooify(b);"
     "}";
+#endif


 static void StubCacheHelper(bool primary) {
-  V8::SetCounterFunction(LookupCounter);
-  USE(kMegamorphicTestProgram);
 #ifdef DEBUG
   i::FLAG_native_code_counters = true;
   if (primary) {
@@ -20929,6 +20929,7 @@
   }
   i::FLAG_crankshaft = false;
   LocalContext env;
+  env->GetIsolate()->SetCounterFunction(LookupCounter);
   v8::HandleScope scope(env->GetIsolate());
   int initial_probes = probes_counter;
   int initial_misses = misses_counter;
@@ -20958,6 +20959,7 @@
 }


+#ifdef DEBUG
 static int cow_arrays_created_runtime = 0;


@@ -20967,13 +20969,14 @@
   }
   return NULL;
 }
+#endif


 TEST(CheckCOWArraysCreatedRuntimeCounter) {
-  V8::SetCounterFunction(LookupCounterCOWArrays);
 #ifdef DEBUG
   i::FLAG_native_code_counters = true;
   LocalContext env;
+  env->GetIsolate()->SetCounterFunction(LookupCounterCOWArrays);
   v8::HandleScope scope(env->GetIsolate());
   int initial_cow_arrays = cow_arrays_created_runtime;
   CompileRun("var o = [1, 2, 3];");
=======================================
--- /trunk/test/cctest/test-types.cc    Wed Jul  2 00:04:59 2014 UTC
+++ /trunk/test/cctest/test-types.cc    Mon Jul  7 08:17:56 2014 UTC
@@ -1,34 +1,11 @@
 // Copyright 2013 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.

 #include <vector>

-#include "src/base/utils/random-number-generator.h"
 #include "src/hydrogen-types.h"
+#include "src/isolate-inl.h"
 #include "src/types.h"
 #include "test/cctest/cctest.h"

@@ -127,7 +104,8 @@
 template<class Type, class TypeHandle, class Region>
 class Types {
  public:
-  Types(Region* region, Isolate* isolate) : region_(region) {
+  Types(Region* region, Isolate* isolate)
+      : region_(region), rng_(isolate->random_number_generator()) {
     #define DECLARE_TYPE(name, value) \
       name = Type::name(region); \
       types.push_back(name);
@@ -274,18 +252,18 @@
   }

   TypeHandle Random() {
-    return types[rng_.NextInt(static_cast<int>(types.size()))];
+    return types[rng_->NextInt(static_cast<int>(types.size()))];
   }

   TypeHandle Fuzz(int depth = 5) {
-    switch (rng_.NextInt(depth == 0 ? 3 : 20)) {
+    switch (rng_->NextInt(depth == 0 ? 3 : 20)) {
       case 0: {  // bitset
         int n = 0
         #define COUNT_BITSET_TYPES(type, value) + 1
         BITSET_TYPE_LIST(COUNT_BITSET_TYPES)
         #undef COUNT_BITSET_TYPES
         ;
-        int i = rng_.NextInt(n);
+        int i = rng_->NextInt(n);
         #define PICK_BITSET_TYPE(type, value) \
           if (i-- == 0) return Type::type(region_);
         BITSET_TYPE_LIST(PICK_BITSET_TYPE)
@@ -293,15 +271,15 @@
         UNREACHABLE();
       }
       case 1: {  // class
-        int i = rng_.NextInt(static_cast<int>(maps.size()));
+        int i = rng_->NextInt(static_cast<int>(maps.size()));
         return Type::Class(maps[i], region_);
       }
       case 2: {  // constant
-        int i = rng_.NextInt(static_cast<int>(values.size()));
+        int i = rng_->NextInt(static_cast<int>(values.size()));
         return Type::Constant(values[i], region_);
       }
       case 3: {  // context
-        int depth = rng_.NextInt(3);
+        int depth = rng_->NextInt(3);
         TypeHandle type = Type::Internal(region_);
for (int i = 0; i < depth; ++i) type = Type::Context(type, region_);
         return type;
@@ -315,7 +293,7 @@
       case 7: {  // function
         TypeHandle result = Fuzz(depth / 2);
         TypeHandle receiver = Fuzz(depth / 2);
-        int arity = rng_.NextInt(3);
+        int arity = rng_->NextInt(3);
         TypeHandle type = Type::Function(result, receiver, arity, region_);
         for (int i = 0; i < type->AsFunction()->Arity(); ++i) {
           TypeHandle parameter = Fuzz(depth - 1);
@@ -323,7 +301,7 @@
         }
       }
       default: {  // union
-        int n = rng_.NextInt(10);
+        int n = rng_->NextInt(10);
         TypeHandle type = None;
         for (int i = 0; i < n; ++i) {
           TypeHandle operand = Fuzz(depth - 1);
@@ -339,7 +317,7 @@

  private:
   Region* region_;
-  v8::base::RandomNumberGenerator rng_;
+  v8::base::RandomNumberGenerator* rng_;
 };


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