0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-27 01:29:19 -05:00
Commit graph

455 commits

Author SHA1 Message Date
Bert Belder
3b6ed67f5e
Rewrite the scope system from scratch (#406) 2020-06-26 01:42:00 +02:00
Bert Belder
8a4dc30445
Rename to_local() to cast_local(), use a closure (#406)
This makes it possible to add a run-time check that verifies that the
specified closure is actually the one that contains the local handle.
2020-06-19 20:18:07 +02:00
Bert Belder
6db41791ca
Remove unused 'v8::Locker' constructor/destructor bindings (#407) 2020-06-17 06:15:09 +02:00
Bert Belder
54f6bfe8c1
Reflow comments and strings that exceed the 80-char column limit (#407) 2020-06-17 06:15:08 +02:00
Bert Belder
74d806cbe3
Make error constructors in Exception less repetitive (#394) 2020-06-01 08:57:45 +02:00
Bert Belder
e4c260b8d2
Fix typo in signature of trait method 'Shared::from_unique_ptr()' (#393) 2020-06-01 08:44:10 +02:00
Bert Belder
771acbab02
Reflow comment and fix a typo in it (#391)
Closes: #374
2020-05-31 23:05:23 +02:00
Max Bruce
1937d30eba
Add bindings for 'Object::get_(own)_property_names()' (#337)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2020-05-31 23:04:01 +02:00
Bert Belder
a9ea69b5d5
Add more comments explaining why Local::from_raw() is appropriate (#389) 2020-05-31 19:39:08 +02:00
Bert Belder
405a874c36
Fix remaining Local::from_raw() misuse, and correct some lifetimes (#388) 2020-05-31 19:00:04 +02:00
Bert Belder
c114c46e15
Fix incorrect function signatures in module.rs (#388)
* `usize` and `int` are not equivalent or interchangeable at any level.
* Removed an unnecessary mutable borrow.
2020-05-31 19:00:01 +02:00
Bert Belder
8213c0e428
Remove incorrect uses of Local::from_raw() (#385) 2020-05-31 13:41:42 +02:00
Bert Belder
9540732a6a
Relax some Function/PropertyCallbackArguments lifetime constraints (#385) 2020-05-31 13:41:10 +02:00
Ryan Dahl
defb39b101
Make get_data and set_data private (#384) 2020-05-29 18:42:54 -04:00
Bert Belder
56c3d9f9c0
Use correct lifetime for TryCatch::exception()/message() return value (#380)
According to v8.h, "the returned handle is valid until this TryCatch
block has been destroyed". This is incorrect, as can be demonstrated
with the test below. In practice the return value lives no longer and
no shorter than the active HandleScope at the time these methods are
called. An issue has been opened about this in the V8 bug tracker:
https://bugs.chromium.org/p/v8/issues/detail?id=10537.

```rust
fn try_catch_bad_lifetimes() {
  let _setup_guard = setup();
  let mut isolate = v8::Isolate::new(Default::default());
  let mut hs = v8::HandleScope::new(&mut isolate);
  let scope = hs.enter();
  let context = v8::Context::new(scope);
  let mut cs = v8::ContextScope::new(scope, context);
  let scope = cs.enter();
  let caught_msg_2 = {
    let mut try_catch = v8::TryCatch::new(scope);
    let try_catch = try_catch.enter();
    let caught_msg_1 = {
      let mut hs = v8::HandleScope::new(scope);
      let scope = hs.enter();

      // Throw exception #1.
      let msg_1 = v8::String::new(scope, "BOOM!").unwrap();
      let exc_1 = v8::Exception::type_error(scope, msg_1);
      scope.isolate().throw_exception(exc_1);
      // Catch exception #1.
      let caught_msg_1 = try_catch.message().unwrap();
      let caught_str_1 =
        caught_msg_1.get(scope).to_rust_string_lossy(scope);
      assert!(caught_str_1.contains("BOOM"));
      // Move `caught_msg_1` out of the HandleScope it was created in.
      // The borrow checker allows this because `caught_msg_1`'s
      // lifetime is contrained to not outlive the TryCatch, but it is
      // allowed to outlive the HandleScope that was active when the
      // exception was caught.
      caught_msg_1
    };
    // Next line crashes.
    let caught_str_1 =
      caught_msg_1.get(scope).to_rust_string_lossy(scope);
    assert!(caught_str_1.contains("BOOM"));

    // Throws exception #2.
    let msg_2 = v8::String::new(scope, "DANG!").unwrap();
    let exc_2 = v8::Exception::type_error(scope, msg_2);
    scope.isolate().throw_exception(exc_2);
    // Catch exception #2.
    let caught_msg_2 = try_catch.message().unwrap();
    let caught_str_2 =
      caught_msg_2.get(scope).to_rust_string_lossy(scope);
    assert!(caught_str_2.contains("DANG"));
    // Move `caught_msg_2` out of the extent of the TryCatch, but still
    // within the extent of its HandleScope. This is unnecessarily
    // rejected at compile time.
    caught_msg_2
  };
  let caught_str_2 =
    caught_msg_2.get(scope).to_rust_string_lossy(scope);
  assert!(caught_str_2.contains("DANG"));
}
```
2020-05-24 21:37:22 +02:00
Bert Belder
6638b05096
Fix: SnapshotCreator's internal Isolate does not get initialized (#371) 2020-05-06 19:26:23 +02:00
Bert Belder
9ad0d35718
Upgrade V8 to 8.4.300 (#368) 2020-05-06 03:48:19 +02:00
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
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
Andy Finch
d302180ffa remove pub use support::int; #235 (#239) 2020-01-22 11:01:49 -05:00
Bert Belder
9124720c5a
8-bit StringView uses latin-1 encoding, not UTF-8 (#237) 2020-01-22 00:11:29 +01:00
Ben Noordhuis
4b8573a993 Implement fmt::Display for StringView (#236)
Make StringView objects inspectable to make it easier to debug the
V8 inspector's wire protocol.

StringBuffer objects can't be inspected yet because they need a mutable
reference if they want to call `StringBuffer::string()`, which makes
sense because that method calls out to a C++ virtual method that can
modify the object.

For now, instances can be inspected like this:

    let mut sb = StringBuffer::create(...);
    println!("StringBuffer({})", sb.string().unwrap());

Closes #233
2020-01-21 17:33:51 -05:00
Bert Belder
1a1bac3883
Make BackingStore APIs more consistent with C++ (#234) 2020-01-21 16:23:47 +01:00
Ryan Dahl
791cbc627a Add docs about scopes to lib.rs 2020-01-21 09:45:32 -05: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
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
2a7868daa9
Forgot to delete file (#224) 2020-01-18 15:31:39 +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
Ry Dahl
7a198e0c7e
Reduce nested symbols in API (#220)
- Don't expose empty mod array_buffer_view
- Move v8::platform::new_default_platform() to v8::new_default_platform()
- Move v8::platform::Task to v8::Task
- Move v8::platform::Platform to v8::Platform
2020-01-17 09:26:42 -05:00
Bartek Iwańczuk
bc927c7477 ArrayBuffer::new_backing_store_from_boxed_slice (#202) 2020-01-17 14:41:12 +01:00
Ben Noordhuis
52b8bbaf82 Fix Module::get_module_namespace() doc comment (#219) 2020-01-17 08:01:19 -05:00
Bert Belder
6925e78819
Do not export Isolate::enter() and Isolate::exit() methods (#217) 2020-01-17 08:57:27 +01:00
Bert Belder
fb19eecc31
Rename new_null() to null() and new_undefined() to undefined() (#216)
This is more consistent with V8's C++ API.
2020-01-17 08:34:48 +01:00
Bert Belder
d4cd5d2733
Move error constructors and helper functions under v8::Exception (#215)
* The purpose of this change is to match the C++ API more closely.
* This patch also increases consistency between the 'extern "C"'
  function definitions on the Rust side with those on the C++ side.
* The 'message' parameter (a v8::String) to the various error
  constructors no longer needs to be mutable.
2020-01-17 08:22:16 +01:00
Bert Belder
bed0088550
Make function signature of 'AccessorNameGetterCallback' match C++ (#214) 2020-01-17 07:39:05 +01:00
Bert Belder
7862af65e0
Make Function::call() more efficient and more idiomatic (#213) 2020-01-17 03:59:42 +01:00
Bert Belder
1a65b6cf6b
Format binding.cc (#213) 2020-01-17 03:56:04 +01:00
Bert Belder
b09df9b552
Fix bug in v8::create_message() argument lifetimes (#212) 2020-01-17 02:24:41 +01:00
Bartek Iwańczuk
f650abe44e stub out inspector APIs (#206) 2020-01-16 18:12:25 -05:00
Bert Belder
a230735902
Refactor scopes and callbacks so users don't need to transmute (#183) 2020-01-16 22:48:27 +01:00
Ry Dahl
03cab59c5c
Add Isolate::request_interrupt (#208) 2020-01-15 15:33:47 -05:00
Bert Belder
e6fb4d1a65
Reimplement Module::ResolveCallback ABI fix without global variables (#207) 2020-01-14 21:15:06 +01:00
Bert Belder
bf28a6b2e3
Remove rust-abi wrapper for v8::ResolveCallback (#204)
It will be back, but in a different form.
2020-01-13 06:58:26 +01:00
Ry Dahl
63673c3740
Remove unnecessary derive(Debug) (#195) 2020-01-06 14:57:15 -05:00
Bartek Iwańczuk
bddefbc2b2 Implicitly enter Isolate in v8::error (#191) 2020-01-05 18:07:50 +01:00
Bert Belder
db1c44c9be
Fix: Global::get() now actually creates a new Local handle (#187)
Closes: #182
2020-01-05 06:08:21 +01:00
Bartek Iwańczuk
2aaa62ae41 Add v8::Boolean::new() (#184) 2020-01-05 00:08:27 +01:00
Bert Belder
bd598fe8dc
Improve generated v8::Data type hierarchy and add tests (#180) 2020-01-04 03:27:43 +01:00
Bert Belder
e0b8f2d02c
Fix some issues with v8::StartupData (#178) 2020-01-04 01:26:27 +01:00
Bartek Iwańczuk
2d77996467 add v8::Module::get_module_namespace (#177) 2020-01-03 18:12:45 -05:00
Ry Dahl
19398816ab
SnapshotCreator changes for libdeno (#176) 2020-01-03 16:52:05 -05:00
Ry Dahl
a4f519c643
Add Value::{number_value, integer_value, uint32_value, int32_value}
#174
2020-01-03 12:17:11 -05:00
Ry Dahl
8adf85ea89
add to_uint32, to_int32, to_integer, to_detail_string, to_big_int (#173) 2020-01-03 11:14:50 -05:00
Bartek Iwańczuk
4ffbb7a00b InIsolate for PromiseRejectMessage (#172) 2020-01-03 08:49:43 -05:00
Bert Belder
64136e684e Add safe downcasts for Local<Value> with TryFrom (#166) (#166) 2020-01-03 08:41:16 -05:00
Bartek Iwańczuk
5c9effbeb1 add SharedArrayBuffer deprecated constructor (#171)
needed temporarily for porting deno
2020-01-03 08:40:39 -05:00
Bert Belder
e409030541 Create CallbackScope from Promise and PromiseRejectMessage (#168) 2020-01-02 16:22:33 -05:00
Ry Dahl
45b766c01f
happy new year (#170) 2020-01-02 13:57:00 -05:00
Bartek Iwańczuk
6c5f189063
add Object::get_identity_hash (#169) 2020-01-02 19:56:28 +01:00
Ry Dahl
65f12fbdc0
Add Object::set_accessor (#167) 2020-01-02 12:01:36 -05:00
Bartek Iwańczuk
7b139afbc4 add v8::Array::new() (#165) 2020-01-02 10:41:40 -05:00
Ry Dahl
53fd83a6fa
Add Isolate::RunMicrotasks and Isolate::EnqueueMicrotask (#164) 2020-01-02 10:15:31 -05:00
EnokMan
8d6ad51662 add all value checkers (#163) 2020-01-01 09:56:59 -05:00
Ry Dahl
e501f6d854
Add Value::{ToString, ToNumber, ToObject} (#162) 2019-12-31 15:17:52 -05:00
Ry Dahl
8f9aafe764
add impl_from and impl_deref macros for data.rs (#161) 2019-12-31 13:39:01 -05:00
Bert Belder
c205e73138
Generate Deref implementations for subtypes of v8::Data (#160) 2019-12-31 18:33:45 +01:00
Ry Dahl
1f610ba5a5
Add StackFrame (#159) 2019-12-31 11:17:26 -05:00
Ry Dahl
5467ca9295
Improve v8::Message (#158) 2019-12-31 09:40:34 -05:00
Bartek Iwańczuk
23a49d0fd1 add Isolate::get_current_context() (#155) 2019-12-31 14:07:42 +01:00
Kevin (Kun) "Kassimo" Qian
d31960342f isolate: add termination related methods (#157) 2019-12-31 06:11:43 -05:00
Bert Belder
24286a4d71
Add StartupData constructor (#156) 2019-12-31 02:43:27 +01:00
Bartek Iwańczuk
6ea175c065 add FunctionCallbackInfo.get_argument() (#150) 2019-12-30 16:48:23 -05:00
Bartek Iwańczuk
233160f926 add Send impl for SharedRef<BackingStore> (#154) 2019-12-30 16:48:08 -05:00
Ry Dahl
b7fa3341cb
Replace transmute in example with cast (#153) 2019-12-30 15:54:24 -05:00
Ry Dahl
38057132cc
get_module_requests_length should return usize (#151) 2019-12-30 15:11:50 -05:00
Bert Belder
9a72f62bd6
Add complete V8 type hierarchy (#148) 2019-12-30 19:06:45 +01:00
Ry Dahl
43b3438cb1
Simplify Object constructor (#149) 2019-12-30 12:14:06 -05:00
Andy Finch
00d592cd4d add v8::SharedArrayBuffer (#134) 2019-12-28 16:29:42 -05:00
Ryan Dahl
61c74ec0e7 clean up example in docs 2019-12-27 12:04:28 -05:00
Ry Dahl
6f953179ba
External references for snapshots (#141) 2019-12-27 09:12:16 -05:00
EnokMan
f2cc688439 add hello world example (#142) 2019-12-27 06:41:44 -05:00
Ry Dahl
29fa5388f5
Fix some docs (#140) 2019-12-26 21:14:59 -05:00
Ry Dahl
822b6e7025
Add Object::set (#138) 2019-12-26 14:38:16 -05:00
Bert Belder
76a480e6ff
Add ArrayBuffer::get_backing_store() and new_with_backing_store() (#135) 2019-12-26 18:06:43 +01:00
Ry Dahl
a2196a7248
Clean up internal slots (#137) 2019-12-26 11:53:06 -05:00
Ry Dahl
ce38f674f7
Support dynamic import (#136) 2019-12-26 10:45:55 -05:00
Andy Finch
6cdb55ed62 add v8::Uint8Array (#133) 2019-12-25 20:37:25 -05:00
Ry Dahl
877c22b075
Move new_default_allocator to root namespace (#132)
And add Isolate::set_data, Isolate::get_data, Isolate::get_number_of_data_slots
2019-12-25 10:56:27 -05:00
Ry Dahl
ce1f74221c
Fix StartupData memory leak (#131) 2019-12-25 08:14:55 -05:00
Bert Belder
934dd16e89
Clean up and remove AsRef/AsMut implementations (#130) 2019-12-25 12:40:14 +01:00
Bert Belder
ae4b48eb22
Get rid of HandleScope closure, add CallbackScope (#119) 2019-12-25 00:31:36 +01:00
Ry Dahl
57d13f7622
support for import.meta (#128) 2019-12-24 16:40:41 -05:00
Ry Dahl
d65c604f3a
Add Object::create_data_property, Object::get, Value::is_array, Value::is_object, Value::is_function (#129) 2019-12-24 16:10:40 -05:00
Ry Dahl
b00ef1ea3c
Move docs for global to struct (#127) 2019-12-24 09:44:44 -05:00
Bartek Iwańczuk
1507a897de first pass at snapshots (#122)
Creating a snapshot leaks memory. We will address this in future work.
2019-12-24 08:03:32 -05:00
Andy Finch
37a13ae18c add v8::ArrayBufferView (#101) 2019-12-24 05:50:30 -05:00
Ry Dahl
b97abb17b9
default options for v8::script_compiler::compile_module (#125)
And other clean ups
2019-12-23 20:23:55 -05:00
Ry Dahl
51737506dd
make InstantiateModule work (#124) 2019-12-23 18:09:03 -05:00
Ry Dahl
7cb6623488
Add Isolate::throw_exception (#123) 2019-12-23 08:16:01 -05:00
Ry Dahl
1d027f08c5
Add Value::strict_equals and Value::same_value (#121) 2019-12-23 07:32:45 -05:00
Ry Dahl
3ec3b07638
first pass implementation for v8::Module (#120)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2019-12-23 07:12:52 -05:00
Bert Belder
ac8aec9c8f
Invert the TryCatch/TryCatchScope relationship (#118) 2019-12-22 20:53:45 +01:00
Bartek Iwańczuk
25c4f7f4d0
add v8::EscapableHandleScope (#113) 2019-12-22 15:05:39 +01:00
Bert Belder
c107eb871f
Add global (a.k.a Persistent) handles (#112) 2019-12-22 01:30:22 +01:00
Ry Dahl
f36e74a648
First pass at BackingStore (#108) 2019-12-21 11:05:51 -05:00
Ry Dahl
153018b41b
Add ArrayBuffer, move ArrayBuffer::Allocator to root namespace (#106) 2019-12-21 08:50:59 -05:00
Ry Dahl
99baef0169
Add PrimitiveArray and ScriptOrModule (#105) 2019-12-21 06:38:26 -05:00
Bert Belder
196b5f60e4
Fix more mutability and lifetime issues (#103) 2019-12-21 06:11:12 +01:00
Bert Belder
fab24e032e
Make TryCatchScope public, improve doc strings (#102) 2019-12-21 06:11:06 +01:00
Bert Belder
6124554651
Remove 'type' param from v8::String::new() convenience function (#99) 2019-12-21 03:23:56 +01:00
Ry Dahl
32fc7e7bef
add v8::Module::instantiate_module (#98)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2019-12-20 20:54:14 -05:00
Bert Belder
f839aa221a
Add TryCatch (#97) 2019-12-21 02:12:11 +01:00
Bert Belder
331582561b
Add Local lifetimes back (#95) 2019-12-21 02:11:54 +01:00
Ry Dahl
bbfaacfe56
Add v8::ScriptCompiler::compile_module (#96) 2019-12-20 14:54:20 -05:00
Bartek Iwańczuk
85229bdd8a add v8::PropertyCallbackInfo (#68) 2019-12-20 18:16:44 +01:00
Ry Dahl
9e30db08ce
Remove 'using namespace v8' from binding.cc (#93) 2019-12-20 11:26:33 -05:00
Bartek Iwańczuk
beb9272f38 stub out v8::Module (#69) 2019-12-20 08:56:32 -05:00
Ry Dahl
e89a968ff2
add more docs and clean up exception, json modules (#92) 2019-12-20 08:47:20 -05:00
Ry Dahl
68742be011
Remove lifetimes from Local, HandleScope, Locker (#90)
add v8_str
2019-12-19 23:36:29 -05:00
Ry Dahl
b610e7cda9
Add v8::Isolate::add_message_listener (#89) 2019-12-19 21:34:07 -05:00
Ryan Dahl
887af28790 Remove LockedIsolate 2019-12-19 20:32:47 -05:00
Ryan Dahl
71140b4cc4 Change HandleScope::enter to take &Isolate, make v8::Locker into opaque blob 2019-12-19 20:32:47 -05:00
Ry Dahl
11ba352065
Rename CxxIsolate to Isolate and Isolate to OwnedIsolate (#85) 2019-12-19 19:15:52 -05:00
Bartek Iwańczuk
54a7c0ff33
add docs to various structs (#82) 2019-12-19 14:14:19 +01:00
Bartek Iwańczuk
cb0d2e3bec
add v8::PromiseRejectMessage (#65) 2019-12-19 14:13:33 +01:00
Ry Dahl
52b323e802
Add rustdoc for v8::Local (#81) 2019-12-19 07:34:12 -05:00
Bert Belder
1e86b84a3b
Assert that Option<Local<T>> is the same size as *const T (#79) 2019-12-19 00:43:55 +01:00
Ryan Dahl
24ca978b33 Add v8::Isolate::set_capture_stack_trace_for_uncaught_exceptions 2019-12-18 17:40:45 -05:00
Bert Belder
0a855e2a64
Move all support functions inside 'namespace support' (#76) 2019-12-18 18:14:28 +01:00
Bert Belder
150c27e4c8
Represent v8::Maybe<bool> in rust as Option<bool> (#73) 2019-12-18 18:02:46 +01:00
Bert Belder
ff843d6e18
Run clang-format (#72) 2019-12-18 14:37:33 +01:00
Ry Dahl
7acbb85398
Move all cc code to binding.cc (#70) 2019-12-18 07:37:13 -05:00
Ry Dahl
a2f9b6bc11
Add v8::ScriptOrigin (#46) 2019-12-18 05:46:36 -05:00
Bartek Iwańczuk
48f8a000cf add implementation for v8::ReturnValue (#67) 2019-12-17 19:19:40 +01:00
Bartek Iwańczuk
7b094328ea add v8::ReturnValue (#66) 2019-12-15 06:14:09 +08:00
Andy Finch
f37085c370 automatically convert from Local<T> to Local<Value> (#61) 2019-12-14 10:40:54 +08:00
Bartek Iwańczuk
a6caa5a42d add v8::Promise (#56) 2019-12-14 09:18:30 +08:00
Bartek Iwańczuk
2cfb80e174 Add v8::Function (#57) 2019-12-11 11:43:22 +08:00
Bartek Iwańczuk
b698e2fce3 add v8::Object (#55) 2019-12-10 08:14:07 +08:00
Bartek Iwańczuk
41e1f14ab5 add v8::JSON (#54) 2019-12-10 06:11:31 +08:00
Bartek Iwańczuk
e6e35a57e9 add v8::Exception (#50) 2019-12-09 02:26:58 +01:00
Ryan Dahl
774e34adf1 Deref String to Value 2019-12-09 07:30:20 +08:00
Ryan Dahl
7a233e277e Add Value::{is_undefined, is_null, is_null_or_undefined} 2019-12-06 10:43:22 -05:00
Ryan Dahl
f9a29cf56c Add primitive constructors null, undefined, true, false 2019-12-06 10:43:22 -05:00
Bartek Iwańczuk
91b8a70fd2 Add String::length method (#39) 2019-12-05 18:28:20 +01:00
Bert Belder
f106ab5b10
Running a minimal script (#32) 2019-12-04 19:02:21 +01:00
Ryan Dahl
d94117882a Move StringBuffer and StringView into inspector namespace 2019-12-04 10:51:46 -05:00
Ryan Dahl
3925b8122c Move v8::string::NewStringType to v8::NewStringType 2019-12-04 10:51:46 -05:00
Bert Belder
d91f0269fa
Basic Local<String> support (#27) 2019-12-04 08:17:13 +01:00
Ry Dahl
803ae45263
Simplify public API and move tests to tests/test_api.rs (#24) 2019-12-04 00:57:06 -05:00
Bert Belder
b4674c62b8
Basic support for Local<Number> and Local<Integer> (#23) 2019-12-04 01:50:26 +01:00
Ry Dahl
0e02971a35
First pass at test setup function (#22) 2019-12-01 09:19:22 -08:00
Ryan Dahl
517c213f1e minor clean ups 2019-11-30 09:34:41 -08:00
Ryan Dahl
0a256461e2 Rename src/v8.rs to src/V8.rs 2019-11-30 09:34:41 -08:00
Ryan Dahl
5866aedb30 make internal symbols private 2019-11-30 09:34:41 -08:00
Bert Belder
011b9f31a7 First pass at HandleScope (#18) 2019-11-27 07:14:39 -08:00
Bert Belder
0339c5f3b3
Create first isolate (#17) 2019-11-20 13:36:15 -08:00
Ry Dahl
3fa1cbcc5e
Refactor build / enable 'cargo package' (#15) 2019-11-19 17:48:50 -05:00
Bert Belder
7df96332ad
Add binding for ArrayBuffer::Allocator::NewDefaultAllocator (#13) 2019-11-18 15:03:12 -08:00
Bert Belder
37a656014b
Work towards creating first Isolate (#12) 2019-11-18 13:43:53 -08:00
Ry Dahl
643e1956a1
Rename mod v8 to V8 (#11) 2019-11-15 15:57:10 -05:00
Ry Dahl
05ce4006c0
bind v8::V8::Initialize and v8::V8::Dispose (#10) 2019-11-15 14:29:19 -05:00
Ry Dahl
3f6812ee60
bind v8::V8::GetVersion (#9) 2019-11-15 13:16:49 -05:00
Ry Dahl
c025a918c0
Add binding to v8::V8::SetFlagsFromCommandLine (#8) 2019-11-15 12:57:34 -05:00
Ry Dahl
0463a8bbfb
clean up (#4) 2019-11-01 13:50:12 -04:00
Ry Dahl
7846160a63
clean up (#3)
Use .cc instead of .cpp
2019-11-01 00:54:54 -04:00
Ryan Dahl
6bdbe7041a Fix v8_inspector__StringBuffer__string 2019-10-31 18:55:52 -04:00
Ryan Dahl
fd6f0785a2 First pass at build with cargo_gn 2019-10-31 18:38:14 -04:00
Bert Belder
ca9193fcd7
Remove junk 2019-10-23 00:45:37 -07:00
Bert Belder
0fdeed7c67
wip 2019-10-22 23:14:05 -07:00
Bert Belder
edebd3b10d
WIP 2019-10-22 22:58:11 -07:00
Bert Belder
5b9b9bcea1
idiomacy: 2019-10-22 20:26:13 -07:00
Bert Belder
96e202505f
wip 2019-10-22 20:10:40 -07:00
Bert Belder
6fa76841ce
WIP 2019-10-22 18:59:34 -07:00
Bert Belder
5b927b82af
wip 2019-10-22 15:46:42 -07:00
Bert Belder
c7eb95df04
Remove debug stuff 2019-10-22 15:31:00 -07:00
Bert Belder
9a6e90be38
Add Task 2019-10-22 14:52:43 -07:00
Bert Belder
c3f0fbbeb4
wip 2019-10-21 20:54:21 -07:00
Bert Belder
6a24523334
wip 2019-10-20 16:48:12 -07:00
Bert Belder
0e86101ed9
wip 2019-10-20 16:10:40 -07:00
Bert Belder
1e3f137cc2
wip 2019-10-20 14:22:18 -07:00
Bert Belder
7b8e882546
Client binding + clean-ups 2019-10-19 17:15:23 -07:00
Bert Belder
a291feb5f1
ugly, but works 2019-10-18 16:59:38 -07:00
Bert Belder
8d2d3697f8
Add depot_tools and v8 2019-10-18 16:52:12 -07:00
Bert Belder
5bca90b074
wip 2019-10-17 18:01:55 -07:00
Bert Belder
1764355b5c
wip 2019-10-17 17:58:31 -07:00
Bert Belder
8d97e79d46
wip 2019-10-17 16:46:54 -07:00
Bert Belder
c4a7c969ba
wip 2019-10-16 15:47:34 -07:00
Bert Belder
f9d0a6ba77
works 2019-10-15 18:31:05 -07:00
Bert Belder
f6bc61ec11
x 2019-10-15 13:10:52 -07:00
Bert Belder
1b7422f6cb
yes 2019-10-08 02:51:48 +02:00
Bert Belder
20f5884b50
update 2019-10-08 02:50:18 +02:00
Bert Belder
12a439e55d
clean up 2019-10-08 02:40:03 +02:00