Update V8 to version 4.1.0.21
This is a cherry-pick of all commits up to and including the
4.1.0.21 cherry-pick in Chromium.
Original commit message:
Version 4.1.0.21 (cherry-pick)
Merged 206e9136bde0f2b5ae8cb77afbb1e7833e5bd412
Unlink pages from the space page list after evacuation.
BUG=430201
LOG=N
R=jkummerow@chromium.org
Review URL: https://codereview.chromium.org/953813002
Cr-Commit-Position: refs/branch-heads/4.1@{#22}
Cr-Branched-From: 2e08d2a7aa9d65d269d8c57aba82eb38a8cb0a18-refs/heads/candidates@{#25353}
---
FPIIM-449
Change-Id: I8c23c7bbb70772b4858fe8a47b64fa97ee0d1f8c
diff --git a/src/v8threads.cc b/src/v8threads.cc
index a46b289..e2d9d49 100644
--- a/src/v8threads.cc
+++ b/src/v8threads.cc
@@ -14,34 +14,29 @@
namespace v8 {
+namespace {
+
// Track whether this V8 instance has ever called v8::Locker. This allows the
// API code to verify that the lock is always held when V8 is being entered.
-bool Locker::active_ = false;
+base::Atomic32 g_locker_was_ever_used_ = 0;
+
+} // namespace
// Once the Locker is initialized, the current thread will be guaranteed to have
// the lock for a given isolate.
void Locker::Initialize(v8::Isolate* isolate) {
DCHECK(isolate != NULL);
- has_lock_= false;
+ has_lock_ = false;
top_level_ = true;
isolate_ = reinterpret_cast<i::Isolate*>(isolate);
// Record that the Locker has been used at least once.
- active_ = true;
+ base::NoBarrier_Store(&g_locker_was_ever_used_, 1);
// Get the big lock if necessary.
if (!isolate_->thread_manager()->IsLockedByCurrentThread()) {
isolate_->thread_manager()->Lock();
has_lock_ = true;
- // Make sure that V8 is initialized. Archiving of threads interferes
- // with deserialization by adding additional root pointers, so we must
- // initialize here, before anyone can call ~Locker() or Unlocker().
- if (!isolate_->IsInitialized()) {
- isolate_->Enter();
- V8::Initialize();
- isolate_->Exit();
- }
-
// This may be a locker within an unlocker in which case we have to
// get the saved state for this thread and restore it.
if (isolate_->thread_manager()->RestoreThread()) {
@@ -64,7 +59,7 @@
bool Locker::IsActive() {
- return active_;
+ return !!base::NoBarrier_Load(&g_locker_was_ever_used_);
}