-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10c7f6b
commit 81ce6c0
Showing
7 changed files
with
66 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
members = [ | ||
"cli", | ||
"core", | ||
"op_hello_js", | ||
"tools/hyper_hello", | ||
"deno_typescript", | ||
"js", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/// To run this benchmark: | ||
/// | ||
/// > DENO_BUILD_MODE=release ./tools/build.py && \ | ||
/// ./target/release/deno_core_http_bench --multi-thread | ||
extern crate deno; | ||
extern crate futures; | ||
extern crate tokio; | ||
|
||
use deno::*; | ||
use futures::future::lazy; | ||
use tokio::prelude::*; | ||
|
||
|
||
fn main() { | ||
let main_future = lazy(move || { | ||
// TODO currently isolate.execute() must be run inside tokio, hence the | ||
// lazy(). It would be nice to not have that contraint. Probably requires | ||
// using v8::MicrotasksPolicy::kExplicit | ||
|
||
let js_source = include_str!("hello.js"); | ||
|
||
let mut isolate = deno::Isolate::new(StartupData::None, false); | ||
let r = op_hello_js::init(&mut isolate); | ||
eprintln!("result r {:?}", r); | ||
let r = isolate.execute("hello.js", js_source); | ||
eprintln!("result r {:?}", r); | ||
|
||
isolate.then(|r| { | ||
js_check(r); | ||
Ok(()) | ||
}) | ||
}); | ||
|
||
tokio::runtime::current_thread::run(main_future); | ||
} | ||
|
||
fn js_check(r: Result<(), ErrBox>) { | ||
if let Err(e) = r { | ||
panic!(e.to_string()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// TODO In the future maybe we can extract the op id in the top-level and use a | ||
// constant. But currently it's causing problems with snapshotting. | ||
|
||
export function hello() { | ||
Deno.core.send(Deno.ops["hello"]); | ||
function hello() { | ||
Deno.core.send(Deno.core.ops()["hello"]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters