v8: upgrade to v3.20.2, update src/ #5804

Closed
wants to merge 9 commits into
from

Projects

None yet

3 participants

@bnoordhuis
Member

This is the big one, people:

$ git diff --shortstat origin/master
 1234 files changed, 171067 insertions(+), 18217 deletions(-)

The major changes are summed up in the third commit. For posterity:

This is a big commit that touches just about every file in the src/
directory. The V8 API has changed in significant ways. The most
important changes are:

* Binding functions take a const v8::FunctionCallbackInfo<T>& argument
  rather than a const v8::Arguments& argument.

* Binding functions return void rather than v8::Handle<v8::Value>. The
  return value is returned with the args.GetReturnValue().Set() family
  of functions.

* v8::Persistent<T> no longer derives from v8::Handle<T> and no longer
  allows you to directly dereference the object that the persistent
  handle points to. This means that the common pattern of caching
  oft-used JS values in a persistent handle no longer quite works,
  you first need to reconstruct a v8::Local<T> from the persistent
  handle with the Local<T>::New(isolate, persistent) factory method.

A handful of (internal) convenience classes and functions have been
added to make dealing with the new API a little easier.

The most visible one is node::Cached<T>, which wraps a v8::Persistent<T>
with some template sugar. It can hold arbitrary types but so far it's
exclusively used for v8::Strings (which was by far the most commonly
cached handle type.)
@TooTallNate

Lots of new V8 tests, huh?

@trevnorris

build is causing node to run slow. this seems to fix it: https://gist.github.com/trevnorris/5938517

@trevnorris

missed

diff --git a/src/smalloc.cc b/src/smalloc.cc
index 6ccb08f..f098f09 100644
--- a/src/smalloc.cc
+++ b/src/smalloc.cc
@@ -215,9 +215,9 @@ void Alloc(Handle<Object> obj,

   node_isolate->AdjustAmountOfExternalAllocatedMemory(length +
                                                       sizeof(*cb_info));
-  p_obj.MakeWeak(node_isolate, static_cast<void*>(cb_info), TargetFreeCallback);
-  p_obj.MarkIndependent(node_isolate);
-  p_obj.SetWrapperClassId(node_isolate, ALLOC_ID);
+  p_obj.MakeWeak(solate, static_cast<void*>(cb_info), TargetFreeCallback);
+  p_obj.MarkIndependent();
+  p_obj.SetWrapperClassId(ALLOC_ID);
   obj->SetIndexedPropertiesToExternalArrayData(data,
                                                kExternalUnsignedByteArray,
                                                length);
bnoordhuis added some commits Jul 2, 2013
@bnoordhuis bnoordhuis v8: upgrade to v3.20.2 704fd8f
@bnoordhuis bnoordhuis v8: reapply floating patches 588040d
@bnoordhuis bnoordhuis build: remove --unsafe-optimizations flag
The previous commit removes our patch that builds V8 at -O2 rather
than -O3 so there is not much point in keeping the configure switch
around.

The reason it did so was to work around an assortment of compiler and
linker bugs. In particular, certain combinations of g++ and binutils
generate bad or no code when -ffunction-sections or -finline-functions
is enabled (which -O3 implicitly does.)

It was quite the problem back in the day because everyone and his dog
built from source. Now that we have prebuilt binaries and packages
available, there is no longer a pressing need to be so accommodating.

If you experience spurious (or possibly not so spurious) segmentation
faults after this commit, you need to upgrade your compiler/linker
toolchain.
9b3de60
@bnoordhuis bnoordhuis lib, src: upgrade after v8 api change
This is a big commit that touches just about every file in the src/
directory. The V8 API has changed in significant ways. The most
important changes are:

* Binding functions take a const v8::FunctionCallbackInfo<T>& argument
  rather than a const v8::Arguments& argument.

* Binding functions return void rather than v8::Handle<v8::Value>. The
  return value is returned with the args.GetReturnValue().Set() family
  of functions.

* v8::Persistent<T> no longer derives from v8::Handle<T> and no longer
  allows you to directly dereference the object that the persistent
  handle points to. This means that the common pattern of caching
  oft-used JS values in a persistent handle no longer quite works,
  you first need to reconstruct a v8::Local<T> from the persistent
  handle with the Local<T>::New(isolate, persistent) factory method.

A handful of (internal) convenience classes and functions have been
added to make dealing with the new API a little easier.

The most visible one is node::Cached<T>, which wraps a v8::Persistent<T>
with some template sugar. It can hold arbitrary types but so far it's
exclusively used for v8::Strings (which was by far the most commonly
cached handle type.)
eb3a6c9
@bnoordhuis bnoordhuis string_bytes: stop using String::AsciiValue
Debug builds of V8 now actively check that the string only contains
ASCII characters (i.e. doesn't contain bytes with the high bit set.)
b45d86a
@bnoordhuis bnoordhuis src: abort() on fatal error in debug mode
abort() generates a nice core dump and makes it easy to catch fatal
errors in one's debugger of choice.
d9346f1
@bnoordhuis bnoordhuis src: enable native v8 typed arrays
This commit removes our homegrown typed arrays implementation and
enables V8's built-in typed arrays implementation.
40619d5
@bnoordhuis bnoordhuis tools: add check-imports.sh script
Checks that `using` statements in src/*.cc are properly sorted and
actually used.
3a09f48
@bnoordhuis bnoordhuis test: fix up weakref.cc after v8 api change 19be7e7
@bnoordhuis bnoordhuis closed this Jul 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment