summaryrefslogtreecommitdiff
path: root/deps/v8/src/codegen/reglist.h
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-08-01 08:38:30 +0200
committerMichaël Zasso <targos@protonmail.com>2019-08-01 12:53:56 +0200
commit2dcc3665abf57c3607cebffdeeca062f5894885d (patch)
tree4f560748132edcfb4c22d6f967a7e80d23d7ea2c /deps/v8/src/codegen/reglist.h
parent1ee47d550c6de132f06110aa13eceb7551d643b3 (diff)
downloadandroid-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.tar.gz
android-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.tar.bz2
android-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.zip
deps: update V8 to 7.6.303.28
PR-URL: https://github.com/nodejs/node/pull/28016 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'deps/v8/src/codegen/reglist.h')
-rw-r--r--deps/v8/src/codegen/reglist.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/deps/v8/src/codegen/reglist.h b/deps/v8/src/codegen/reglist.h
new file mode 100644
index 0000000000..609e6b8845
--- /dev/null
+++ b/deps/v8/src/codegen/reglist.h
@@ -0,0 +1,47 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_CODEGEN_REGLIST_H_
+#define V8_CODEGEN_REGLIST_H_
+
+#include <cstdint>
+
+#include "src/base/bits.h"
+#include "src/base/template-utils.h"
+
+namespace v8 {
+namespace internal {
+
+// Register configurations.
+#if V8_TARGET_ARCH_ARM64
+using RegList = uint64_t;
+#else
+using RegList = uint32_t;
+#endif
+
+// Get the number of registers in a given register list.
+constexpr int NumRegs(RegList list) {
+ return base::bits::CountPopulation(list);
+}
+
+// Combine two RegLists by building the union of the contained registers.
+// Implemented as a Functor to pass it to base::fold even on gcc < 5 (see
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52892).
+// TODO(clemensh): Remove this once we require gcc >= 5.0.
+struct CombineRegListsFunctor {
+ constexpr RegList operator()(RegList list1, RegList list2) const {
+ return list1 | list2;
+ }
+};
+
+// Combine several RegLists by building the union of the contained registers.
+template <typename... RegLists>
+constexpr RegList CombineRegLists(RegLists... lists) {
+ return base::fold(CombineRegListsFunctor{}, 0, lists...);
+}
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_CODEGEN_REGLIST_H_