0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-01 16:51:32 -05:00
Commit graph

238 commits

Author SHA1 Message Date
Ryan Dahl
11340c9ca3
There should be a single entry point for creating IsolateHandle (#361) 2020-04-23 16:46:53 -04:00
Bert Belder
db5bbf6e43
Move 'create_param_allocations' from OwnedIsolate to IsolateAnnex (#365) 2020-04-23 20:15:39 +02:00
Bert Belder
cc626550b1
Explicitly drop slots when disposing an isolate (#364) 2020-04-23 19:48:07 +02:00
Bert Belder
ce54d39929
Clarify the purpose of the mutex in struct IsolateAnnex (#363) 2020-04-23 19:22:05 +02:00
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
d3a6c1403b
Fix race condition in v8::platform::Task tests (#355) 2020-04-20 19:19:00 +02:00
Bert Belder
3d0a90c1c8
Clippy (#354) 2020-04-16 15:35:27 +02:00
Bert Belder
b85346047e
Remove the 'Delete' trait, use regular 'Drop' instead (#353) 2020-04-16 05:24:07 +02:00
Bert Belder
256b6710d0
Remove transmutes from UniquePtr/UniqueRef implementation (#352) 2020-04-16 03:21:11 +02:00
Bert Belder
9ef9c5f871
Make all V8 heap object types subtypes of v8::Data (#351)
In v8.h, not all heap object classes actually derive from `v8::Data`,
but this seems to be a mistake, because this hierarchy does definitely
exists in V8's internal source code.
2020-04-15 23:56:59 +02:00
Bert Belder
16d6ca2398
Re-generate data.rs from the latest version of v8.h (#351) 2020-04-15 23:23:20 +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
Bert Belder
2b08fd1651
Format source code (#348) 2020-04-13 00:48:59 +02:00
FrankBlue
5a5bad9adf
add Map::size and Map::as_array (#333) 2020-04-02 13:37:13 -04:00
Ryan Dahl
fc948f4983
Merge all inspector bindings into one file (#331)
The file naming in the current src/inspector/ directory is inconsistent and difficult to
navigate. It will be simpler if we just put them all in one place since they're rather
interconnected.
2020-04-01 20:19:07 -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
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
Bert Belder
926f3a19da
Update generated types/traits, and generate more types (#300) 2020-03-05 17:42:55 -08:00
Ryan Dahl
d42099f9cc
Add comments to make_pod (#295)
Remove unused padding.
2020-02-28 17:48:59 -08:00
Bert Belder
5e99489c3b
Use make_pod to convert Global<T> to T* (#297) 2020-02-28 17:31:22 -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
3dacbd396e
Fix use-after-free bug in IsolateHandle::dispose_isolate() (#280)
This function acquires a mutex lock which, prior to this patch, would be
unlocked _after_ releasing the IsolateAnnex memory allocation where the
mutex was stored.
2020-02-13 02:56:19 -08: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
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
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
db33bc9aec Expose TaskBase and TaskImpl 2020-01-23 11:57:25 -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
7e27c88708
Remove TODO comment that's no longer relevant (#246) 2020-01-23 00:01:53 +01:00
Bert Belder
5e55cc5a5c
Add binding for Isolate::get_entered_or_microtask_context() (#245)
A test will be added later.
2020-01-22 23:36:52 +01: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