diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-07-05 14:40:13 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-07-05 14:51:29 -0700 |
commit | 149562555c9bf56457dee9a1ad70c53ed670a776 (patch) | |
tree | f6217cf3c54ddbee03f37247a3c7c75203f868fd /deps/v8/src/utils.h | |
parent | f08720606757577d95bd09b48697c7decbf17f00 (diff) | |
download | node-new-149562555c9bf56457dee9a1ad70c53ed670a776.tar.gz |
Downgrade V8 to 3.1.8.25
There are serious performance regressions both in V8 and our own legacy
networking stack. Until we correct our own problems we are going back to the
old V8.
Diffstat (limited to 'deps/v8/src/utils.h')
-rw-r--r-- | deps/v8/src/utils.h | 58 |
1 files changed, 12 insertions, 46 deletions
diff --git a/deps/v8/src/utils.h b/deps/v8/src/utils.h index 331c01add8..219343b7fa 100644 --- a/deps/v8/src/utils.h +++ b/deps/v8/src/utils.h @@ -1,4 +1,4 @@ -// Copyright 2011 the V8 project authors. All rights reserved. +// Copyright 2006-2008 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: @@ -52,9 +52,11 @@ static inline bool IsPowerOf2(T x) { // X must be a power of 2. Returns the number of trailing zeros. -static inline int WhichPowerOf2(uint32_t x) { +template <typename T> +static inline int WhichPowerOf2(T x) { ASSERT(IsPowerOf2(x)); ASSERT(x != 0); + if (x < 0) return 31; int bits = 0; #ifdef DEBUG int original_x = x; @@ -220,11 +222,6 @@ class BitField { return static_cast<uint32_t>(value) << shift; } - // Returns a uint32_t with the bit field value updated. - static uint32_t update(uint32_t previous, T value) { - return (previous & ~mask()) | encode(value); - } - // Extracts the bit field from the value. static T decode(uint32_t value) { return static_cast<T>((value & mask()) >> shift); @@ -254,12 +251,6 @@ static inline uint32_t ComputeIntegerHash(uint32_t key) { } -static inline uint32_t ComputePointerHash(void* ptr) { - return ComputeIntegerHash( - static_cast<uint32_t>(reinterpret_cast<intptr_t>(ptr))); -} - - // ---------------------------------------------------------------------------- // Miscellaneous @@ -585,7 +576,14 @@ class Collector { } // Resets the collector to be empty. - virtual void Reset(); + virtual void Reset() { + for (int i = chunks_.length() - 1; i >= 0; i--) { + chunks_.at(i).Dispose(); + } + chunks_.Rewind(0); + index_ = 0; + size_ = 0; + } // Total number of elements added to collector so far. inline int size() { return size_; } @@ -786,42 +784,10 @@ struct BitCastHelper<Dest, Source*> { }; template <class Dest, class Source> -INLINE(Dest BitCast(const Source& source)); - -template <class Dest, class Source> inline Dest BitCast(const Source& source) { return BitCastHelper<Dest, Source>::cast(source); } - -template<typename ElementType, int NumElements> -class EmbeddedContainer { - public: - EmbeddedContainer() : elems_() { } - - int length() { return NumElements; } - ElementType& operator[](int i) { - ASSERT(i < length()); - return elems_[i]; - } - - private: - ElementType elems_[NumElements]; -}; - - -template<typename ElementType> -class EmbeddedContainer<ElementType, 0> { - public: - int length() { return 0; } - ElementType& operator[](int i) { - UNREACHABLE(); - static ElementType t = 0; - return t; - } -}; - - } } // namespace v8::internal #endif // V8_UTILS_H_ |