Browse Source

v8: fix -Wsign-compare warning in Zone::New()

Use unsigned types for size calculations.  Fixes a warning that was
drowning out everything else because zone-inl.h is included in every
source file:

		../deps/v8/src/zone-inl.h: In member function 'void* v8::internal::Zone::New(int)':
		../deps/v8/src/zone-inl.h:61:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
			 if (limit < position || size > limit - position) {

PR-URL: https://github.com/nodejs/node-private/pull/62
Reviewed-By: Rod Vagg <rod@vagg.org>
v0.10
Ben Noordhuis 9 years ago
committed by Rod Vagg
parent
commit
88dcc7f5bb
  1. 2
      deps/v8/src/version.cc
  2. 10
      deps/v8/src/zone-inl.h
  3. 4
      deps/v8/src/zone.h

2
deps/v8/src/version.cc

@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 14
#define BUILD_NUMBER 5
#define PATCH_LEVEL 10
#define PATCH_LEVEL 11
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0

10
deps/v8/src/zone-inl.h

@ -39,7 +39,7 @@ namespace v8 {
namespace internal {
inline void* Zone::New(int size) {
inline void* Zone::New(size_t size) {
ASSERT(scope_nesting_ > 0);
// Round up the requested size to fit the alignment.
size = RoundUp(size, kAlignment);
@ -72,7 +72,7 @@ inline void* Zone::New(int size) {
template <typename T>
T* Zone::NewArray(int length) {
T* Zone::NewArray(size_t length) {
return static_cast<T*>(New(length * sizeof(T)));
}
@ -98,18 +98,18 @@ ZoneSplayTree<Config>::~ZoneSplayTree() {
void* ZoneObject::operator new(size_t size, Zone* zone) {
return zone->New(static_cast<int>(size));
return zone->New(size);
}
inline void* ZoneAllocationPolicy::New(size_t size) {
ASSERT(zone_);
return zone_->New(static_cast<int>(size));
return zone_->New(size);
}
template <typename T>
void* ZoneList<T>::operator new(size_t size, Zone* zone) {
return zone->New(static_cast<int>(size));
return zone->New(size);
}

4
deps/v8/src/zone.h

@ -68,10 +68,10 @@ class Zone {
~Zone() { DeleteKeptSegment(); }
// Allocate 'size' bytes of memory in the Zone; expands the Zone by
// allocating new segments of memory on demand using malloc().
inline void* New(int size);
inline void* New(size_t size);
template <typename T>
inline T* NewArray(int length);
inline T* NewArray(size_t length);
// Deletes all objects and free all memory allocated in the Zone. Keeps one
// small (size <= kMaximumKeptSegmentSize) segment around if it finds one.

Loading…
Cancel
Save