Version 3.24.13

Add Isolate parameter to HandleScope::NumberOfHandles (Chromium issue 324225).

Removed v8::AssertNoGCScope.

Performance and stability improvements on all platforms.

git-svn-id: http://v8.googlecode.com/svn/trunk@18512 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/ChangeLog b/ChangeLog
index 9dd48c9..c3fa86d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2014-01-09: Version 3.24.13
+
+        Add Isolate parameter to HandleScope::NumberOfHandles (Chromium issue
+        324225).
+
+        Removed v8::AssertNoGCScope.
+
+        Performance and stability improvements on all platforms.
+
+
 2014-01-08: Version 3.24.12
 
         Correctly handle instances without elements in polymorphic keyed
diff --git a/DEPS b/DEPS
index bc5cd1b..66d21eb 100644
--- a/DEPS
+++ b/DEPS
@@ -5,7 +5,7 @@
 deps = {
   # Remember to keep the revision in sync with the Makefile.
   "v8/build/gyp":
-    "http://gyp.googlecode.com/svn/trunk@1806",
+    "http://gyp.googlecode.com/svn/trunk@1831",
 
   "v8/third_party/icu":
     "https://src.chromium.org/chrome/trunk/deps/third_party/icu46@239289",
diff --git a/Makefile b/Makefile
index 2c75cff..8f21f7c 100644
--- a/Makefile
+++ b/Makefile
@@ -441,7 +441,7 @@
 # Remember to keep these in sync with the DEPS file.
 dependencies:
 	svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \
-	    --revision 1806
+	    --revision 1831
 	svn checkout --force \
 	    https://src.chromium.org/chrome/trunk/deps/third_party/icu46 \
 	    third_party/icu --revision 239289
diff --git a/include/v8.h b/include/v8.h
index 1771969..c56295a 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -823,7 +823,7 @@
   /**
    * Counts the number of allocated handles.
    */
-  static int NumberOfHandles();
+  static int NumberOfHandles(Isolate* isolate);
 
  private:
   /**
@@ -4381,24 +4381,6 @@
 
 
 /**
- * Asserts that no action is performed that could cause a handle's value
- * to be modified. Useful when otherwise unsafe handle operations need to
- * be performed.
- */
-class V8_EXPORT AssertNoGCScope {
-#ifndef DEBUG
-  // TODO(yangguo): remove isolate argument.
-  V8_INLINE AssertNoGCScope(Isolate* isolate) {}
-#else
-  AssertNoGCScope(Isolate* isolate);
-  ~AssertNoGCScope();
- private:
-  void* disallow_heap_allocation_;
-#endif
-};
-
-
-/**
  * Container class for static utility functions.
  */
 class V8_EXPORT V8 {
diff --git a/src/api.cc b/src/api.cc
index 98813e0..db2045f 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -662,12 +662,9 @@
 }
 
 
-int HandleScope::NumberOfHandles() {
-  i::Isolate* isolate = i::Isolate::Current();
-  if (!EnsureInitializedForIsolate(isolate, "HandleScope::NumberOfHandles")) {
-    return 0;
-  }
-  return i::HandleScope::NumberOfHandles(isolate);
+int HandleScope::NumberOfHandles(Isolate* isolate) {
+  return i::HandleScope::NumberOfHandles(
+      reinterpret_cast<i::Isolate*>(isolate));
 }
 
 
@@ -714,8 +711,7 @@
 
 
 void Context::Exit() {
-  // TODO(dcarney): fix this once chrome is fixed.
-  i::Isolate* isolate = i::Isolate::Current();
+  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
   i::Handle<i::Context> context = i::Handle<i::Context>::null();
   ENTER_V8(isolate);
   if (!ApiCheck(isolate->handle_scope_implementer()->LeaveContext(context),
@@ -809,8 +805,7 @@
 // objects.  To remind you about this there is no HandleScope in the
 // NeanderObject constructor.  When you add one to the site calling the
 // constructor you should check that you ensured the VM was not dead first.
-NeanderObject::NeanderObject(int size) {
-  i::Isolate* isolate = i::Isolate::Current();
+NeanderObject::NeanderObject(v8::internal::Isolate* isolate, int size) {
   EnsureInitializedForIsolate(isolate, "v8::Nowhere");
   ENTER_V8(isolate);
   value_ = isolate->factory()->NewNeanderObject();
@@ -824,7 +819,7 @@
 }
 
 
-NeanderArray::NeanderArray() : obj_(2) {
+NeanderArray::NeanderArray(v8::internal::Isolate* isolate) : obj_(isolate, 2) {
   obj_.set(0, i::Smi::FromInt(0));
 }
 
@@ -881,7 +876,7 @@
                         v8::Handle<v8::Data>* data) {
   i::Handle<i::Object> list(Utils::OpenHandle(templ)->property_list(), isolate);
   if (list->IsUndefined()) {
-    list = NeanderArray().value();
+    list = NeanderArray(isolate).value();
     Utils::OpenHandle(templ)->set_property_list(*list);
   }
   NeanderArray array(list);
@@ -1382,9 +1377,10 @@
 static inline void AddPropertyToTemplate(
     i::Handle<i::TemplateInfo> info,
     i::Handle<i::AccessorInfo> obj) {
-  i::Handle<i::Object> list(info->property_accessors(), info->GetIsolate());
+  i::Isolate* isolate = info->GetIsolate();
+  i::Handle<i::Object> list(info->property_accessors(), isolate);
   if (list->IsUndefined()) {
-    list = NeanderArray().value();
+    list = NeanderArray(isolate).value();
     info->set_property_accessors(*list);
   }
   NeanderArray array(list);
@@ -6164,18 +6160,6 @@
 }
 
 
-#ifdef DEBUG
-v8::AssertNoGCScope::AssertNoGCScope(v8::Isolate* isolate) {
-  disallow_heap_allocation_ = new i::DisallowHeapAllocation();
-}
-
-
-v8::AssertNoGCScope::~AssertNoGCScope() {
-  delete static_cast<i::DisallowHeapAllocation*>(disallow_heap_allocation_);
-}
-#endif
-
-
 void V8::IgnoreOutOfMemoryException() {
   EnterIsolateIfNeeded()->set_ignore_out_of_memory(true);
 }
@@ -6188,7 +6172,7 @@
   ENTER_V8(isolate);
   i::HandleScope scope(isolate);
   NeanderArray listeners(isolate->factory()->message_listeners());
-  NeanderObject obj(2);
+  NeanderObject obj(isolate, 2);
   obj.set(0, *isolate->factory()->NewForeign(FUNCTION_ADDR(that)));
   obj.set(1, data.IsEmpty() ? isolate->heap()->undefined_value()
                             : *Utils::OpenHandle(*data));
diff --git a/src/api.h b/src/api.h
index 5f19380..aa3c38c 100644
--- a/src/api.h
+++ b/src/api.h
@@ -56,7 +56,7 @@
 // env-independent JSObjects used by the api.
 class NeanderObject {
  public:
-  explicit NeanderObject(int size);
+  explicit NeanderObject(v8::internal::Isolate* isolate, int size);
   explicit inline NeanderObject(v8::internal::Handle<v8::internal::Object> obj);
   explicit inline NeanderObject(v8::internal::Object* obj);
   inline v8::internal::Object* get(int index);
@@ -72,7 +72,7 @@
 // array abstraction built on neander-objects.
 class NeanderArray {
  public:
-  NeanderArray();
+  explicit NeanderArray(v8::internal::Isolate* isolate);
   explicit inline NeanderArray(v8::internal::Handle<v8::internal::Object> obj);
   inline v8::internal::Handle<v8::internal::JSObject> value() {
     return obj_.value();
diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc
index b044ca9..5477b24 100644
--- a/src/arm/codegen-arm.cc
+++ b/src/arm/codegen-arm.cc
@@ -347,13 +347,33 @@
 }
 #endif
 
-#undef __
-
-
 UnaryMathFunction CreateSqrtFunction() {
-  return &sqrt;
+#if defined(USE_SIMULATOR)
+  return &std::sqrt;
+#else
+  size_t actual_size;
+  byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true));
+  if (buffer == NULL) return &std::sqrt;
+
+  MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
+
+  __ GetCFunctionDoubleResult(d0);
+  __ vsqrt(d0, d0);
+  __ SetCallCDoubleArguments(d0);
+  __ Ret();
+
+  CodeDesc desc;
+  masm.GetCode(&desc);
+  ASSERT(!RelocInfo::RequiresRelocation(desc));
+
+  CPU::FlushICache(buffer, actual_size);
+  OS::ProtectCode(buffer, actual_size);
+  return FUNCTION_CAST<UnaryMathFunction>(buffer);
+#endif
 }
 
+#undef __
+
 
 // -------------------------------------------------------------------------
 // Platform-specific RuntimeCallHelper functions.
diff --git a/src/ast.cc b/src/ast.cc
index ecf83ea..21ea50b 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -186,6 +186,23 @@
 }
 
 
+void FunctionLiteral::InitializeSharedInfo(
+    Handle<Code> unoptimized_code) {
+  for (RelocIterator it(*unoptimized_code); !it.done(); it.next()) {
+    RelocInfo* rinfo = it.rinfo();
+    if (rinfo->rmode() != RelocInfo::EMBEDDED_OBJECT) continue;
+    Object* obj = rinfo->target_object();
+    if (obj->IsSharedFunctionInfo()) {
+      SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj);
+      if (shared->start_position() == start_position()) {
+        shared_info_ = Handle<SharedFunctionInfo>(shared);
+        break;
+      }
+    }
+  }
+}
+
+
 ObjectLiteralProperty::ObjectLiteralProperty(Literal* key,
                                              Expression* value,
                                              Isolate* isolate) {
diff --git a/src/ast.h b/src/ast.h
index 3fabfdde..64a56e9 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -2296,6 +2296,8 @@
   bool AllowsLazyCompilation();
   bool AllowsLazyCompilationWithoutContext();
 
+  void InitializeSharedInfo(Handle<Code> code);
+
   Handle<String> debug_name() const {
     if (name_->length() > 0) return name_;
     return inferred_name();
@@ -2306,6 +2308,9 @@
     inferred_name_ = inferred_name;
   }
 
+  // shared_info may be null if it's not cached in full code.
+  Handle<SharedFunctionInfo> shared_info() { return shared_info_; }
+
   bool pretenure() { return Pretenure::decode(bitfield_); }
   void set_pretenure() { bitfield_ |= Pretenure::encode(true); }
 
@@ -2381,6 +2386,7 @@
 
  private:
   Handle<String> name_;
+  Handle<SharedFunctionInfo> shared_info_;
   Scope* scope_;
   ZoneList<Statement*>* body_;
   Handle<String> inferred_name_;
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 7b8af06..f384720 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -673,7 +673,7 @@
 
   // Allocate the message listeners object.
   {
-    v8::NeanderArray listeners;
+    v8::NeanderArray listeners(isolate());
     native_context()->set_message_listeners(*listeners.value());
   }
 }
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 529ebd2..3c4ff15 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4572,31 +4572,11 @@
 }
 
 
-static Handle<SharedFunctionInfo> SearchSharedFunctionInfo(
-    Code* unoptimized_code, FunctionLiteral* expr) {
-  int start_position = expr->start_position();
-  for (RelocIterator it(unoptimized_code); !it.done(); it.next()) {
-    RelocInfo* rinfo = it.rinfo();
-    if (rinfo->rmode() != RelocInfo::EMBEDDED_OBJECT) continue;
-    Object* obj = rinfo->target_object();
-    if (obj->IsSharedFunctionInfo()) {
-      SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj);
-      if (shared->start_position() == start_position) {
-        return Handle<SharedFunctionInfo>(shared);
-      }
-    }
-  }
-
-  return Handle<SharedFunctionInfo>();
-}
-
-
 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) {
   ASSERT(!HasStackOverflow());
   ASSERT(current_block() != NULL);
   ASSERT(current_block()->HasPredecessor());
-  Handle<SharedFunctionInfo> shared_info =
-      SearchSharedFunctionInfo(current_info()->shared_info()->code(), expr);
+  Handle<SharedFunctionInfo> shared_info = expr->shared_info();
   if (shared_info.is_null()) {
     shared_info = Compiler::BuildFunctionInfo(expr, current_info()->script());
   }
diff --git a/src/math.js b/src/math.js
index 5cbe94a..da96d96 100644
--- a/src/math.js
+++ b/src/math.js
@@ -285,44 +285,20 @@
   %FunctionSetInstanceClassName(MathConstructor, 'Math');
 
   // Set up math constants.
-  // ECMA-262, section 15.8.1.1.
-  %OptimizeObjectForAddingMultipleProperties($Math, 8);
-  %SetProperty($Math,
-               "E",
-               2.7182818284590452354,
-               DONT_ENUM |  DONT_DELETE | READ_ONLY);
-  // ECMA-262, section 15.8.1.2.
-  %SetProperty($Math,
-               "LN10",
-               2.302585092994046,
-               DONT_ENUM |  DONT_DELETE | READ_ONLY);
-  // ECMA-262, section 15.8.1.3.
-  %SetProperty($Math,
-               "LN2",
-               0.6931471805599453,
-               DONT_ENUM |  DONT_DELETE | READ_ONLY);
-  // ECMA-262, section 15.8.1.4.
-  %SetProperty($Math,
-               "LOG2E",
-               1.4426950408889634,
-               DONT_ENUM |  DONT_DELETE | READ_ONLY);
-  %SetProperty($Math,
-               "LOG10E",
-               0.4342944819032518,
-               DONT_ENUM |  DONT_DELETE | READ_ONLY);
-  %SetProperty($Math,
-               "PI",
-               3.1415926535897932,
-               DONT_ENUM |  DONT_DELETE | READ_ONLY);
-  %SetProperty($Math,
-               "SQRT1_2",
-               0.7071067811865476,
-               DONT_ENUM |  DONT_DELETE | READ_ONLY);
-  %SetProperty($Math,
-               "SQRT2",
-               1.4142135623730951,
-               DONT_ENUM |  DONT_DELETE | READ_ONLY);
-  %ToFastProperties($Math);
+  InstallConstants($Math, $Array(
+    // ECMA-262, section 15.8.1.1.
+    "E", 2.7182818284590452354,
+    // ECMA-262, section 15.8.1.2.
+    "LN10", 2.302585092994046,
+    // ECMA-262, section 15.8.1.3.
+    "LN2", 0.6931471805599453,
+    // ECMA-262, section 15.8.1.4.
+    "LOG2E", 1.4426950408889634,
+    "LOG10E", 0.4342944819032518,
+    "PI", 3.1415926535897932,
+    "SQRT1_2", 0.7071067811865476,
+    "SQRT2", 1.4142135623730951
+  ));
 
   // Set up non-enumerable functions of the Math object and
   // set their names.
diff --git a/src/object-observe.js b/src/object-observe.js
index dfa57b8..499b27e 100644
--- a/src/object-observe.js
+++ b/src/object-observe.js
@@ -91,10 +91,14 @@
 var notifierObjectInfoMap =
     new ObservationWeakMap(observationState.notifierObjectInfoMap);
 
-function TypeMapCreate() {
+function nullProtoObject() {
   return { __proto__: null };
 }
 
+function TypeMapCreate() {
+  return nullProtoObject();
+}
+
 function TypeMapAddType(typeMap, type, ignoreDuplicate) {
   typeMap[type] = ignoreDuplicate ? 1 : (typeMap[type] || 0) + 1;
 }
@@ -142,11 +146,12 @@
 // to the callback. An observer never changes its accept types and thus never
 // needs to "normalize".
 function ObserverCreate(callback, acceptList) {
-  return IS_UNDEFINED(acceptList) ? callback : {
-    __proto__: null,
-    callback: callback,
-    accept: TypeMapCreateFromList(acceptList)
-  };
+  if (IS_UNDEFINED(acceptList))
+    return callback;
+  var observer = nullProtoObject();
+  observer.callback = callback;
+  observer.accept = TypeMapCreateFromList(acceptList);
+  return observer;
 }
 
 function ObserverGetCallback(observer) {
@@ -162,8 +167,8 @@
                                ObserverGetAcceptTypes(observer));
 }
 
-function ObjectInfoGet(object) {
-  var objectInfo = objectInfoMap.get(object);
+function ObjectInfoGetOrCreate(object) {
+  var objectInfo = ObjectInfoGet(object);
   if (IS_UNDEFINED(objectInfo)) {
     if (!%IsJSProxy(object))
       %SetIsObserved(object);
@@ -180,6 +185,10 @@
   return objectInfo;
 }
 
+function ObjectInfoGet(object) {
+  return objectInfoMap.get(object);
+}
+
 function ObjectInfoGetFromNotifier(notifier) {
   return notifierObjectInfoMap.get(notifier);
 }
@@ -212,7 +221,7 @@
     var callback = ObserverGetCallback(observer);
     var callbackInfo = CallbackInfoGet(callback);
     var priority = CallbackInfoGetPriority(callbackInfo);
-    objectInfo.changeObservers = { __proto__: null };
+    objectInfo.changeObservers = nullProtoObject();
     objectInfo.changeObservers[priority] = observer;
   }
 }
@@ -243,7 +252,7 @@
 
   var callbackInfo = CallbackInfoGet(callback);
   var priority = CallbackInfoGetPriority(callbackInfo);
-  delete objectInfo.changeObservers[priority];
+  objectInfo.changeObservers[priority] = null;
 }
 
 function ObjectInfoHasActiveObservers(objectInfo) {
@@ -254,7 +263,8 @@
     return ObserverIsActive(objectInfo.changeObservers, objectInfo);
 
   for (var priority in objectInfo.changeObservers) {
-    if (ObserverIsActive(objectInfo.changeObservers[priority], objectInfo))
+    var observer = objectInfo.changeObservers[priority];
+    if (!IS_NULL(observer) && ObserverIsActive(observer, objectInfo))
       return true;
   }
 
@@ -333,7 +343,7 @@
   if (!AcceptArgIsValid(acceptList))
     throw MakeTypeError("observe_accept_invalid");
 
-  var objectInfo = ObjectInfoGet(object);
+  var objectInfo = ObjectInfoGetOrCreate(object);
   ObjectInfoAddObserver(objectInfo, callback, acceptList);
   return object;
 }
@@ -344,7 +354,7 @@
   if (!IS_SPEC_FUNCTION(callback))
     throw MakeTypeError("observe_non_function", ["unobserve"]);
 
-  var objectInfo = objectInfoMap.get(object);
+  var objectInfo = ObjectInfoGet(object);
   if (IS_UNDEFINED(objectInfo))
     return object;
 
@@ -381,7 +391,7 @@
 
   var callbackInfo = CallbackInfoNormalize(callback);
   if (!observationState.pendingObservers)
-    observationState.pendingObservers = { __proto__: null };
+    observationState.pendingObservers = nullProtoObject();
   observationState.pendingObservers[callbackInfo.priority] = callback;
   callbackInfo.push(changeRecord);
   %SetMicrotaskPending(true);
@@ -424,25 +434,27 @@
 
   for (var priority in objectInfo.changeObservers) {
     var observer = objectInfo.changeObservers[priority];
+    if (IS_NULL(observer))
+      continue;
     ObserverEnqueueIfActive(observer, objectInfo, changeRecord,
                             needsAccessCheck);
   }
 }
 
 function BeginPerformSplice(array) {
-  var objectInfo = objectInfoMap.get(array);
+  var objectInfo = ObjectInfoGet(array);
   if (!IS_UNDEFINED(objectInfo))
     ObjectInfoAddPerformingType(objectInfo, 'splice');
 }
 
 function EndPerformSplice(array) {
-  var objectInfo = objectInfoMap.get(array);
+  var objectInfo = ObjectInfoGet(array);
   if (!IS_UNDEFINED(objectInfo))
     ObjectInfoRemovePerformingType(objectInfo, 'splice');
 }
 
 function EnqueueSpliceRecord(array, index, removed, addedCount) {
-  var objectInfo = objectInfoMap.get(array);
+  var objectInfo = ObjectInfoGet(array);
   if (!ObjectInfoHasActiveObservers(objectInfo))
     return;
 
@@ -460,7 +472,7 @@
 }
 
 function NotifyChange(type, object, name, oldValue) {
-  var objectInfo = objectInfoMap.get(object);
+  var objectInfo = ObjectInfoGet(object);
   if (!ObjectInfoHasActiveObservers(objectInfo))
     return;
 
@@ -529,7 +541,7 @@
 
   if (ObjectIsFrozen(object)) return null;
 
-  var objectInfo = ObjectInfoGet(object);
+  var objectInfo = ObjectInfoGetOrCreate(object);
   return ObjectInfoGetNotifier(objectInfo);
 }
 
diff --git a/src/objects.cc b/src/objects.cc
index ec3b713..c484eab 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -12778,7 +12778,7 @@
 bool AllocationSite::IsNestedSite() {
   ASSERT(FLAG_trace_track_allocation_sites);
   Object* current = GetHeap()->allocation_sites_list();
-  while (current != NULL && current->IsAllocationSite()) {
+  while (current->IsAllocationSite()) {
     AllocationSite* current_site = AllocationSite::cast(current);
     if (current_site->nested_site() == this) {
       return true;
diff --git a/src/platform-posix.cc b/src/platform-posix.cc
index 087625a..b897930 100644
--- a/src/platform-posix.cc
+++ b/src/platform-posix.cc
@@ -183,10 +183,10 @@
 
 // Get rid of writable permission on code allocations.
 void OS::ProtectCode(void* address, const size_t size) {
-#if defined(__CYGWIN__)
+#if V8_OS_CYGWIN
   DWORD old_protect;
   VirtualProtect(address, size, PAGE_EXECUTE_READ, &old_protect);
-#elif defined(__native_client__)
+#elif V8_OS_NACL
   // The Native Client port of V8 uses an interpreter, so
   // code pages don't need PROT_EXEC.
   mprotect(address, size, PROT_READ);
@@ -198,7 +198,7 @@
 
 // Create guard pages.
 void OS::Guard(void* address, const size_t size) {
-#if defined(__CYGWIN__)
+#if V8_OS_CYGWIN
   DWORD oldprotect;
   VirtualProtect(address, size, PAGE_NOACCESS, &oldprotect);
 #else
@@ -208,7 +208,7 @@
 
 
 void* OS::GetRandomMmapAddr() {
-#if defined(__native_client__)
+#if V8_OS_NACL
   // TODO(bradchen): restore randomization once Native Client gets
   // smarter about using mmap address hints.
   // See http://code.google.com/p/nativeclient/issues/3341
@@ -492,8 +492,8 @@
 
 #elif defined(V8_HOST_ARCH_ARM)
 void OS::MemCopyUint16Uint8Wrapper(uint16_t* dest,
-                               const uint8_t* src,
-                               size_t chars) {
+                                   const uint8_t* src,
+                                   size_t chars) {
   uint16_t *limit = dest + chars;
   while (dest < limit) {
     *dest++ = static_cast<uint16_t>(*src++);
@@ -579,12 +579,12 @@
 
 
 static void SetThreadName(const char* name) {
-#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if V8_OS_DRAGONFLYBSD || V8_OS_FREEBSD || V8_OS_OPENBSD
   pthread_set_name_np(pthread_self(), name);
-#elif defined(__NetBSD__)
+#elif V8_OS_NETBSD
   STATIC_ASSERT(Thread::kMaxThreadNameLength <= PTHREAD_MAX_NAMELEN_NP);
   pthread_setname_np(pthread_self(), "%s", name);
-#elif defined(__APPLE__)
+#elif V8_OS_MACOSX
   // pthread_setname_np is only available in 10.6 or later, so test
   // for it at runtime.
   int (*dynamic_pthread_setname_np)(const char*);
@@ -631,7 +631,7 @@
   result = pthread_attr_init(&attr);
   ASSERT_EQ(0, result);
   // Native client uses default stack size.
-#if !defined(__native_client__)
+#if !V8_OS_NACL
   if (stack_size_ > 0) {
     result = pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_));
     ASSERT_EQ(0, result);
@@ -659,7 +659,7 @@
 
 
 static Thread::LocalStorageKey PthreadKeyToLocalKey(pthread_key_t pthread_key) {
-#if defined(__CYGWIN__)
+#if V8_OS_CYGWIN
   // We need to cast pthread_key_t to Thread::LocalStorageKey in two steps
   // because pthread_key_t is a pointer type on Cygwin. This will probably not
   // work on 64-bit platforms, but Cygwin doesn't support 64-bit anyway.
@@ -673,7 +673,7 @@
 
 
 static pthread_key_t LocalKeyToPthreadKey(Thread::LocalStorageKey local_key) {
-#if defined(__CYGWIN__)
+#if V8_OS_CYGWIN
   STATIC_ASSERT(sizeof(Thread::LocalStorageKey) == sizeof(pthread_key_t));
   intptr_t ptr_key = static_cast<intptr_t>(local_key);
   return reinterpret_cast<pthread_key_t>(ptr_key);
diff --git a/src/typing.cc b/src/typing.cc
index c692f48..152f3c7 100644
--- a/src/typing.cc
+++ b/src/typing.cc
@@ -368,6 +368,7 @@
 
 
 void AstTyper::VisitFunctionLiteral(FunctionLiteral* expr) {
+  expr->InitializeSharedInfo(Handle<Code>(info_->closure()->shared()->code()));
 }
 
 
diff --git a/src/version.cc b/src/version.cc
index 39bc1d0..7610804 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -34,7 +34,7 @@
 // system so their names cannot be changed without changing the scripts.
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     24
-#define BUILD_NUMBER      12
+#define BUILD_NUMBER      13
 #define PATCH_LEVEL       0
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 9e759d2..3e3afee 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -11022,45 +11022,44 @@
 }
 
 
-static int CountHandles() {
-  return v8::HandleScope::NumberOfHandles();
-}
-
-
-static int Recurse(int depth, int iterations) {
-  v8::HandleScope scope(CcTest::isolate());
-  if (depth == 0) return CountHandles();
+static int Recurse(v8::Isolate* isolate, int depth, int iterations) {
+  v8::HandleScope scope(isolate);
+  if (depth == 0) return v8::HandleScope::NumberOfHandles(isolate);
   for (int i = 0; i < iterations; i++) {
-    Local<v8::Number> n(v8::Integer::New(CcTest::isolate(), 42));
+    Local<v8::Number> n(v8::Integer::New(isolate, 42));
   }
-  return Recurse(depth - 1, iterations);
+  return Recurse(isolate, depth - 1, iterations);
 }
 
 
 THREADED_TEST(HandleIteration) {
   static const int kIterations = 500;
   static const int kNesting = 200;
-  CHECK_EQ(0, CountHandles());
+  LocalContext context;
+  v8::Isolate* isolate = context->GetIsolate();
+  v8::HandleScope scope0(isolate);
+  CHECK_EQ(0, v8::HandleScope::NumberOfHandles(isolate));
   {
-    v8::HandleScope scope1(CcTest::isolate());
-    CHECK_EQ(0, CountHandles());
+    v8::HandleScope scope1(isolate);
+    CHECK_EQ(0, v8::HandleScope::NumberOfHandles(isolate));
     for (int i = 0; i < kIterations; i++) {
       Local<v8::Number> n(v8::Integer::New(CcTest::isolate(), 42));
-      CHECK_EQ(i + 1, CountHandles());
+      CHECK_EQ(i + 1, v8::HandleScope::NumberOfHandles(isolate));
     }
 
-    CHECK_EQ(kIterations, CountHandles());
+    CHECK_EQ(kIterations, v8::HandleScope::NumberOfHandles(isolate));
     {
       v8::HandleScope scope2(CcTest::isolate());
       for (int j = 0; j < kIterations; j++) {
         Local<v8::Number> n(v8::Integer::New(CcTest::isolate(), 42));
-        CHECK_EQ(j + 1 + kIterations, CountHandles());
+        CHECK_EQ(j + 1 + kIterations,
+                 v8::HandleScope::NumberOfHandles(isolate));
       }
     }
-    CHECK_EQ(kIterations, CountHandles());
+    CHECK_EQ(kIterations, v8::HandleScope::NumberOfHandles(isolate));
   }
-  CHECK_EQ(0, CountHandles());
-  CHECK_EQ(kNesting * kIterations, Recurse(kNesting, kIterations));
+  CHECK_EQ(0, v8::HandleScope::NumberOfHandles(isolate));
+  CHECK_EQ(kNesting * kIterations, Recurse(isolate, kNesting, kIterations));
 }
 
 
diff --git a/tools/merge-to-branch.sh b/tools/merge-to-branch.sh
index 7b9d3b4..2df24c1 100755
--- a/tools/merge-to-branch.sh
+++ b/tools/merge-to-branch.sh
@@ -179,6 +179,7 @@
   done
   if [ -n "$BUG_AGGREGATE" ] ; then
     echo "BUG=$BUG_AGGREGATE" >> $COMMITMSG_FILE
+    echo "LOG=N" >> $COMMITMSG_FILE
   fi
   persist "NEW_COMMIT_MSG"
   persist "REVISION_LIST"