Skip to content

Commit

Permalink
src: update after v8 api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis authored and tjfontaine committed Oct 23, 2013
1 parent a53c763 commit ef4a35b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ inline Environment::IsolateData::IsolateData(v8::Isolate* isolate)
: event_loop_(uv_default_loop()),
isolate_(isolate),
#define V(PropertyName, StringValue) \
PropertyName ## _index_( \
FIXED_ONE_BYTE_STRING(isolate, StringValue).Eternalize(isolate)),
PropertyName ## _(isolate, FIXED_ONE_BYTE_STRING(isolate, StringValue)),
PER_ISOLATE_STRING_PROPERTIES(V)
#undef V
ref_count_(0) {
Expand Down Expand Up @@ -276,8 +275,8 @@ inline Environment::IsolateData* Environment::isolate_data() const {
#define V(PropertyName, StringValue) \
inline \
v8::Local<v8::String> Environment::IsolateData::PropertyName() const { \
return v8::Local<v8::String>::GetEternal(isolate(), \
PropertyName ## _index_); \
/* Strings are immutable so casting away const-ness here is okay. */ \
return const_cast<IsolateData*>(this)->PropertyName ## _.Get(isolate()); \
}
PER_ISOLATE_STRING_PROPERTIES(V)
#undef V
Expand Down
2 changes: 1 addition & 1 deletion src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class Environment {
v8::Isolate* const isolate_;

#define V(PropertyName, StringValue) \
const int PropertyName ## _index_;
v8::Eternal<v8::String> PropertyName ## _;
PER_ISOLATE_STRING_PROPERTIES(V)
#undef V

Expand Down
12 changes: 10 additions & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ class ArrayBufferAllocator : public ArrayBuffer::Allocator {
static ArrayBufferAllocator the_singleton;
virtual ~ArrayBufferAllocator() {}
virtual void* Allocate(size_t length);
virtual void Free(void* data);
virtual void* AllocateUninitialized(size_t length);
virtual void Free(void* data, size_t length);
private:
ArrayBufferAllocator() {}
ArrayBufferAllocator(const ArrayBufferAllocator&);
Expand All @@ -170,7 +171,14 @@ void* ArrayBufferAllocator::Allocate(size_t length) {
}


void ArrayBufferAllocator::Free(void* data) {
void* ArrayBufferAllocator::AllocateUninitialized(size_t length) {
if (length > kMaxLength)
return NULL;
return new char[length];
}


void ArrayBufferAllocator::Free(void* data, size_t length) {
delete[] static_cast<char*>(data);
}

Expand Down
1 change: 1 addition & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ process.on('exit', function() {
clearInterval,
clearImmediate,
console,
constructor, // Enumerable in V8 3.21.
Buffer,
process,
global];
Expand Down

0 comments on commit ef4a35b

Please sign in to comment.