-
Notifications
You must be signed in to change notification settings - Fork 193
Upgrade to v8 4.5, move towards 1.0 release #348
base: master
Are you sure you want to change the base?
Conversation
The functionality will be added (that is, if I don't get bored) one thing at a time with the spec. If you want to test, point the libv8 gem (in Gemfile) to its trunk branch & my changes at stormbreakerbg/libv8 @ trunk. What works currently is getting V8 to initialize, say its version and create a new Isolate.
You can now create a JS object from Ruby-land without segfaulting
They ARE disposed of automatically. Source: https://strongloop.com/strongblog/node-js-v0-12-c-apis-breaking/
Also lock on some more places
Isolate reference queue
Managed external objects
- GetConstructorName - InternalFieldCount - GetInternalField - SetInternalField - HasOwnProperty - HasRealNamedProperty - HasRealIndexedProperty - HasRealNamedCallbackProperty - GetRealNamedPropertyInPrototypeChain - GetRealNamedProperty - GetRealNamedPropertyAttributes - GetRealNamedPropertyAttributesInPrototypeChain - HasNamedLookupInterceptor - HasIndexedLookupInterceptor - SetHiddenValue - GetHiddenValue - DeleteHiddenValue - Clone - CreationContext - IsCallable - CallAsFunction - CallAsConstructor
This adds the ability embed basic Ruby code blocks into a javascript context and invoke it. cxt = V8::Context.new cxt['twice'] = lambda {|str| "#{str}#{str}"} cxt.eval('twice("hi")') #=> "hihi" Note that error handling is not accounted for yet. If an exception happens inside the called proc, it will cause terrible, awful things to happen because portions of the C++ stack will not be unwound leaving the Isolate in an indeterminate state.
Convert CloneElementAt to the Maybe API
finish out the Array C API
Embed lambdas and procs into V8::Context
add support for TryCatch along with StackTrace
v8 4.5 has very convenient APIs for interrupting potentially long running JavaScript code. This exposes those APIs to Ruby code so that it can place its own limits on the CPU resources consumed by V8.
add pre-emption APIS
Since [1] V8 finally assumes that v8/include is in the include path. [1] https://chromium.googlesource.com/v8/v8/+/e8c914f18fd88cd58aaaf5d8cee53b9e57477b52 The following patch should be applied before moving on to V8 5.1+: diff --git a/ext/v8/rr.h b/ext/v8/rr.h
index 37a5e4d..373a80a 100644
--- a/ext/v8/rr.h
+++ b/ext/v8/rr.h
@@ -1,9 +1,8 @@
#ifndef THE_RUBY_RACER
#define THE_RUBY_RACER
-#include <include/v8.h>
-#include <include/libplatform/libplatform.h>
-
+#include <v8.h>
+#include <libplatform/libplatform.h>
#include <ruby.h>
#include <vector>
#ifdef HAVE_RUBY_ENCODING_H |
Hey, is this still actively being worked on? :) |
Right now, no. @cowboyd was planning to work on this some more this month, not sure how his plans are holding up though. |
@ignisf : thanks for the info :) |
This gem (and the less gem(s)) are great. Thanks for all you've done to make this work. By any chance are there still plans to update this gem to use a newer (faster) v8? |
Is this still active? |
I do not actively work on this gem anymore. |
@cowboyd it would be good to update the README.md saying as much so that information is front/centre when people come to the repo. And maybe also creating a pinned issue about it, to centralize any discussions/desires people may have to continue work on it as a community. |
This PR upgrades the version of V8 used by The Ruby Racer in order to take advantage of the significantly improved embedding APIs that it exposes. This allows us to address the long-standing stability issues that have plagued the pre-releases. It will basis of a 1.0 release.
V8::C::External
values with robust memory handling.Maybe
handlingMaybe APIs #364V8::C::Object
implementation -Implement Object API #377V8::C::Array
implementationfinish out the Array C API #381ObjectTemplate
Signature
andAccessorSignature
SetHandler()
(named properties and indexed properties)SetCallAsFunctionHandler
FunctionTemplate
New
,SetLength
,InstanceTemplate
,Inherit
,PrototypeTemplate
, etc...SetCallHandler
add support for TryCatch along with StackTrace #379TerminateExecution
, et al.) add pre-emption APIS #382c++11