Improved performance of unary addition by avoiding runtime calls.
Fixed the handling of '>' and '<=' to use right-to-left conversion and left-to-right evaluation as specified by ECMA-262.
Fixed a branch elimination bug on the ARM platform where incorrect code was generated because of overly aggressive branch elimination.
Improved performance of code that repeatedly assigns the same function to the same property of different objects with the same map.
Untangled DEBUG and ENABLE_DISASSEMBLER defines. The disassembler no longer expects DEBUG to be defined.
Added platform-nullos.cc to serve as the basis for new platform implementations.
git-svn-id: http://v8.googlecode.com/svn/trunk@9 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/utils.h b/src/utils.h
index a91a2ab..f9bf028 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -40,21 +40,19 @@
}
-// Returns smallest power of 2 greater or equal to x (from Hacker's Delight).
-int32_t NextPowerOf2(uint32_t x);
-// The C++ standard leaves the semantics of '>>'
-// undefined for negative signed operands. Most
-// implementations do the right thing, though.
+// The C++ standard leaves the semantics of '>>' undefined for
+// negative signed operands. Most implementations do the right thing,
+// though.
static inline int ArithmeticShiftRight(int x, int s) {
return x >> s;
}
// Compute the 0-relative offset of some absolute value x of type T.
-// This allows conversion of Addresses and integral types into 0-relative
-// int offsets.
+// This allows conversion of Addresses and integral types into
+// 0-relative int offsets.
template <typename T>
static inline int OffsetFrom(T x) {
return x - static_cast<T>(0);
@@ -62,8 +60,8 @@
// Compute the absolute value of type T for some 0-relative offset x.
-// This allows conversion of 0-relative int offsets into Addresses
-// and integral types.
+// This allows conversion of 0-relative int offsets into Addresses and
+// integral types.
template <typename T>
static inline T AddressFrom(int x) {
return static_cast<T>(0) + x;
@@ -85,6 +83,11 @@
}
+// Returns the smallest power of two which is >= x. If you pass in a
+// number that is already a power of two, it is returned as is.
+uint32_t RoundUpToPowerOf2(uint32_t x);
+
+
template <typename T>
static inline bool IsAligned(T value, T alignment) {
ASSERT(IsPowerOf2(alignment));
@@ -114,8 +117,8 @@
// ----------------------------------------------------------------------------
-// BitField is a help template for encoding and decode bitfield with unsigned
-// content.
+// BitField is a help template for encoding and decode bitfield with
+// unsigned content.
template<class T, int shift, int size>
class BitField {
public: