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/utils.h b/src/utils.h
index 2991815..525c6f8 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -61,7 +61,6 @@
}
DCHECK_EQ(1 << bits, original_x);
return bits;
- return 0;
}
@@ -157,7 +156,7 @@
// Floor(-0.0) == 0.0
inline double Floor(double x) {
-#ifdef _MSC_VER
+#if V8_CC_MSVC
if (x == 0) return x; // Fix for issue 3477.
#endif
return std::floor(x);
@@ -231,6 +230,14 @@
};
+template <class T, int shift, int size>
+class BitField8 : public BitFieldBase<T, shift, size, uint8_t> {};
+
+
+template <class T, int shift, int size>
+class BitField16 : public BitFieldBase<T, shift, size, uint16_t> {};
+
+
template<class T, int shift, int size>
class BitField : public BitFieldBase<T, shift, size, uint32_t> { };
@@ -240,6 +247,46 @@
// ----------------------------------------------------------------------------
+// BitSetComputer is a help template for encoding and decoding information for
+// a variable number of items in an array.
+//
+// To encode boolean data in a smi array you would use:
+// typedef BitSetComputer<bool, 1, kSmiValueSize, uint32_t> BoolComputer;
+//
+template <class T, int kBitsPerItem, int kBitsPerWord, class U>
+class BitSetComputer {
+ public:
+ static const int kItemsPerWord = kBitsPerWord / kBitsPerItem;
+ static const int kMask = (1 << kBitsPerItem) - 1;
+
+ // The number of array elements required to embed T information for each item.
+ static int word_count(int items) {
+ if (items == 0) return 0;
+ return (items - 1) / kItemsPerWord + 1;
+ }
+
+ // The array index to look at for item.
+ static int index(int base_index, int item) {
+ return base_index + item / kItemsPerWord;
+ }
+
+ // Extract T data for a given item from data.
+ static T decode(U data, int item) {
+ return static_cast<T>((data >> shift(item)) & kMask);
+ }
+
+ // Return the encoding for a store of value for item in previous.
+ static U encode(U previous, int item, T value) {
+ int shift_value = shift(item);
+ int set_bits = (static_cast<int>(value) << shift_value);
+ return (previous & ~(kMask << shift_value)) | set_bits;
+ }
+
+ static int shift(int item) { return (item % kItemsPerWord) * kBitsPerItem; }
+};
+
+
+// ----------------------------------------------------------------------------
// Hash function.
static const uint32_t kZeroHashSeed = 0;
@@ -816,7 +863,7 @@
// compute the length of the input string.
void AddString(const char* s);
- // Add the first 'n' characters of the given string 's' to the
+ // Add the first 'n' characters of the given 0-terminated string 's' to the
// builder. The input string must have enough characters.
void AddSubstring(const char* s, int n);
@@ -952,6 +999,33 @@
};
+template <int dummy_parameter>
+class VectorSlot {
+ public:
+ explicit VectorSlot(int id) : id_(id) {}
+ int ToInt() const { return id_; }
+
+ static VectorSlot Invalid() { return VectorSlot(kInvalidSlot); }
+ bool IsInvalid() const { return id_ == kInvalidSlot; }
+
+ VectorSlot next() const {
+ DCHECK(id_ != kInvalidSlot);
+ return VectorSlot(id_ + 1);
+ }
+
+ bool operator==(const VectorSlot& other) const { return id_ == other.id_; }
+
+ private:
+ static const int kInvalidSlot = -1;
+
+ int id_;
+};
+
+
+typedef VectorSlot<0> FeedbackVectorSlot;
+typedef VectorSlot<1> FeedbackVectorICSlot;
+
+
class BailoutId {
public:
explicit BailoutId(int id) : id_(id) { }
@@ -966,6 +1040,8 @@
bool IsNone() const { return id_ == kNoneId; }
bool operator==(const BailoutId& other) const { return id_ == other.id_; }
bool operator!=(const BailoutId& other) const { return id_ != other.id_; }
+ friend size_t hash_value(BailoutId);
+ friend std::ostream& operator<<(std::ostream&, BailoutId);
private:
static const int kNoneId = -1;