Bert Belder
0d636de447
Add safe alternative to get_data/set_data ( #360 )
2020-04-23 03:34:28 -04:00
Bert Belder
05782b846f
Make Isolate take ownership of CreateParams ( #357 )
2020-04-20 21:18:03 +02:00
Bert Belder
fc582316db
Refactor C++ shared pointer wrappers ( #355 )
...
* Add `SharedPtr` as a nullable sibling to `SharedRef`.
* Add `Borrow`, `AsRef` and `AsMut` implementations as appropriate.
* `SharedRef<T>` now derefs to `T` rather than to `UnsafeCell<T>`.
* `array_buffer::BackingStore` now derefs to `[Cell<u8>]`.
2020-04-20 19:38:08 +02:00
Bert Belder
256b6710d0
Remove transmutes from UniquePtr/UniqueRef implementation ( #352 )
2020-04-16 03:21:11 +02:00
Bert Belder
d1ac68f0c8
Always use raw pointers to send V8 handles between C++ and Rust ( #349 )
...
And other pointer usage touch-ups on the C++ side:
- const parameters are passed by & reference.
- mutable parameters are passed by * pointer.
2020-04-14 00:34:32 +02:00
Bert Belder
675d585977
Add binding for v8__internal__GetIsolateFromHeapObject() ( #348 )
2020-04-13 02:18:05 +02:00
FrankBlue
5a5bad9adf
add Map::size and Map::as_array ( #333 )
2020-04-02 13:37:13 -04:00
Michał Sabiniarz
bb0be74b0b
add v8::Proxy ( #330 )
2020-04-01 17:47:19 -04:00
Max Bruce
6bf57abb5c
Implement GetPrototype and SetPrototype on objects ( #321 )
2020-03-23 11:39:43 -04:00
Kevin (Kun) "Kassimo" Qian
747f513cba
Add v8::Function::new_with_data to attach associated data ( #310 )
2020-03-14 22:42:18 -04:00
Bert Belder
8a3c19ece4
Upgrade V8 to 8.2.308 ( #306 )
2020-03-13 22:05:16 -07:00
Ben Noordhuis
0df04f2129
Add Isolate::take_heap_snapshot() ( #302 )
...
This doesn't really follow the current V8 API (it's pretty close to how
V8 used to be back in 2012 though.) However:
1. The C++ API is very C++-y and doesn't carry over well to Rust, and
2. It addresses the immediate need of being able to take heap snapshots.
Refs #298
2020-03-09 10:30:25 -07:00
Bert Belder
e1b59ec736
Implement 'Eq' and 'PartialEq' traits for local handles ( #301 )
2020-03-05 19:37:58 -08:00
Ryan Dahl
816b6ad537
Fix BackingStore segfault ( #294 )
2020-02-28 18:40:48 -05:00
Bert Belder
3803e07065
Revert "Add HandleScope::new2 hack to construct from const ref ( #290 )"
...
It's not pretty, and we currently don't need it in Deno.
This reverts commit 4f0662ed57
.
2020-02-25 17:22:05 -08:00
Bert Belder
eba98e7a5e
Revert "Add ability to attach arbitrary state to Isolate ( #282 )"
...
This patch introduces a bug that breaks Deno.
This reverts commit 457f7ae779
.
2020-02-25 17:21:55 -08:00
Ryan Dahl
4f0662ed57
Add HandleScope::new2 hack to construct from const ref ( #290 )
2020-02-20 03:14:19 -05:00
Ryan Dahl
d3bbd05634
Add new terminate_execution test ( #288 )
2020-02-19 22:55:44 -05:00
Ryan Dahl
457f7ae779
Add ability to attach arbitrary state to Isolate ( #282 )
2020-02-18 23:46:00 -05:00
Ben Noordhuis
5d0b9fd760
Add some Array methods ( #283 )
2020-02-14 09:42:54 -05:00
Ryan Dahl
554f06f6bc
Fix get_slot and set_slot ( #281 )
2020-02-13 15:03:25 -05:00
Bert Belder
ddc8062644
Move get_*_context() methods to scope::Entered, remove InContext trait ( #279 )
...
The `get_current_context()` and `get_entered_or_microtask_context()`
methods now return `Option<Local<Context>>` to reflect that an isolate
may not have entered any context.
They're also moved from `Isolate` to `struct Entered` because it turns
out that the underlying V8 API calls actually create new local handles,
hence they should only be used inside an active HandleScope.
The `InContext` trait has been removed.
A test exercising `ContextScope` and the `get_*_context()` methods
mentioned above was added.
Closes: #248 .
2020-02-12 22:00:31 -08:00
Bert Belder
432edd9f24
Split compile_fail tests to have only one error in each test ( #277 )
2020-02-12 15:21:02 -08:00
Ryan Dahl
47aafbc62e
Add compile_fail test for boxed Local ( #275 )
2020-02-12 14:45:14 -08:00
Ryan Dahl
27277ad801
Add IsolateHandle ( #274 )
...
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2020-02-12 11:33:58 -05:00
Ryan Dahl
32abe84dc6
Remove v8::Locker ( #272 )
...
This patch clarifies that v8::Isolate is a single threaded creature,
which can only be accessed from other threads in special circumstances.
To ensure optimal operation in Deno, we remove v8::Locker, which ought
to be unnecessary when a thread is dedicated to each Isolate and the
Isolates never move between threads.
There are valid use-cases for v8::Locker, and we hope to address them in
future versions of rusty_v8.
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2020-02-11 17:01:27 -05:00
Ryan Dahl
4f449b6ec6
Upgrade V8 to 8.1.310 ( #263 )
...
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2020-01-30 20:44:28 -05:00
Ryan Dahl
87fdcdc131
dedup inspector client/channel test implementations ( #262 )
2020-01-29 13:11:22 -05:00
Ryan Dahl
62a52e0241
Do not use std::os::raw::c_int in public API ( #259 )
2020-01-28 17:16:31 -05:00
Ryan Dahl
2e61735f44
add test for schedule_pause_on_next_statement ( #258 )
2020-01-28 16:33:34 -05:00
Ben Noordhuis
9e14f18347
Add Object::creation_context() ( #255 )
...
And also Array::creation_context(), Function::creation_context(), etc.,
because they inherit from Object.
2020-01-26 17:42:28 +01:00
Ben Noordhuis
683aa2b2a9
Add V8InspectorClientImpl::console_api_message() ( #252 )
...
This makes it possible to intercept console.log() messages through
the V8 inspector API.
2020-01-24 09:33:54 -05:00
Ryan Dahl
093e09217c
SharedArrayBuffer::new_backing_store_from_boxed_slice doesn't need to be unsafe
2020-01-23 14:24:03 -05:00
Ryan Dahl
aca89c2055
new_backing_store_from_boxed_slice doesn't need to be unsafe ( #247 )
2020-01-23 10:17:23 -05:00
Bert Belder
2286052468
Rename String::new_empty() to String::empty() ( #244 )
...
This is more consistent with the C++ API.
2020-01-22 23:21:56 +01:00
Bert Belder
8617f77fd3
Refactor v8::Object bindings ( #243 )
...
* Rename `Object::new2()` to `Object::with_prototype_and_properties()`.
* Make `Object::with_prototype_and_properties()` take a slice of keys
and a slice of values as arguments, instead of using
`Vec<v8::Local<v8::Name>>` and `Vec<v8::Local<v8::Value>>>`.
* Remove type `MaybeBool` from the public interface. These methods now
return `Option<bool>` instead.
* Fix parameter type mismatches between Rust and C++ APIs.
2020-01-22 23:13:58 +01:00
Bert Belder
dcb94533f8
Make SharedRef<T> deref to UnsafeCell<T> instead of T ( #242 )
...
Closes: #240
2020-01-22 22:29:03 +01:00
Bert Belder
bf128554fc
Implement Clone for SharedRef<T> ( #241 )
2020-01-22 22:02:44 +01:00
Ben Noordhuis
ab3a086132
Add String::new_empty() ( #238 )
2020-01-22 17:23:42 +01:00
Bert Belder
1a1bac3883
Make BackingStore APIs more consistent with C++ ( #234 )
2020-01-21 16:23:47 +01:00
Bert Belder
b3d93dad78
Some clean-ups after making Locker a Scope ( #231 )
2020-01-21 03:16:55 +01:00
Bert Belder
44d58f8f48
Make Locker also a Scope ( #229 )
2020-01-21 02:03:45 +01:00
Bert Belder
937704ab76
Disable test 'handle_scope_escape_to_nowhere' on Windows CI ( #227 )
2020-01-20 23:34:34 +01:00
Bert Belder
36a12142f2
Make EscapableHandleScope::escape() inheritable, tighten lifetimes ( #227 )
2020-01-20 23:34:28 +01:00
Ben Noordhuis
6efb395fdc
Add Object::define_own_property() ( #228 )
...
This commit introduces the NONE, READ_ONLY, DONT_ENUM and DONT_DELETE
property attributes.
2020-01-20 11:16:24 -05:00
Ben Noordhuis
42af31ff38
Add Context::new_from_template() ( #225 )
2020-01-19 21:58:44 +01:00
Ben Noordhuis
2db5e10b9f
Add FunctionTemplate::set_class_name() ( #225 )
2020-01-19 21:58:35 +01:00
Ben Noordhuis
7b0269b447
Add ObjectTemplate and Template::set() ( #225 )
...
The ObjectTemplate type already existed but now it can also be
instantiated.
This commit also adds Template::set() to actually make that useful.
2020-01-19 21:58:20 +01:00
Bert Belder
6c1d65252a
Add ContextScope and lay foundations for scope inheritance ( #223 )
2020-01-18 13:41:28 +01:00
Bert Belder
00d8eb8e16
Fix methods that should require '&mut Isolate' but didn't ( #222 )
2020-01-17 15:40:29 +01:00