From ff48eca5403140b134a3e6a772ffb6f8905fae3e Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 10 Jun 2018 05:34:03 +0200 Subject: Expose deno::from_snapshot() constructor --- deno2/deno.cc | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'deno2/deno.cc') diff --git a/deno2/deno.cc b/deno2/deno.cc index 4618b5480..eb9b05a7f 100644 --- a/deno2/deno.cc +++ b/deno2/deno.cc @@ -28,24 +28,13 @@ IN THE SOFTWARE. #include "v8/include/libplatform/libplatform.h" #include "v8/include/v8.h" +#include "deno_internal.h" #include "include/deno.h" #define CHECK(x) assert(x) // TODO(ry) use V8's CHECK. namespace deno { -// deno_s = Wrapped Isolate. -struct deno_s { - v8::Isolate* isolate; - std::string last_exception; - v8::Persistent recv; - v8::Persistent context; - RecvCallback cb; - void* data; -}; - -void deno_add_isolate(Deno* d, v8::Isolate* isolate); - // Extracts a C string from a v8::V8 Utf8Value. const char* ToCString(const v8::String::Utf8Value& value) { return *value ? *value : ""; @@ -170,10 +159,6 @@ void Send(const v8::FunctionCallbackInfo& args) { } } -intptr_t external_references[] = {reinterpret_cast(Print), - reinterpret_cast(Recv), - reinterpret_cast(Send), 0}; - const char* v8_version() { return v8::V8::GetVersion(); } void v8_set_flags(int* argc, char** argv) { @@ -261,28 +246,6 @@ void v8_init() { v8::V8::Initialize(); } -Deno* deno_from_snapshot(v8::StartupData* blob, void* data, RecvCallback cb) { - Deno* d = new Deno; - d->cb = cb; - d->data = data; - v8::Isolate::CreateParams params; - params.snapshot_blob = blob; - params.array_buffer_allocator = - v8::ArrayBuffer::Allocator::NewDefaultAllocator(); - params.external_references = external_references; - v8::Isolate* isolate = v8::Isolate::New(params); - deno_add_isolate(d, isolate); - - v8::Isolate::Scope isolate_scope(isolate); - { - v8::HandleScope handle_scope(isolate); - auto context = v8::Context::New(isolate); - d->context.Reset(d->isolate, context); - } - - return d; -} - void deno_add_isolate(Deno* d, v8::Isolate* isolate) { d->isolate = isolate; // Leaving this code here because it will probably be useful later on, but -- cgit v1.2.3