Skip to content

Commit d2675a1

Browse files
committed
update v8 and bump version
1 parent 259b493 commit d2675a1

File tree

6 files changed

+17
-20
lines changed

6 files changed

+17
-20
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CC=g++
2-
RELEASE=0.1.12
2+
RELEASE=0.1.13
33
INSTALL=/usr/local/bin
44
LIBS=lib/loop.js lib/path.js lib/fs.js lib/process.js lib/build.js lib/repl.js lib/acorn.js lib/configure.js
55
MODULES=modules/net/net.o modules/epoll/epoll.o modules/fs/fs.o modules/sys/sys.o modules/vm/vm.o

just.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,10 @@ v8::Local<v8::Value> execModule(v8::Local<v8::Module> mod,
252252
}
253253

254254
v8::MaybeLocal<v8::Promise> OnDynamicImport(v8::Local<v8::Context> context,
255-
v8::Local<v8::ScriptOrModule> referrer,
256-
v8::Local<v8::String> specifier,
257-
v8::Local<v8::FixedArray> import_assertions) {
255+
v8::Local<v8::Data> host_defined_options,
256+
v8::Local<v8::Value> resource_name,
257+
v8::Local<v8::String> specifier,
258+
v8::Local<v8::FixedArray> import_assertions) {
258259
v8::Local<v8::Promise::Resolver> resolver =
259260
v8::Promise::Resolver::New(context).ToLocalChecked();
260261
v8::MaybeLocal<v8::Promise> promise(resolver->GetPromise());

just.h

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <fcntl.h>
99
#include <sys/mman.h>
1010
#include <sys/utsname.h>
11-
#include <v8-fast-api-calls.h>
1211

1312
namespace just {
1413

just.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@
199199
const timerfd = just.sys.timer(repeat, timeout)
200200
loop.add(timerfd, (fd, event) => {
201201
callback()
202-
just.net.read(fd, buf, 0, buf.byteLength)
202+
just.fs.read(fd, buf, 0, buf.byteLength)
203203
if (repeat === 0) {
204204
loop.remove(fd)
205-
just.net.close(fd)
205+
just.fs.close(fd)
206206
}
207207
})
208208
return timerfd
@@ -214,7 +214,7 @@
214214

215215
function clearTimeout (fd, loop = just.factory.loop) {
216216
loop.remove(fd)
217-
just.net.close(fd)
217+
just.fs.close(fd)
218218
}
219219

220220
class SystemError extends Error {

lib/repl.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
const { net, sys, vm } = just
1+
const { fs, sys, vm } = just
22
const { EPOLLERR, EPOLLHUP } = just.loop
3-
const { errno } = just.sys
4-
const { EAGAIN } = just.net
3+
const { errno, EAGAIN, O_NONBLOCK } = just.sys
54

65
const stringify = (o, sp = ' ') => JSON.stringify(o, (k, v) => (typeof v === 'bigint') ? v.toString() : v, sp)
76

@@ -18,7 +17,7 @@ function writeString (fd, str) {
1817
let bytes = 0
1918
for (let i = 0, off = 0; i < chunks;) {
2019
const towrite = Math.min(len - off, 4096)
21-
bytes = net.write(fd, buf, towrite, off)
20+
bytes = fs.write(fd, buf, towrite, off)
2221
if (bytes === 0) {
2322
// closing
2423
break
@@ -45,22 +44,21 @@ function notEmpty (result) {
4544

4645
function repl (loop = just.factory.loop, buf = new ArrayBuffer(4096), stdin = sys.STDIN_FILENO, stdout = sys.STDOUT_FILENO) {
4746
const { EPOLLIN } = just.loop
48-
const { O_NONBLOCK, EAGAIN } = just.net
4947
sys.fcntl(stdin, sys.F_SETFL, (sys.fcntl(stdin, sys.F_GETFL, 0) | O_NONBLOCK))
5048
const current = []
5149
const context = {}
5250
let r = loop.add(stdin, async (fd, event) => {
5351
if (event & EPOLLERR || event & EPOLLHUP) {
54-
net.close(fd)
52+
fs.close(fd)
5553
return
5654
}
5755
if (event & EPOLLIN) {
58-
const bytes = net.read(fd, buf, 0, buf.byteLength)
56+
const bytes = fs.read(fd, buf, 0, buf.byteLength)
5957
if (bytes < 0) {
6058
const err = sys.errno()
6159
if (err !== EAGAIN) {
6260
just.print(`read error: ${sys.strerror(err)} (${err})`)
63-
net.close(fd)
61+
fs.close(fd)
6462
}
6563
return
6664
}
@@ -75,8 +73,8 @@ function repl (loop = just.factory.loop, buf = new ArrayBuffer(4096), stdin = sy
7573
if (command === '.exit') {
7674
loop.remove(stdin)
7775
loop.remove(stdout)
78-
net.close(stdin)
79-
net.close(stdout)
76+
fs.close(stdin)
77+
fs.close(stdout)
8078
return
8179
}
8280
let result

main.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ int main(int argc, char** argv) {
77
setvbuf(stderr, nullptr, _IONBF, 0);
88
std::unique_ptr<v8::Platform> platform = v8::platform::NewDefaultPlatform();
99
v8::V8::InitializePlatform(platform.get());
10-
v8::V8::Initialize();
1110
v8::V8::SetFlagsFromString(v8flags);
1211
if (_v8flags_from_commandline == 1) {
1312
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
1413
}
14+
v8::V8::Initialize();
1515
register_builtins();
1616
if (_use_index) {
1717
just::CreateIsolate(argc, argv, just_js, just_js_len,
@@ -21,7 +21,6 @@ int main(int argc, char** argv) {
2121
just::CreateIsolate(argc, argv, just_js, just_js_len, start);
2222
}
2323
v8::V8::Dispose();
24-
v8::V8::ShutdownPlatform();
2524
platform.reset();
2625
return 0;
2726
}

0 commit comments

Comments
 (0)