Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Upgrade to v8 4.5, move towards 1.0 release #348

Open
wants to merge 136 commits into
base: master
Choose a base branch
from
Open

Conversation

cowboyd
Copy link
Collaborator

@cowboyd cowboyd commented Jul 11, 2015

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.

  • upgrade libv8 to modern version Upgrade to v8 4.5 libv8#178
  • implement memory reference queues to coordinate garbage collection
  • implement V8::C::External values with robust memory handling.
  • test cases for memory leakage
  • Implement Maybe handling Maybe APIs #364
  • move away from all deprecated non-Maybe apis
  • finish V8::C::Object implementation - Implement Object API #377
  • finish V8::C::Array implementation finish out the Array C API #381
  • implement ObjectTemplate
    • Signature and AccessorSignature
    • SetHandler() (named properties and indexed properties)
    • SetCallAsFunctionHandler
  • implement FunctionTemplate
    • basic methods: New, SetLength, InstanceTemplate, Inherit, PrototypeTemplate, etc...
    • implement SetCallHandler
  • exception handling, try catch, etc... add support for TryCatch along with StackTrace #379
  • implement Pre-emption apis in the isolate (TerminateExecution, et al.) add pre-emption APIS #382
  • re-work high-level Ruby API on top of new C layer
  • investigate concurrent queues that do not require c++11
  • decide on final support matrix (ruby version, ruby implementation, C compiler, etc...)
  • final pass on code-style and organization
    • documentation in missing areas
    • extract as much into header files
    • use lambas if we go the c++11 route.

georgyangelov and others added 30 commits March 18, 2015 21:57
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
georgyangelov and others added 2 commits August 2, 2015 16:57
- GetConstructorName
- InternalFieldCount
- GetInternalField
- SetInternalField
- HasOwnProperty
- HasRealNamedProperty
- HasRealIndexedProperty
- HasRealNamedCallbackProperty
- GetRealNamedPropertyInPrototypeChain
- GetRealNamedProperty
- GetRealNamedPropertyAttributes
- GetRealNamedPropertyAttributesInPrototypeChain
- HasNamedLookupInterceptor
- HasIndexedLookupInterceptor
- SetHiddenValue
- GetHiddenValue
- DeleteHiddenValue
- Clone
- CreationContext
- IsCallable
- CallAsFunction
- CallAsConstructor
cowboyd and others added 9 commits August 12, 2015 18:15
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
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.
@ignisf
Copy link
Collaborator

ignisf commented Jun 10, 2016

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

@wk8
Copy link

wk8 commented Jun 15, 2016

Hey, is this still actively being worked on? :)

@ignisf
Copy link
Collaborator

ignisf commented Jun 15, 2016

Right now, no. @cowboyd was planning to work on this some more this month, not sure how his plans are holding up though.

@wk8
Copy link

wk8 commented Jun 15, 2016

@ignisf : thanks for the info :)

@JayTeeSF
Copy link

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?

@dojutsu-user
Copy link

Is this still active?

@cowboyd
Copy link
Collaborator Author

cowboyd commented Jan 24, 2021

Is this still active?

I do not actively work on this gem anymore. mini_racer is under active development and shares most of the use-cases.

@0xdevalias
Copy link

0xdevalias commented Jan 24, 2021

I do not actively work on this gem anymore. mini_racer is under active development and shares most of the use-cases.

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants