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}
---
Change-Id: I8c23c7bbb70772b4858fe8a47b64fa97ee0d1f8c
diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc
index 642ffc7..9d88d12 100644
--- a/src/compiler/simplified-operator.cc
+++ b/src/compiler/simplified-operator.cc
@@ -13,7 +13,7 @@
namespace internal {
namespace compiler {
-OStream& operator<<(OStream& os, BaseTaggedness base_taggedness) {
+std::ostream& operator<<(std::ostream& os, BaseTaggedness base_taggedness) {
switch (base_taggedness) {
case kUntaggedBase:
return os << "untagged base";
@@ -25,9 +25,99 @@
}
+MachineType BufferAccess::machine_type() const {
+ switch (external_array_type_) {
+ case kExternalUint8Array:
+ case kExternalUint8ClampedArray:
+ return kMachUint8;
+ case kExternalInt8Array:
+ return kMachInt8;
+ case kExternalUint16Array:
+ return kMachUint16;
+ case kExternalInt16Array:
+ return kMachInt16;
+ case kExternalUint32Array:
+ return kMachUint32;
+ case kExternalInt32Array:
+ return kMachInt32;
+ case kExternalFloat32Array:
+ return kMachFloat32;
+ case kExternalFloat64Array:
+ return kMachFloat64;
+ }
+ UNREACHABLE();
+ return kMachNone;
+}
+
+
+bool operator==(BufferAccess lhs, BufferAccess rhs) {
+ return lhs.external_array_type() == rhs.external_array_type();
+}
+
+
+bool operator!=(BufferAccess lhs, BufferAccess rhs) { return !(lhs == rhs); }
+
+
+size_t hash_value(BufferAccess access) {
+ return base::hash<ExternalArrayType>()(access.external_array_type());
+}
+
+
+std::ostream& operator<<(std::ostream& os, BufferAccess access) {
+ switch (access.external_array_type()) {
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: \
+ return os << #Type;
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
+ }
+ UNREACHABLE();
+ return os;
+}
+
+
+BufferAccess const BufferAccessOf(const Operator* op) {
+ DCHECK(op->opcode() == IrOpcode::kLoadBuffer ||
+ op->opcode() == IrOpcode::kStoreBuffer);
+ return OpParameter<BufferAccess>(op);
+}
+
+
+bool operator==(FieldAccess const& lhs, FieldAccess const& rhs) {
+ return lhs.base_is_tagged == rhs.base_is_tagged && lhs.offset == rhs.offset &&
+ lhs.machine_type == rhs.machine_type;
+}
+
+
+bool operator!=(FieldAccess const& lhs, FieldAccess const& rhs) {
+ return !(lhs == rhs);
+}
+
+
+size_t hash_value(FieldAccess const& access) {
+ return base::hash_combine(access.base_is_tagged, access.offset,
+ access.machine_type);
+}
+
+
+std::ostream& operator<<(std::ostream& os, FieldAccess const& access) {
+ os << "[" << access.base_is_tagged << ", " << access.offset << ", ";
+#ifdef OBJECT_PRINT
+ Handle<Name> name;
+ if (access.name.ToHandle(&name)) {
+ name->Print(os);
+ os << ", ";
+ }
+#endif
+ access.type->PrintTo(os);
+ os << ", " << access.machine_type << "]";
+ return os;
+}
+
+
bool operator==(ElementAccess const& lhs, ElementAccess const& rhs) {
return lhs.base_is_tagged == rhs.base_is_tagged &&
- lhs.header_size == rhs.header_size && lhs.type == rhs.type &&
+ lhs.header_size == rhs.header_size &&
lhs.machine_type == rhs.machine_type;
}
@@ -37,10 +127,16 @@
}
-OStream& operator<<(OStream& os, ElementAccess const& access) {
- os << "[" << access.base_is_tagged << ", " << access.header_size << ", ";
+size_t hash_value(ElementAccess const& access) {
+ return base::hash_combine(access.base_is_tagged, access.header_size,
+ access.machine_type);
+}
+
+
+std::ostream& operator<<(std::ostream& os, ElementAccess const& access) {
+ os << access.base_is_tagged << ", " << access.header_size << ", ";
access.type->PrintTo(os);
- os << ", " << access.machine_type << "]";
+ os << ", " << access.machine_type;
return os;
}
@@ -61,41 +157,8 @@
}
-// Specialization for static parameters of type {FieldAccess}.
-template <>
-struct StaticParameterTraits<FieldAccess> {
- static OStream& PrintTo(OStream& os, const FieldAccess& val) {
- return os << val.offset;
- }
- static int HashCode(const FieldAccess& val) {
- return (val.offset < 16) | (val.machine_type & 0xffff);
- }
- static bool Equals(const FieldAccess& lhs, const FieldAccess& rhs) {
- return lhs.base_is_tagged == rhs.base_is_tagged &&
- lhs.offset == rhs.offset && lhs.machine_type == rhs.machine_type &&
- lhs.type->Is(rhs.type);
- }
-};
-
-
-// Specialization for static parameters of type {ElementAccess}.
-template <>
-struct StaticParameterTraits<ElementAccess> {
- static OStream& PrintTo(OStream& os, const ElementAccess& access) {
- return os << access;
- }
- static int HashCode(const ElementAccess& access) {
- return (access.header_size < 16) | (access.machine_type & 0xffff);
- }
- static bool Equals(const ElementAccess& lhs, const ElementAccess& rhs) {
- return lhs.base_is_tagged == rhs.base_is_tagged &&
- lhs.header_size == rhs.header_size &&
- lhs.machine_type == rhs.machine_type && lhs.type->Is(rhs.type);
- }
-};
-
-
#define PURE_OP_LIST(V) \
+ V(AnyToBoolean, Operator::kNoProperties, 1) \
V(BooleanNot, Operator::kNoProperties, 1) \
V(BooleanToNumber, Operator::kNoProperties, 1) \
V(NumberEqual, Operator::kCommutative, 2) \
@@ -119,56 +182,106 @@
V(ChangeUint32ToTagged, Operator::kNoProperties, 1) \
V(ChangeFloat64ToTagged, Operator::kNoProperties, 1) \
V(ChangeBoolToBit, Operator::kNoProperties, 1) \
- V(ChangeBitToBool, Operator::kNoProperties, 1)
+ V(ChangeBitToBool, Operator::kNoProperties, 1) \
+ V(ObjectIsSmi, Operator::kNoProperties, 1) \
+ V(ObjectIsNonNegativeSmi, Operator::kNoProperties, 1)
-#define ACCESS_OP_LIST(V) \
- V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1) \
- V(StoreField, FieldAccess, Operator::kNoRead, 2, 0) \
- V(LoadElement, ElementAccess, Operator::kNoWrite, 3, 1) \
- V(StoreElement, ElementAccess, Operator::kNoRead, 4, 0)
-
-
-struct SimplifiedOperatorBuilderImpl FINAL {
-#define PURE(Name, properties, input_count) \
- struct Name##Operator FINAL : public SimpleOperator { \
- Name##Operator() \
- : SimpleOperator(IrOpcode::k##Name, Operator::kPure | properties, \
- input_count, 1, #Name) {} \
- }; \
+struct SimplifiedOperatorGlobalCache FINAL {
+#define PURE(Name, properties, input_count) \
+ struct Name##Operator FINAL : public Operator { \
+ Name##Operator() \
+ : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \
+ input_count, 0, 0, 1, 0, 0) {} \
+ }; \
Name##Operator k##Name;
PURE_OP_LIST(PURE)
#undef PURE
+
+#define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \
+ struct LoadBuffer##Type##Operator FINAL : public Operator1<BufferAccess> { \
+ LoadBuffer##Type##Operator() \
+ : Operator1<BufferAccess>(IrOpcode::kLoadBuffer, \
+ Operator::kNoThrow | Operator::kNoWrite, \
+ "LoadBuffer", 3, 1, 1, 1, 1, 0, \
+ BufferAccess(kExternal##Type##Array)) {} \
+ }; \
+ struct StoreBuffer##Type##Operator FINAL : public Operator1<BufferAccess> { \
+ StoreBuffer##Type##Operator() \
+ : Operator1<BufferAccess>(IrOpcode::kStoreBuffer, \
+ Operator::kNoRead | Operator::kNoThrow, \
+ "StoreBuffer", 4, 1, 1, 0, 1, 0, \
+ BufferAccess(kExternal##Type##Array)) {} \
+ }; \
+ LoadBuffer##Type##Operator kLoadBuffer##Type; \
+ StoreBuffer##Type##Operator kStoreBuffer##Type;
+ TYPED_ARRAYS(BUFFER_ACCESS)
+#undef BUFFER_ACCESS
};
-static base::LazyInstance<SimplifiedOperatorBuilderImpl>::type kImpl =
+static base::LazyInstance<SimplifiedOperatorGlobalCache>::type kCache =
LAZY_INSTANCE_INITIALIZER;
SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone)
- : impl_(kImpl.Get()), zone_(zone) {}
+ : cache_(kCache.Get()), zone_(zone) {}
#define PURE(Name, properties, input_count) \
- const Operator* SimplifiedOperatorBuilder::Name() { return &impl_.k##Name; }
+ const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; }
PURE_OP_LIST(PURE)
#undef PURE
const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) {
// TODO(titzer): What about the type parameter?
- return new (zone()) SimpleOperator(IrOpcode::kReferenceEqual,
- Operator::kCommutative | Operator::kPure,
- 2, 1, "ReferenceEqual");
+ return new (zone()) Operator(IrOpcode::kReferenceEqual,
+ Operator::kCommutative | Operator::kPure,
+ "ReferenceEqual", 2, 0, 0, 1, 0, 0);
}
-#define ACCESS(Name, Type, properties, input_count, output_count) \
- const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \
- return new (zone()) \
- Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \
- input_count, output_count, #Name, access); \
+const Operator* SimplifiedOperatorBuilder::LoadBuffer(BufferAccess access) {
+ switch (access.external_array_type()) {
+#define LOAD_BUFFER(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: \
+ return &cache_.kLoadBuffer##Type;
+ TYPED_ARRAYS(LOAD_BUFFER)
+#undef LOAD_BUFFER
+ }
+ UNREACHABLE();
+ return nullptr;
+}
+
+
+const Operator* SimplifiedOperatorBuilder::StoreBuffer(BufferAccess access) {
+ switch (access.external_array_type()) {
+#define STORE_BUFFER(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: \
+ return &cache_.kStoreBuffer##Type;
+ TYPED_ARRAYS(STORE_BUFFER)
+#undef STORE_BUFFER
+ }
+ UNREACHABLE();
+ return nullptr;
+}
+
+
+#define ACCESS_OP_LIST(V) \
+ V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \
+ V(StoreField, FieldAccess, Operator::kNoRead, 2, 1, 0) \
+ V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1, 1) \
+ V(StoreElement, ElementAccess, Operator::kNoRead, 3, 1, 0)
+
+
+#define ACCESS(Name, Type, properties, value_input_count, control_input_count, \
+ output_count) \
+ const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \
+ return new (zone()) \
+ Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \
+ #Name, value_input_count, 1, control_input_count, \
+ output_count, 1, 0, access); \
}
ACCESS_OP_LIST(ACCESS)
#undef ACCESS