Upgrade to 3.29
Update V8 to 3.29.88.17 and update makefiles to support building on
all the relevant platforms.
Bug: 17370214
Change-Id: Ia3407c157fd8d72a93e23d8318ccaf6ecf77fa4e
diff --git a/src/small-pointer-list.h b/src/small-pointer-list.h
index 6c5ce89..241689e 100644
--- a/src/small-pointer-list.h
+++ b/src/small-pointer-list.h
@@ -1,36 +1,13 @@
// Copyright 2011 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.
#ifndef V8_SMALL_POINTER_LIST_H_
#define V8_SMALL_POINTER_LIST_H_
-#include "checks.h"
-#include "v8globals.h"
-#include "zone.h"
+#include "src/base/logging.h"
+#include "src/globals.h"
+#include "src/zone.h"
namespace v8 {
namespace internal {
@@ -44,24 +21,24 @@
public:
SmallPointerList() : data_(kEmptyTag) {}
- explicit SmallPointerList(int capacity) : data_(kEmptyTag) {
- Reserve(capacity);
+ SmallPointerList(int capacity, Zone* zone) : data_(kEmptyTag) {
+ Reserve(capacity, zone);
}
- void Reserve(int capacity) {
+ void Reserve(int capacity, Zone* zone) {
if (capacity < 2) return;
if ((data_ & kTagMask) == kListTag) {
if (list()->capacity() >= capacity) return;
int old_length = list()->length();
- list()->AddBlock(NULL, capacity - list()->capacity());
+ list()->AddBlock(NULL, capacity - list()->capacity(), zone);
list()->Rewind(old_length);
return;
}
- PointerList* list = new PointerList(capacity);
+ PointerList* list = new(zone) PointerList(capacity, zone);
if ((data_ & kTagMask) == kSingletonTag) {
- list->Add(single_value());
+ list->Add(single_value(), zone);
}
- ASSERT(IsAligned(reinterpret_cast<intptr_t>(list), kPointerAlignment));
+ DCHECK(IsAligned(reinterpret_cast<intptr_t>(list), kPointerAlignment));
data_ = reinterpret_cast<intptr_t>(list) | kListTag;
}
@@ -69,6 +46,12 @@
data_ = kEmptyTag;
}
+ void Sort() {
+ if ((data_ & kTagMask) == kListTag) {
+ list()->Sort(compare_value);
+ }
+ }
+
bool is_empty() const { return length() == 0; }
int length() const {
@@ -77,29 +60,29 @@
return list()->length();
}
- void Add(T* pointer) {
- ASSERT(IsAligned(reinterpret_cast<intptr_t>(pointer), kPointerAlignment));
+ void Add(T* pointer, Zone* zone) {
+ DCHECK(IsAligned(reinterpret_cast<intptr_t>(pointer), kPointerAlignment));
if ((data_ & kTagMask) == kEmptyTag) {
data_ = reinterpret_cast<intptr_t>(pointer) | kSingletonTag;
return;
}
if ((data_ & kTagMask) == kSingletonTag) {
- PointerList* list = new PointerList(2);
- list->Add(single_value());
- list->Add(pointer);
- ASSERT(IsAligned(reinterpret_cast<intptr_t>(list), kPointerAlignment));
+ PointerList* list = new(zone) PointerList(2, zone);
+ list->Add(single_value(), zone);
+ list->Add(pointer, zone);
+ DCHECK(IsAligned(reinterpret_cast<intptr_t>(list), kPointerAlignment));
data_ = reinterpret_cast<intptr_t>(list) | kListTag;
return;
}
- list()->Add(pointer);
+ list()->Add(pointer, zone);
}
// Note: returns T* and not T*& (unlike List from list.h).
// This makes the implementation simpler and more const correct.
T* at(int i) const {
- ASSERT((data_ & kTagMask) != kEmptyTag);
+ DCHECK((data_ & kTagMask) != kEmptyTag);
if ((data_ & kTagMask) == kSingletonTag) {
- ASSERT(i == 0);
+ DCHECK(i == 0);
return single_value();
}
return list()->at(i);
@@ -121,7 +104,7 @@
}
T* RemoveLast() {
- ASSERT((data_ & kTagMask) != kEmptyTag);
+ DCHECK((data_ & kTagMask) != kEmptyTag);
if ((data_ & kTagMask) == kSingletonTag) {
T* result = single_value();
data_ = kEmptyTag;
@@ -132,11 +115,11 @@
void Rewind(int pos) {
if ((data_ & kTagMask) == kEmptyTag) {
- ASSERT(pos == 0);
+ DCHECK(pos == 0);
return;
}
if ((data_ & kTagMask) == kSingletonTag) {
- ASSERT(pos == 0 || pos == 1);
+ DCHECK(pos == 0 || pos == 1);
if (pos == 0) {
data_ = kEmptyTag;
}
@@ -159,6 +142,10 @@
private:
typedef ZoneList<T*> PointerList;
+ static int compare_value(T* const* a, T* const* b) {
+ return Compare<T>(**a, **b);
+ }
+
static const intptr_t kEmptyTag = 1;
static const intptr_t kSingletonTag = 0;
static const intptr_t kListTag = 2;
@@ -168,13 +155,13 @@
STATIC_ASSERT(kTagMask + 1 <= kPointerAlignment);
T* single_value() const {
- ASSERT((data_ & kTagMask) == kSingletonTag);
+ DCHECK((data_ & kTagMask) == kSingletonTag);
STATIC_ASSERT(kSingletonTag == 0);
return reinterpret_cast<T*>(data_);
}
PointerList* list() const {
- ASSERT((data_ & kTagMask) == kListTag);
+ DCHECK((data_ & kTagMask) == kListTag);
return reinterpret_cast<PointerList*>(data_ & kValueMask);
}