mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 21:50:00 -05:00
Fix protobufjs snapshotting.
This commit is contained in:
parent
dd48f8095c
commit
7784cc2c15
12 changed files with 1786 additions and 2125 deletions
|
@ -98,7 +98,7 @@ run_node("bundle") {
|
||||||
run_node("run_tsc") {
|
run_node("run_tsc") {
|
||||||
main_source = "js/main.ts"
|
main_source = "js/main.ts"
|
||||||
sources = [
|
sources = [
|
||||||
"js/msg.pb.d.ts",
|
#"js/msg.pb.d.ts",
|
||||||
"js/msg.pb.js",
|
"js/msg.pb.js",
|
||||||
"js/tsconfig.json",
|
"js/tsconfig.json",
|
||||||
main_source,
|
main_source,
|
||||||
|
@ -178,6 +178,9 @@ template("create_snapshot") {
|
||||||
rebase_path(natives_out_cc, root_build_dir),
|
rebase_path(natives_out_cc, root_build_dir),
|
||||||
rebase_path(snapshot_out_cc, root_build_dir),
|
rebase_path(snapshot_out_cc, root_build_dir),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# To debug snapshotting problems:
|
||||||
|
# args += ["--trace-serializer"]
|
||||||
data = [
|
data = [
|
||||||
invoker.js,
|
invoker.js,
|
||||||
]
|
]
|
||||||
|
|
|
@ -199,6 +199,19 @@ bool Execute(v8::Local<v8::Context> context, const char* js_filename,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v8::StartupData SerializeInternalFields(v8::Local<v8::Object> holder, int index,
|
||||||
|
void* data) {
|
||||||
|
assert(data == nullptr); // TODO(ry) pass Deno* object here.
|
||||||
|
InternalFieldData* embedder_field = static_cast<InternalFieldData*>(
|
||||||
|
holder->GetAlignedPointerFromInternalField(index));
|
||||||
|
if (embedder_field == nullptr) return {nullptr, 0};
|
||||||
|
int size = sizeof(*embedder_field);
|
||||||
|
char* payload = new char[size];
|
||||||
|
// We simply use memcpy to serialize the content.
|
||||||
|
memcpy(payload, embedder_field, size);
|
||||||
|
return {payload, size};
|
||||||
|
}
|
||||||
|
|
||||||
v8::StartupData MakeSnapshot(v8::StartupData* prev_natives_blob,
|
v8::StartupData MakeSnapshot(v8::StartupData* prev_natives_blob,
|
||||||
v8::StartupData* prev_snapshot_blob,
|
v8::StartupData* prev_snapshot_blob,
|
||||||
const char* js_filename, const char* js_source) {
|
const char* js_filename, const char* js_source) {
|
||||||
|
@ -232,7 +245,8 @@ v8::StartupData MakeSnapshot(v8::StartupData* prev_natives_blob,
|
||||||
bool r = Execute(context, js_filename, js_source);
|
bool r = Execute(context, js_filename, js_source);
|
||||||
assert(r);
|
assert(r);
|
||||||
|
|
||||||
creator->SetDefaultContext(context);
|
creator->SetDefaultContext(context, v8::SerializeInternalFieldsCallback(
|
||||||
|
SerializeInternalFields, nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto snapshot_blob =
|
auto snapshot_blob =
|
||||||
|
|
|
@ -21,6 +21,10 @@ struct deno_s {
|
||||||
|
|
||||||
namespace deno {
|
namespace deno {
|
||||||
|
|
||||||
|
struct InternalFieldData {
|
||||||
|
uint32_t data;
|
||||||
|
};
|
||||||
|
|
||||||
void Print(const v8::FunctionCallbackInfo<v8::Value>& args);
|
void Print(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||||
void Sub(const v8::FunctionCallbackInfo<v8::Value>& args);
|
void Sub(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||||
void Pub(const v8::FunctionCallbackInfo<v8::Value>& args);
|
void Pub(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||||
|
|
|
@ -21,12 +21,28 @@ namespace deno {
|
||||||
#include "snapshot_deno.cc"
|
#include "snapshot_deno.cc"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
std::vector<InternalFieldData*> deserialized_data;
|
||||||
|
|
||||||
|
void DeserializeInternalFields(v8::Local<v8::Object> holder, int index,
|
||||||
|
v8::StartupData payload, void* data) {
|
||||||
|
assert(data == nullptr); // TODO(ry) pass Deno* object here.
|
||||||
|
if (payload.raw_size == 0) {
|
||||||
|
holder->SetAlignedPointerInInternalField(index, nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
InternalFieldData* embedder_field = new InternalFieldData{0};
|
||||||
|
memcpy(embedder_field, payload.data, payload.raw_size);
|
||||||
|
holder->SetAlignedPointerInInternalField(index, embedder_field);
|
||||||
|
deserialized_data.push_back(embedder_field);
|
||||||
|
}
|
||||||
|
|
||||||
Deno* NewFromSnapshot(void* data, deno_sub_cb cb) {
|
Deno* NewFromSnapshot(void* data, deno_sub_cb cb) {
|
||||||
auto natives_blob = *StartupBlob_natives();
|
auto natives_blob = *StartupBlob_natives();
|
||||||
auto snapshot_blob = *StartupBlob_snapshot();
|
auto snapshot_blob = *StartupBlob_snapshot();
|
||||||
|
|
||||||
v8::V8::SetNativesDataBlob(&natives_blob);
|
v8::V8::SetNativesDataBlob(&natives_blob);
|
||||||
v8::V8::SetSnapshotDataBlob(&snapshot_blob);
|
v8::V8::SetSnapshotDataBlob(&snapshot_blob);
|
||||||
|
v8::DeserializeInternalFieldsCallback(DeserializeInternalFields, nullptr);
|
||||||
|
|
||||||
Deno* d = new Deno;
|
Deno* d = new Deno;
|
||||||
d->cb = cb;
|
d->cb = cb;
|
||||||
|
@ -42,7 +58,11 @@ Deno* NewFromSnapshot(void* data, deno_sub_cb cb) {
|
||||||
v8::Isolate::Scope isolate_scope(isolate);
|
v8::Isolate::Scope isolate_scope(isolate);
|
||||||
{
|
{
|
||||||
v8::HandleScope handle_scope(isolate);
|
v8::HandleScope handle_scope(isolate);
|
||||||
auto context = v8::Context::New(isolate);
|
auto context =
|
||||||
|
v8::Context::New(isolate, nullptr, v8::MaybeLocal<v8::ObjectTemplate>(),
|
||||||
|
v8::MaybeLocal<v8::Value>(),
|
||||||
|
v8::DeserializeInternalFieldsCallback(
|
||||||
|
DeserializeInternalFields, nullptr));
|
||||||
d->context.Reset(d->isolate, context);
|
d->context.Reset(d->isolate, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
/// <reference path="deno.d.ts" />
|
/// <reference path="deno.d.ts" />
|
||||||
//import { main as pb } from "./msg.pb"
|
import { main as pb } from "./msg.pb";
|
||||||
import * as ts from "typescript";
|
import * as ts from "typescript";
|
||||||
|
|
||||||
const globalEval = eval;
|
const globalEval = eval;
|
||||||
const window = globalEval("this");
|
const window = globalEval("this");
|
||||||
window["denoMain"] = () => {
|
window["denoMain"] = () => {
|
||||||
//const msg = pb.Msg.fromObject({});
|
denoPrint("Hello world");
|
||||||
//denoPrint(`msg.command: ${msg.command}`);
|
const msg = pb.Msg.fromObject({});
|
||||||
|
denoPrint(`msg.command: ${msg.command}`);
|
||||||
denoPrint(`ts.version: ${ts.version}`);
|
denoPrint(`ts.version: ${ts.version}`);
|
||||||
denoPrint("Hello world from foo");
|
denoPrint("Hello world from foo");
|
||||||
return "foo";
|
return "foo";
|
||||||
|
|
|
@ -15,6 +15,17 @@ function CanCallFunction() {
|
||||||
return "foo";
|
return "foo";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This object is created to test snapshotting.
|
||||||
|
// See DeserializeInternalFieldsCallback and SerializeInternalFieldsCallback.
|
||||||
|
const snapshotted = new Uint8Array([1, 3, 3, 7]);
|
||||||
|
|
||||||
|
function TypedArraySnapshots() {
|
||||||
|
assert(snapshotted[0] === 1);
|
||||||
|
assert(snapshotted[1] === 3);
|
||||||
|
assert(snapshotted[2] === 3);
|
||||||
|
assert(snapshotted[3] === 7);
|
||||||
|
}
|
||||||
|
|
||||||
function PubSuccess() {
|
function PubSuccess() {
|
||||||
denoSub((channel, msg) => {
|
denoSub((channel, msg) => {
|
||||||
assert(channel === "PubSuccess");
|
assert(channel === "PubSuccess");
|
||||||
|
|
824
deno2/js/msg.pb.d.ts
vendored
824
deno2/js/msg.pb.d.ts
vendored
|
@ -2,431 +2,409 @@ import * as $protobuf from "protobufjs";
|
||||||
|
|
||||||
/** Namespace main. */
|
/** Namespace main. */
|
||||||
export namespace main {
|
export namespace main {
|
||||||
/** Properties of a BaseMsg. */
|
|
||||||
interface IBaseMsg {
|
|
||||||
/** BaseMsg channel */
|
|
||||||
channel?: string | null;
|
|
||||||
|
|
||||||
/** BaseMsg payload */
|
/** Properties of a BaseMsg. */
|
||||||
payload?: Uint8Array | null;
|
interface IBaseMsg {
|
||||||
}
|
|
||||||
|
|
||||||
/** Represents a BaseMsg. */
|
/** BaseMsg channel */
|
||||||
class BaseMsg implements IBaseMsg {
|
channel?: (string|null);
|
||||||
/**
|
|
||||||
* Constructs a new BaseMsg.
|
|
||||||
* @param [properties] Properties to set
|
|
||||||
*/
|
|
||||||
constructor(properties?: main.IBaseMsg);
|
|
||||||
|
|
||||||
/** BaseMsg channel. */
|
/** BaseMsg payload */
|
||||||
public channel: string;
|
payload?: (Uint8Array|null);
|
||||||
|
}
|
||||||
/** BaseMsg payload. */
|
|
||||||
public payload: Uint8Array;
|
/** Represents a BaseMsg. */
|
||||||
|
class BaseMsg implements IBaseMsg {
|
||||||
/**
|
|
||||||
* Creates a new BaseMsg instance using the specified properties.
|
/**
|
||||||
* @param [properties] Properties to set
|
* Constructs a new BaseMsg.
|
||||||
* @returns BaseMsg instance
|
* @param [properties] Properties to set
|
||||||
*/
|
*/
|
||||||
public static create(properties?: main.IBaseMsg): main.BaseMsg;
|
constructor(properties?: main.IBaseMsg);
|
||||||
|
|
||||||
/**
|
/** BaseMsg channel. */
|
||||||
* Encodes the specified BaseMsg message. Does not implicitly {@link main.BaseMsg.verify|verify} messages.
|
public channel: string;
|
||||||
* @param message BaseMsg message or plain object to encode
|
|
||||||
* @param [writer] Writer to encode to
|
/** BaseMsg payload. */
|
||||||
* @returns Writer
|
public payload: Uint8Array;
|
||||||
*/
|
|
||||||
public static encode(
|
/**
|
||||||
message: main.IBaseMsg,
|
* Creates a new BaseMsg instance using the specified properties.
|
||||||
writer?: $protobuf.Writer
|
* @param [properties] Properties to set
|
||||||
): $protobuf.Writer;
|
* @returns BaseMsg instance
|
||||||
|
*/
|
||||||
/**
|
public static create(properties?: main.IBaseMsg): main.BaseMsg;
|
||||||
* Encodes the specified BaseMsg message, length delimited. Does not implicitly {@link main.BaseMsg.verify|verify} messages.
|
|
||||||
* @param message BaseMsg message or plain object to encode
|
/**
|
||||||
* @param [writer] Writer to encode to
|
* Encodes the specified BaseMsg message. Does not implicitly {@link main.BaseMsg.verify|verify} messages.
|
||||||
* @returns Writer
|
* @param message BaseMsg message or plain object to encode
|
||||||
*/
|
* @param [writer] Writer to encode to
|
||||||
public static encodeDelimited(
|
* @returns Writer
|
||||||
message: main.IBaseMsg,
|
*/
|
||||||
writer?: $protobuf.Writer
|
public static encode(message: main.IBaseMsg, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||||
): $protobuf.Writer;
|
|
||||||
|
/**
|
||||||
/**
|
* Encodes the specified BaseMsg message, length delimited. Does not implicitly {@link main.BaseMsg.verify|verify} messages.
|
||||||
* Decodes a BaseMsg message from the specified reader or buffer.
|
* @param message BaseMsg message or plain object to encode
|
||||||
* @param reader Reader or buffer to decode from
|
* @param [writer] Writer to encode to
|
||||||
* @param [length] Message length if known beforehand
|
* @returns Writer
|
||||||
* @returns BaseMsg
|
*/
|
||||||
* @throws {Error} If the payload is not a reader or valid buffer
|
public static encodeDelimited(message: main.IBaseMsg, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
||||||
*/
|
/**
|
||||||
public static decode(
|
* Decodes a BaseMsg message from the specified reader or buffer.
|
||||||
reader: $protobuf.Reader | Uint8Array,
|
* @param reader Reader or buffer to decode from
|
||||||
length?: number
|
* @param [length] Message length if known beforehand
|
||||||
): main.BaseMsg;
|
* @returns BaseMsg
|
||||||
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||||||
/**
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||||
* Decodes a BaseMsg message from the specified reader or buffer, length delimited.
|
*/
|
||||||
* @param reader Reader or buffer to decode from
|
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): main.BaseMsg;
|
||||||
* @returns BaseMsg
|
|
||||||
* @throws {Error} If the payload is not a reader or valid buffer
|
/**
|
||||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
* Decodes a BaseMsg message from the specified reader or buffer, length delimited.
|
||||||
*/
|
* @param reader Reader or buffer to decode from
|
||||||
public static decodeDelimited(
|
* @returns BaseMsg
|
||||||
reader: $protobuf.Reader | Uint8Array
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||||||
): main.BaseMsg;
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||||
|
*/
|
||||||
/**
|
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): main.BaseMsg;
|
||||||
* Verifies a BaseMsg message.
|
|
||||||
* @param message Plain object to verify
|
/**
|
||||||
* @returns `null` if valid, otherwise the reason why it is not
|
* Verifies a BaseMsg message.
|
||||||
*/
|
* @param message Plain object to verify
|
||||||
public static verify(message: { [k: string]: any }): string | null;
|
* @returns `null` if valid, otherwise the reason why it is not
|
||||||
|
*/
|
||||||
/**
|
public static verify(message: { [k: string]: any }): (string|null);
|
||||||
* Creates a BaseMsg message from a plain object. Also converts values to their respective internal types.
|
|
||||||
* @param object Plain object
|
/**
|
||||||
* @returns BaseMsg
|
* Creates a BaseMsg message from a plain object. Also converts values to their respective internal types.
|
||||||
*/
|
* @param object Plain object
|
||||||
public static fromObject(object: { [k: string]: any }): main.BaseMsg;
|
* @returns BaseMsg
|
||||||
|
*/
|
||||||
/**
|
public static fromObject(object: { [k: string]: any }): main.BaseMsg;
|
||||||
* Creates a plain object from a BaseMsg message. Also converts values to other types if specified.
|
|
||||||
* @param message BaseMsg
|
/**
|
||||||
* @param [options] Conversion options
|
* Creates a plain object from a BaseMsg message. Also converts values to other types if specified.
|
||||||
* @returns Plain object
|
* @param message BaseMsg
|
||||||
*/
|
* @param [options] Conversion options
|
||||||
public static toObject(
|
* @returns Plain object
|
||||||
message: main.BaseMsg,
|
*/
|
||||||
options?: $protobuf.IConversionOptions
|
public static toObject(message: main.BaseMsg, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||||
): { [k: string]: any };
|
|
||||||
|
/**
|
||||||
/**
|
* Converts this BaseMsg to JSON.
|
||||||
* Converts this BaseMsg to JSON.
|
* @returns JSON object
|
||||||
* @returns JSON object
|
*/
|
||||||
*/
|
public toJSON(): { [k: string]: any };
|
||||||
public toJSON(): { [k: string]: any };
|
}
|
||||||
}
|
|
||||||
|
/** Properties of a Msg. */
|
||||||
/** Properties of a Msg. */
|
interface IMsg {
|
||||||
interface IMsg {
|
|
||||||
/** Msg command */
|
/** Msg command */
|
||||||
command?: main.Msg.Command | null;
|
command?: (main.Msg.Command|null);
|
||||||
|
|
||||||
/** Msg error */
|
/** Msg error */
|
||||||
error?: string | null;
|
error?: (string|null);
|
||||||
|
|
||||||
/** Msg startCwd */
|
/** Msg startCwd */
|
||||||
startCwd?: string | null;
|
startCwd?: (string|null);
|
||||||
|
|
||||||
/** Msg startArgv */
|
/** Msg startArgv */
|
||||||
startArgv?: string[] | null;
|
startArgv?: (string[]|null);
|
||||||
|
|
||||||
/** Msg startDebugFlag */
|
/** Msg startDebugFlag */
|
||||||
startDebugFlag?: boolean | null;
|
startDebugFlag?: (boolean|null);
|
||||||
|
|
||||||
/** Msg startMainJs */
|
/** Msg startMainJs */
|
||||||
startMainJs?: string | null;
|
startMainJs?: (string|null);
|
||||||
|
|
||||||
/** Msg startMainMap */
|
/** Msg startMainMap */
|
||||||
startMainMap?: string | null;
|
startMainMap?: (string|null);
|
||||||
|
|
||||||
/** Msg codeFetchModuleSpecifier */
|
/** Msg codeFetchModuleSpecifier */
|
||||||
codeFetchModuleSpecifier?: string | null;
|
codeFetchModuleSpecifier?: (string|null);
|
||||||
|
|
||||||
/** Msg codeFetchContainingFile */
|
/** Msg codeFetchContainingFile */
|
||||||
codeFetchContainingFile?: string | null;
|
codeFetchContainingFile?: (string|null);
|
||||||
|
|
||||||
/** Msg codeFetchResModuleName */
|
/** Msg codeFetchResModuleName */
|
||||||
codeFetchResModuleName?: string | null;
|
codeFetchResModuleName?: (string|null);
|
||||||
|
|
||||||
/** Msg codeFetchResFilename */
|
/** Msg codeFetchResFilename */
|
||||||
codeFetchResFilename?: string | null;
|
codeFetchResFilename?: (string|null);
|
||||||
|
|
||||||
/** Msg codeFetchResSourceCode */
|
/** Msg codeFetchResSourceCode */
|
||||||
codeFetchResSourceCode?: string | null;
|
codeFetchResSourceCode?: (string|null);
|
||||||
|
|
||||||
/** Msg codeFetchResOutputCode */
|
/** Msg codeFetchResOutputCode */
|
||||||
codeFetchResOutputCode?: string | null;
|
codeFetchResOutputCode?: (string|null);
|
||||||
|
|
||||||
/** Msg codeCacheFilename */
|
/** Msg codeCacheFilename */
|
||||||
codeCacheFilename?: string | null;
|
codeCacheFilename?: (string|null);
|
||||||
|
|
||||||
/** Msg codeCacheSourceCode */
|
/** Msg codeCacheSourceCode */
|
||||||
codeCacheSourceCode?: string | null;
|
codeCacheSourceCode?: (string|null);
|
||||||
|
|
||||||
/** Msg codeCacheOutputCode */
|
/** Msg codeCacheOutputCode */
|
||||||
codeCacheOutputCode?: string | null;
|
codeCacheOutputCode?: (string|null);
|
||||||
|
|
||||||
/** Msg exitCode */
|
/** Msg exitCode */
|
||||||
exitCode?: number | null;
|
exitCode?: (number|null);
|
||||||
|
|
||||||
/** Msg timerStartId */
|
/** Msg timerStartId */
|
||||||
timerStartId?: number | null;
|
timerStartId?: (number|null);
|
||||||
|
|
||||||
/** Msg timerStartInterval */
|
/** Msg timerStartInterval */
|
||||||
timerStartInterval?: boolean | null;
|
timerStartInterval?: (boolean|null);
|
||||||
|
|
||||||
/** Msg timerStartDelay */
|
/** Msg timerStartDelay */
|
||||||
timerStartDelay?: number | null;
|
timerStartDelay?: (number|null);
|
||||||
|
|
||||||
/** Msg timerReadyId */
|
/** Msg timerReadyId */
|
||||||
timerReadyId?: number | null;
|
timerReadyId?: (number|null);
|
||||||
|
|
||||||
/** Msg timerReadyDone */
|
/** Msg timerReadyDone */
|
||||||
timerReadyDone?: boolean | null;
|
timerReadyDone?: (boolean|null);
|
||||||
|
|
||||||
/** Msg timerClearId */
|
/** Msg timerClearId */
|
||||||
timerClearId?: number | null;
|
timerClearId?: (number|null);
|
||||||
|
|
||||||
/** Msg fetchReqId */
|
/** Msg fetchReqId */
|
||||||
fetchReqId?: number | null;
|
fetchReqId?: (number|null);
|
||||||
|
|
||||||
/** Msg fetchReqUrl */
|
/** Msg fetchReqUrl */
|
||||||
fetchReqUrl?: string | null;
|
fetchReqUrl?: (string|null);
|
||||||
|
|
||||||
/** Msg fetchResId */
|
/** Msg fetchResId */
|
||||||
fetchResId?: number | null;
|
fetchResId?: (number|null);
|
||||||
|
|
||||||
/** Msg fetchResStatus */
|
/** Msg fetchResStatus */
|
||||||
fetchResStatus?: number | null;
|
fetchResStatus?: (number|null);
|
||||||
|
|
||||||
/** Msg fetchResHeaderLine */
|
/** Msg fetchResHeaderLine */
|
||||||
fetchResHeaderLine?: string[] | null;
|
fetchResHeaderLine?: (string[]|null);
|
||||||
|
|
||||||
/** Msg fetchResBody */
|
/** Msg fetchResBody */
|
||||||
fetchResBody?: Uint8Array | null;
|
fetchResBody?: (Uint8Array|null);
|
||||||
|
|
||||||
/** Msg readFileSyncFilename */
|
/** Msg readFileSyncFilename */
|
||||||
readFileSyncFilename?: string | null;
|
readFileSyncFilename?: (string|null);
|
||||||
|
|
||||||
/** Msg readFileSyncData */
|
/** Msg readFileSyncData */
|
||||||
readFileSyncData?: Uint8Array | null;
|
readFileSyncData?: (Uint8Array|null);
|
||||||
|
|
||||||
/** Msg writeFileSyncFilename */
|
/** Msg writeFileSyncFilename */
|
||||||
writeFileSyncFilename?: string | null;
|
writeFileSyncFilename?: (string|null);
|
||||||
|
|
||||||
/** Msg writeFileSyncData */
|
/** Msg writeFileSyncData */
|
||||||
writeFileSyncData?: Uint8Array | null;
|
writeFileSyncData?: (Uint8Array|null);
|
||||||
|
|
||||||
/** Msg writeFileSyncPerm */
|
/** Msg writeFileSyncPerm */
|
||||||
writeFileSyncPerm?: number | null;
|
writeFileSyncPerm?: (number|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Represents a Msg. */
|
/** Represents a Msg. */
|
||||||
class Msg implements IMsg {
|
class Msg implements IMsg {
|
||||||
/**
|
|
||||||
* Constructs a new Msg.
|
/**
|
||||||
* @param [properties] Properties to set
|
* Constructs a new Msg.
|
||||||
*/
|
* @param [properties] Properties to set
|
||||||
constructor(properties?: main.IMsg);
|
*/
|
||||||
|
constructor(properties?: main.IMsg);
|
||||||
/** Msg command. */
|
|
||||||
public command: main.Msg.Command;
|
/** Msg command. */
|
||||||
|
public command: main.Msg.Command;
|
||||||
/** Msg error. */
|
|
||||||
public error: string;
|
/** Msg error. */
|
||||||
|
public error: string;
|
||||||
/** Msg startCwd. */
|
|
||||||
public startCwd: string;
|
/** Msg startCwd. */
|
||||||
|
public startCwd: string;
|
||||||
/** Msg startArgv. */
|
|
||||||
public startArgv: string[];
|
/** Msg startArgv. */
|
||||||
|
public startArgv: string[];
|
||||||
/** Msg startDebugFlag. */
|
|
||||||
public startDebugFlag: boolean;
|
/** Msg startDebugFlag. */
|
||||||
|
public startDebugFlag: boolean;
|
||||||
/** Msg startMainJs. */
|
|
||||||
public startMainJs: string;
|
/** Msg startMainJs. */
|
||||||
|
public startMainJs: string;
|
||||||
/** Msg startMainMap. */
|
|
||||||
public startMainMap: string;
|
/** Msg startMainMap. */
|
||||||
|
public startMainMap: string;
|
||||||
/** Msg codeFetchModuleSpecifier. */
|
|
||||||
public codeFetchModuleSpecifier: string;
|
/** Msg codeFetchModuleSpecifier. */
|
||||||
|
public codeFetchModuleSpecifier: string;
|
||||||
/** Msg codeFetchContainingFile. */
|
|
||||||
public codeFetchContainingFile: string;
|
/** Msg codeFetchContainingFile. */
|
||||||
|
public codeFetchContainingFile: string;
|
||||||
/** Msg codeFetchResModuleName. */
|
|
||||||
public codeFetchResModuleName: string;
|
/** Msg codeFetchResModuleName. */
|
||||||
|
public codeFetchResModuleName: string;
|
||||||
/** Msg codeFetchResFilename. */
|
|
||||||
public codeFetchResFilename: string;
|
/** Msg codeFetchResFilename. */
|
||||||
|
public codeFetchResFilename: string;
|
||||||
/** Msg codeFetchResSourceCode. */
|
|
||||||
public codeFetchResSourceCode: string;
|
/** Msg codeFetchResSourceCode. */
|
||||||
|
public codeFetchResSourceCode: string;
|
||||||
/** Msg codeFetchResOutputCode. */
|
|
||||||
public codeFetchResOutputCode: string;
|
/** Msg codeFetchResOutputCode. */
|
||||||
|
public codeFetchResOutputCode: string;
|
||||||
/** Msg codeCacheFilename. */
|
|
||||||
public codeCacheFilename: string;
|
/** Msg codeCacheFilename. */
|
||||||
|
public codeCacheFilename: string;
|
||||||
/** Msg codeCacheSourceCode. */
|
|
||||||
public codeCacheSourceCode: string;
|
/** Msg codeCacheSourceCode. */
|
||||||
|
public codeCacheSourceCode: string;
|
||||||
/** Msg codeCacheOutputCode. */
|
|
||||||
public codeCacheOutputCode: string;
|
/** Msg codeCacheOutputCode. */
|
||||||
|
public codeCacheOutputCode: string;
|
||||||
/** Msg exitCode. */
|
|
||||||
public exitCode: number;
|
/** Msg exitCode. */
|
||||||
|
public exitCode: number;
|
||||||
/** Msg timerStartId. */
|
|
||||||
public timerStartId: number;
|
/** Msg timerStartId. */
|
||||||
|
public timerStartId: number;
|
||||||
/** Msg timerStartInterval. */
|
|
||||||
public timerStartInterval: boolean;
|
/** Msg timerStartInterval. */
|
||||||
|
public timerStartInterval: boolean;
|
||||||
/** Msg timerStartDelay. */
|
|
||||||
public timerStartDelay: number;
|
/** Msg timerStartDelay. */
|
||||||
|
public timerStartDelay: number;
|
||||||
/** Msg timerReadyId. */
|
|
||||||
public timerReadyId: number;
|
/** Msg timerReadyId. */
|
||||||
|
public timerReadyId: number;
|
||||||
/** Msg timerReadyDone. */
|
|
||||||
public timerReadyDone: boolean;
|
/** Msg timerReadyDone. */
|
||||||
|
public timerReadyDone: boolean;
|
||||||
/** Msg timerClearId. */
|
|
||||||
public timerClearId: number;
|
/** Msg timerClearId. */
|
||||||
|
public timerClearId: number;
|
||||||
/** Msg fetchReqId. */
|
|
||||||
public fetchReqId: number;
|
/** Msg fetchReqId. */
|
||||||
|
public fetchReqId: number;
|
||||||
/** Msg fetchReqUrl. */
|
|
||||||
public fetchReqUrl: string;
|
/** Msg fetchReqUrl. */
|
||||||
|
public fetchReqUrl: string;
|
||||||
/** Msg fetchResId. */
|
|
||||||
public fetchResId: number;
|
/** Msg fetchResId. */
|
||||||
|
public fetchResId: number;
|
||||||
/** Msg fetchResStatus. */
|
|
||||||
public fetchResStatus: number;
|
/** Msg fetchResStatus. */
|
||||||
|
public fetchResStatus: number;
|
||||||
/** Msg fetchResHeaderLine. */
|
|
||||||
public fetchResHeaderLine: string[];
|
/** Msg fetchResHeaderLine. */
|
||||||
|
public fetchResHeaderLine: string[];
|
||||||
/** Msg fetchResBody. */
|
|
||||||
public fetchResBody: Uint8Array;
|
/** Msg fetchResBody. */
|
||||||
|
public fetchResBody: Uint8Array;
|
||||||
/** Msg readFileSyncFilename. */
|
|
||||||
public readFileSyncFilename: string;
|
/** Msg readFileSyncFilename. */
|
||||||
|
public readFileSyncFilename: string;
|
||||||
/** Msg readFileSyncData. */
|
|
||||||
public readFileSyncData: Uint8Array;
|
/** Msg readFileSyncData. */
|
||||||
|
public readFileSyncData: Uint8Array;
|
||||||
/** Msg writeFileSyncFilename. */
|
|
||||||
public writeFileSyncFilename: string;
|
/** Msg writeFileSyncFilename. */
|
||||||
|
public writeFileSyncFilename: string;
|
||||||
/** Msg writeFileSyncData. */
|
|
||||||
public writeFileSyncData: Uint8Array;
|
/** Msg writeFileSyncData. */
|
||||||
|
public writeFileSyncData: Uint8Array;
|
||||||
/** Msg writeFileSyncPerm. */
|
|
||||||
public writeFileSyncPerm: number;
|
/** Msg writeFileSyncPerm. */
|
||||||
|
public writeFileSyncPerm: number;
|
||||||
/**
|
|
||||||
* Creates a new Msg instance using the specified properties.
|
/**
|
||||||
* @param [properties] Properties to set
|
* Creates a new Msg instance using the specified properties.
|
||||||
* @returns Msg instance
|
* @param [properties] Properties to set
|
||||||
*/
|
* @returns Msg instance
|
||||||
public static create(properties?: main.IMsg): main.Msg;
|
*/
|
||||||
|
public static create(properties?: main.IMsg): main.Msg;
|
||||||
/**
|
|
||||||
* Encodes the specified Msg message. Does not implicitly {@link main.Msg.verify|verify} messages.
|
/**
|
||||||
* @param message Msg message or plain object to encode
|
* Encodes the specified Msg message. Does not implicitly {@link main.Msg.verify|verify} messages.
|
||||||
* @param [writer] Writer to encode to
|
* @param message Msg message or plain object to encode
|
||||||
* @returns Writer
|
* @param [writer] Writer to encode to
|
||||||
*/
|
* @returns Writer
|
||||||
public static encode(
|
*/
|
||||||
message: main.IMsg,
|
public static encode(message: main.IMsg, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||||
writer?: $protobuf.Writer
|
|
||||||
): $protobuf.Writer;
|
/**
|
||||||
|
* Encodes the specified Msg message, length delimited. Does not implicitly {@link main.Msg.verify|verify} messages.
|
||||||
/**
|
* @param message Msg message or plain object to encode
|
||||||
* Encodes the specified Msg message, length delimited. Does not implicitly {@link main.Msg.verify|verify} messages.
|
* @param [writer] Writer to encode to
|
||||||
* @param message Msg message or plain object to encode
|
* @returns Writer
|
||||||
* @param [writer] Writer to encode to
|
*/
|
||||||
* @returns Writer
|
public static encodeDelimited(message: main.IMsg, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||||
*/
|
|
||||||
public static encodeDelimited(
|
/**
|
||||||
message: main.IMsg,
|
* Decodes a Msg message from the specified reader or buffer.
|
||||||
writer?: $protobuf.Writer
|
* @param reader Reader or buffer to decode from
|
||||||
): $protobuf.Writer;
|
* @param [length] Message length if known beforehand
|
||||||
|
* @returns Msg
|
||||||
/**
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||||||
* Decodes a Msg message from the specified reader or buffer.
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||||
* @param reader Reader or buffer to decode from
|
*/
|
||||||
* @param [length] Message length if known beforehand
|
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): main.Msg;
|
||||||
* @returns Msg
|
|
||||||
* @throws {Error} If the payload is not a reader or valid buffer
|
/**
|
||||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
* Decodes a Msg message from the specified reader or buffer, length delimited.
|
||||||
*/
|
* @param reader Reader or buffer to decode from
|
||||||
public static decode(
|
* @returns Msg
|
||||||
reader: $protobuf.Reader | Uint8Array,
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||||||
length?: number
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||||
): main.Msg;
|
*/
|
||||||
|
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): main.Msg;
|
||||||
/**
|
|
||||||
* Decodes a Msg message from the specified reader or buffer, length delimited.
|
/**
|
||||||
* @param reader Reader or buffer to decode from
|
* Verifies a Msg message.
|
||||||
* @returns Msg
|
* @param message Plain object to verify
|
||||||
* @throws {Error} If the payload is not a reader or valid buffer
|
* @returns `null` if valid, otherwise the reason why it is not
|
||||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
*/
|
||||||
*/
|
public static verify(message: { [k: string]: any }): (string|null);
|
||||||
public static decodeDelimited(
|
|
||||||
reader: $protobuf.Reader | Uint8Array
|
/**
|
||||||
): main.Msg;
|
* Creates a Msg message from a plain object. Also converts values to their respective internal types.
|
||||||
|
* @param object Plain object
|
||||||
/**
|
* @returns Msg
|
||||||
* Verifies a Msg message.
|
*/
|
||||||
* @param message Plain object to verify
|
public static fromObject(object: { [k: string]: any }): main.Msg;
|
||||||
* @returns `null` if valid, otherwise the reason why it is not
|
|
||||||
*/
|
/**
|
||||||
public static verify(message: { [k: string]: any }): string | null;
|
* Creates a plain object from a Msg message. Also converts values to other types if specified.
|
||||||
|
* @param message Msg
|
||||||
/**
|
* @param [options] Conversion options
|
||||||
* Creates a Msg message from a plain object. Also converts values to their respective internal types.
|
* @returns Plain object
|
||||||
* @param object Plain object
|
*/
|
||||||
* @returns Msg
|
public static toObject(message: main.Msg, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||||
*/
|
|
||||||
public static fromObject(object: { [k: string]: any }): main.Msg;
|
/**
|
||||||
|
* Converts this Msg to JSON.
|
||||||
/**
|
* @returns JSON object
|
||||||
* Creates a plain object from a Msg message. Also converts values to other types if specified.
|
*/
|
||||||
* @param message Msg
|
public toJSON(): { [k: string]: any };
|
||||||
* @param [options] Conversion options
|
}
|
||||||
* @returns Plain object
|
|
||||||
*/
|
namespace Msg {
|
||||||
public static toObject(
|
|
||||||
message: main.Msg,
|
/** Command enum. */
|
||||||
options?: $protobuf.IConversionOptions
|
enum Command {
|
||||||
): { [k: string]: any };
|
ERROR = 0,
|
||||||
|
START = 1,
|
||||||
/**
|
CODE_FETCH = 2,
|
||||||
* Converts this Msg to JSON.
|
CODE_FETCH_RES = 3,
|
||||||
* @returns JSON object
|
CODE_CACHE = 4,
|
||||||
*/
|
EXIT = 5,
|
||||||
public toJSON(): { [k: string]: any };
|
TIMER_START = 6,
|
||||||
}
|
TIMER_READY = 7,
|
||||||
|
TIMER_CLEAR = 8,
|
||||||
namespace Msg {
|
FETCH_REQ = 9,
|
||||||
/** Command enum. */
|
FETCH_RES = 10,
|
||||||
enum Command {
|
READ_FILE_SYNC = 11,
|
||||||
ERROR = 0,
|
READ_FILE_SYNC_RES = 12,
|
||||||
START = 1,
|
WRITE_FILE_SYNC = 13
|
||||||
CODE_FETCH = 2,
|
}
|
||||||
CODE_FETCH_RES = 3,
|
|
||||||
CODE_CACHE = 4,
|
|
||||||
EXIT = 5,
|
|
||||||
TIMER_START = 6,
|
|
||||||
TIMER_READY = 7,
|
|
||||||
TIMER_CLEAR = 8,
|
|
||||||
FETCH_REQ = 9,
|
|
||||||
FETCH_RES = 10,
|
|
||||||
READ_FILE_SYNC = 11,
|
|
||||||
READ_FILE_SYNC_RES = 12,
|
|
||||||
WRITE_FILE_SYNC = 13
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
2967
deno2/js/msg.pb.js
2967
deno2/js/msg.pb.js
File diff suppressed because it is too large
Load diff
|
@ -10,6 +10,7 @@ import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
js_path = os.path.dirname(os.path.realpath(__file__))
|
js_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
#bin_path = os.path.join(js_path, "deno_protobufjs", "bin")
|
||||||
bin_path = os.path.join(js_path, "node_modules", ".bin")
|
bin_path = os.path.join(js_path, "node_modules", ".bin")
|
||||||
pbjs_bin = os.path.join(bin_path, "pbjs")
|
pbjs_bin = os.path.join(bin_path, "pbjs")
|
||||||
pbts_bin = os.path.join(bin_path, "pbts")
|
pbts_bin = os.path.join(bin_path, "pbts")
|
||||||
|
@ -28,8 +29,8 @@ def touch(fname):
|
||||||
open(fname, 'a').close()
|
open(fname, 'a').close()
|
||||||
|
|
||||||
subprocess.check_call([
|
subprocess.check_call([
|
||||||
"node",
|
|
||||||
pbjs_bin,
|
pbjs_bin,
|
||||||
|
#"--dependency=./deno_protobufjs/minimal",
|
||||||
"--target=static-module",
|
"--target=static-module",
|
||||||
"--wraper=commonjs",
|
"--wraper=commonjs",
|
||||||
"--out=" + msg_pbjs_out,
|
"--out=" + msg_pbjs_out,
|
||||||
|
@ -45,5 +46,4 @@ subprocess.check_call([
|
||||||
])
|
])
|
||||||
assert os.path.exists(msg_pbts_out)
|
assert os.path.exists(msg_pbts_out)
|
||||||
|
|
||||||
|
|
||||||
touch(stamp_file)
|
touch(stamp_file)
|
||||||
|
|
|
@ -85,6 +85,12 @@ TEST(MockRuntimeTest, DoubleSubFails) {
|
||||||
deno_delete(d);
|
deno_delete(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(MockRuntimeTest, TypedArraySnapshots) {
|
||||||
|
Deno* d = deno_new(NULL, NULL);
|
||||||
|
EXPECT_TRUE(deno_execute(d, "a.js", "TypedArraySnapshots()"));
|
||||||
|
deno_delete(d);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
deno_init();
|
deno_init();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright 2018 Ryan Dahl <ry@tinyclouds.org>
|
// Copyright 2018 Ryan Dahl <ry@tinyclouds.org>
|
||||||
// All rights reserved. MIT License.
|
// All rights reserved. MIT License.
|
||||||
|
// Hint: --trace_serializer is a useful debugging flag.
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -126,6 +127,8 @@ int main(int argc, char** argv) {
|
||||||
const char* natives_out_cc = argv[4];
|
const char* natives_out_cc = argv[4];
|
||||||
const char* snapshot_out_cc = argv[5];
|
const char* snapshot_out_cc = argv[5];
|
||||||
|
|
||||||
|
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
|
||||||
|
|
||||||
auto js_data = ReadFile(js_fn);
|
auto js_data = ReadFile(js_fn);
|
||||||
auto natives_blob = ReadFile(natives_in_bin);
|
auto natives_blob = ReadFile(natives_in_bin);
|
||||||
auto snapshot_in_blob = ReadFile(snapshot_in_bin);
|
auto snapshot_in_blob = ReadFile(snapshot_in_bin);
|
||||||
|
|
|
@ -4,4 +4,12 @@ clang-format -i -style Google *.cc *.h include/*.h
|
||||||
gn format BUILD.gn
|
gn format BUILD.gn
|
||||||
gn format .gn
|
gn format .gn
|
||||||
yapf -i tools/*.py
|
yapf -i tools/*.py
|
||||||
prettier --write js/*.ts js/*.js js/*.json
|
prettier --write \
|
||||||
|
js/deno.d.ts \
|
||||||
|
js/main.ts \
|
||||||
|
js/mock_runtime.js \
|
||||||
|
js/package.json \
|
||||||
|
js/tsconfig.json
|
||||||
|
# Do not format these.
|
||||||
|
# js/msg.pb.js
|
||||||
|
# js/msg.pb.d.ts
|
||||||
|
|
Loading…
Add table
Reference in a new issue