mini_racer 0.2.15 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -7
- data/CHANGELOG +6 -0
- data/ext/mini_racer_extension/extconf.rb +1 -0
- data/ext/mini_racer_extension/mini_racer_extension.cc +101 -85
- data/lib/mini_racer/version.rb +1 -1
- data/mini_racer.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8218ee18399c771370bf599a4d4cd46707e9f463502e058c98fb38de7505c36
|
4
|
+
data.tar.gz: 8fb4a94f36528343c71b05d2b25473a86c02ff0caf4b651acad4be460ea5f016
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6765304fc32d76d8e7050eeed958130e0e2075d7d2826edc6e855eeb447799b5f009d29b87e448f20c1c1cebba583d9d16569d5f0f83d5f1a64e2530333a5cee
|
7
|
+
data.tar.gz: b224d6b448e1bc064b051adace85bf7ead7334b7682fe132897e87e028de6506afe5fc1921612ec9b8da3b09232f49cf9a6ecba4e594739792479e6e2fbfa54f
|
data/.travis.yml
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.4
|
4
3
|
- 2.5
|
5
4
|
- 2.6
|
6
5
|
- 2.7
|
@@ -10,12 +9,6 @@ matrix:
|
|
10
9
|
- rvm: 2.5.1
|
11
10
|
os: osx
|
12
11
|
osx_image: xcode9.4
|
13
|
-
- rvm: 2.4.0
|
14
|
-
os: osx
|
15
|
-
osx_image: xcode8.3
|
16
|
-
- rvm: 2.4.0
|
17
|
-
os: osx
|
18
|
-
osx_image: xcode7.3
|
19
12
|
dist: trusty
|
20
13
|
sudo: true
|
21
14
|
before_install:
|
data/CHANGELOG
CHANGED
@@ -11,6 +11,7 @@ $CPPFLAGS += " -rdynamic" unless $CPPFLAGS.split.include? "-rdynamic"
|
|
11
11
|
$CPPFLAGS += " -fPIC" unless $CPPFLAGS.split.include? "-rdynamic" or IS_DARWIN
|
12
12
|
$CPPFLAGS += " -std=c++0x"
|
13
13
|
$CPPFLAGS += " -fpermissive"
|
14
|
+
$CPPFLAGS += " -DV8_COMPRESS_POINTERS"
|
14
15
|
|
15
16
|
$CPPFLAGS += " -Wno-reserved-user-defined-literal" if IS_DARWIN
|
16
17
|
|
@@ -25,6 +25,7 @@ public:
|
|
25
25
|
ArrayBuffer::Allocator* allocator;
|
26
26
|
StartupData* startup_data;
|
27
27
|
bool interrupted;
|
28
|
+
bool added_gc_cb;
|
28
29
|
pid_t pid;
|
29
30
|
VALUE mutex;
|
30
31
|
|
@@ -42,15 +43,12 @@ public:
|
|
42
43
|
|
43
44
|
|
44
45
|
IsolateInfo() : isolate(nullptr), allocator(nullptr), startup_data(nullptr),
|
45
|
-
interrupted(false), pid(getpid()), refs_count(0) {
|
46
|
+
interrupted(false), added_gc_cb(false), pid(getpid()), refs_count(0) {
|
46
47
|
VALUE cMutex = rb_const_get(rb_cThread, rb_intern("Mutex"));
|
47
48
|
mutex = rb_class_new_instance(0, nullptr, cMutex);
|
48
49
|
}
|
49
50
|
|
50
|
-
~IsolateInfo()
|
51
|
-
void free_isolate(IsolateInfo*);
|
52
|
-
free_isolate(this);
|
53
|
-
}
|
51
|
+
~IsolateInfo();
|
54
52
|
|
55
53
|
void init(SnapshotInfo* snapshot_info = nullptr);
|
56
54
|
|
@@ -237,11 +235,13 @@ static void prepare_result(MaybeLocal
|
|
237
235
|
Local<Value> local_value = v8res.ToLocalChecked();
|
238
236
|
if ((local_value->IsObject() || local_value->IsArray()) &&
|
239
237
|
!local_value->IsDate() && !local_value->IsFunction()) {
|
240
|
-
Local<Object> JSON = context->Global()->Get(
|
241
|
-
|
238
|
+
Local<Object> JSON = context->Global()->Get(
|
239
|
+
context, String::NewFromUtf8Literal(isolate, "JSON"))
|
240
|
+
.ToLocalChecked().As<Object>();
|
242
241
|
|
243
|
-
Local<Function> stringify = JSON->Get(
|
244
|
-
|
242
|
+
Local<Function> stringify = JSON->Get(
|
243
|
+
context, v8::String::NewFromUtf8Literal(isolate, "stringify"))
|
244
|
+
.ToLocalChecked().As<Function>();
|
245
245
|
|
246
246
|
Local<Object> object = local_value->ToObject(context).ToLocalChecked();
|
247
247
|
const unsigned argc = 1;
|
@@ -295,7 +295,7 @@ static void prepare_result(MaybeLocal
|
|
295
295
|
} else if(trycatch.HasTerminated()) {
|
296
296
|
evalRes.terminated = true;
|
297
297
|
evalRes.message = new Persistent<Value>();
|
298
|
-
Local<String> tmp = String::
|
298
|
+
Local<String> tmp = String::NewFromUtf8Literal(isolate, "JavaScript was terminated (either by timeout or explicitly)");
|
299
299
|
evalRes.message->Reset(isolate, tmp);
|
300
300
|
}
|
301
301
|
if (!trycatch.StackTrace(context).IsEmpty()) {
|
@@ -312,7 +312,8 @@ nogvl_context_eval(void* arg) {
|
|
312
312
|
|
313
313
|
EvalParams* eval_params = (EvalParams*)arg;
|
314
314
|
EvalResult* result = eval_params->result;
|
315
|
-
|
315
|
+
IsolateInfo* isolate_info = eval_params->context_info->isolate_info;
|
316
|
+
Isolate* isolate = isolate_info->isolate;
|
316
317
|
|
317
318
|
Isolate::Scope isolate_scope(isolate);
|
318
319
|
HandleScope handle_scope(isolate);
|
@@ -356,7 +357,10 @@ nogvl_context_eval(void* arg) {
|
|
356
357
|
// parsing successful
|
357
358
|
if (eval_params->max_memory > 0) {
|
358
359
|
isolate->SetData(MEM_SOFTLIMIT_VALUE, &eval_params->max_memory);
|
360
|
+
if (!isolate_info->added_gc_cb) {
|
359
361
|
isolate->AddGCEpilogueCallback(gc_callback);
|
362
|
+
isolate_info->added_gc_cb = true;
|
363
|
+
}
|
360
364
|
}
|
361
365
|
|
362
366
|
maybe_value = parsed_script.ToLocalChecked()->Run(context);
|
@@ -369,6 +373,12 @@ nogvl_context_eval(void* arg) {
|
|
369
373
|
return NULL;
|
370
374
|
}
|
371
375
|
|
376
|
+
static VALUE new_empty_failed_conv_obj() {
|
377
|
+
// TODO isolate code that translates execption to ruby
|
378
|
+
// exception so we can properly return it
|
379
|
+
return rb_funcall(rb_cFailedV8Conversion, rb_intern("new"), 1, rb_str_new2(""));
|
380
|
+
}
|
381
|
+
|
372
382
|
// assumes isolate locking is in place
|
373
383
|
static VALUE convert_v8_to_ruby(Isolate* isolate, Local<Context> context,
|
374
384
|
Local<Value> value) {
|
@@ -400,8 +410,11 @@ static VALUE convert_v8_to_ruby(Isolate* isolate, Local
|
|
400
410
|
VALUE rb_array = rb_ary_new();
|
401
411
|
Local<Array> arr = Local<Array>::Cast(value);
|
402
412
|
for(uint32_t i=0; i < arr->Length(); i++) {
|
403
|
-
|
404
|
-
|
413
|
+
MaybeLocal<Value> element = arr->Get(context, i);
|
414
|
+
if (element.IsEmpty()) {
|
415
|
+
continue;
|
416
|
+
}
|
417
|
+
VALUE rb_elem = convert_v8_to_ruby(isolate, context, element.ToLocalChecked());
|
405
418
|
if (rb_funcall(rb_elem, rb_intern("class"), 0) == rb_cFailedV8Conversion) {
|
406
419
|
return rb_elem;
|
407
420
|
}
|
@@ -431,18 +444,20 @@ static VALUE convert_v8_to_ruby(Isolate* isolate, Local
|
|
431
444
|
if (!maybe_props.IsEmpty()) {
|
432
445
|
Local<Array> props = maybe_props.ToLocalChecked();
|
433
446
|
for(uint32_t i=0; i < props->Length(); i++) {
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
447
|
+
MaybeLocal<Value> key = props->Get(context, i);
|
448
|
+
if (key.IsEmpty()) {
|
449
|
+
return rb_funcall(rb_cFailedV8Conversion, rb_intern("new"), 1, rb_str_new2(""));
|
450
|
+
}
|
451
|
+
VALUE rb_key = convert_v8_to_ruby(isolate, context, key.ToLocalChecked());
|
438
452
|
|
439
|
-
|
440
|
-
//
|
441
|
-
|
442
|
-
|
453
|
+
MaybeLocal<Value> prop_value = object->Get(context, key.ToLocalChecked());
|
454
|
+
// this may have failed due to Get raising
|
455
|
+
if (prop_value.IsEmpty() || trycatch.HasCaught()) {
|
456
|
+
return new_empty_failed_conv_obj();
|
443
457
|
}
|
444
458
|
|
445
|
-
VALUE rb_value = convert_v8_to_ruby(
|
459
|
+
VALUE rb_value = convert_v8_to_ruby(
|
460
|
+
isolate, context, prop_value.ToLocalChecked());
|
446
461
|
rb_hash_aset(rb_hash, rb_key, rb_value);
|
447
462
|
}
|
448
463
|
}
|
@@ -524,7 +539,7 @@ static Local
|
|
524
539
|
length = RARRAY_LEN(value);
|
525
540
|
array = Array::New(isolate, (int)length);
|
526
541
|
for(i=0; i<length; i++) {
|
527
|
-
|
542
|
+
array->Set(context, i, convert_ruby_to_v8(isolate, context, rb_ary_entry(value, i)));
|
528
543
|
}
|
529
544
|
return scope.Escape(array);
|
530
545
|
case T_HASH:
|
@@ -533,7 +548,7 @@ static Local
|
|
533
548
|
length = RARRAY_LEN(hash_as_array);
|
534
549
|
for(i=0; i<length; i++) {
|
535
550
|
pair = rb_ary_entry(hash_as_array, i);
|
536
|
-
|
551
|
+
object->Set(context, convert_ruby_to_v8(isolate, context, rb_ary_entry(pair, 0)),
|
537
552
|
convert_ruby_to_v8(isolate, context, rb_ary_entry(pair, 1)));
|
538
553
|
}
|
539
554
|
return scope.Escape(object);
|
@@ -563,9 +578,9 @@ static Local
|
|
563
578
|
case T_UNDEF:
|
564
579
|
case T_NODE:
|
565
580
|
default:
|
566
|
-
return scope.Escape(String::
|
581
|
+
return scope.Escape(String::NewFromUtf8Literal(isolate, "Undefined Conversion"));
|
582
|
+
}
|
567
583
|
}
|
568
|
-
}
|
569
584
|
|
570
585
|
static void unblock_eval(void *ptr) {
|
571
586
|
EvalParams* eval = (EvalParams*)ptr;
|
@@ -576,53 +591,43 @@ static void unblock_eval(void *ptr) {
|
|
576
591
|
* The implementations of the run_extra_code(), create_snapshot_data_blob() and
|
577
592
|
* warm_up_snapshot_data_blob() functions have been derived from V8's test suite.
|
578
593
|
*/
|
579
|
-
bool run_extra_code(Isolate *isolate, Local<v8::Context> context,
|
594
|
+
static bool run_extra_code(Isolate *isolate, Local<v8::Context> context,
|
580
595
|
const char *utf8_source, const char *name) {
|
581
596
|
Context::Scope context_scope(context);
|
582
597
|
TryCatch try_catch(isolate);
|
583
598
|
Local<String> source_string;
|
584
|
-
if (!String::NewFromUtf8(isolate, utf8_source
|
585
|
-
NewStringType::kNormal)
|
586
|
-
.ToLocal(&source_string)) {
|
599
|
+
if (!String::NewFromUtf8(isolate, utf8_source).ToLocal(&source_string)) {
|
587
600
|
return false;
|
588
601
|
}
|
589
|
-
Local<
|
590
|
-
|
591
|
-
.ToLocalChecked();
|
602
|
+
Local<String> resource_name =
|
603
|
+
String::NewFromUtf8(isolate, name).ToLocalChecked();
|
592
604
|
ScriptOrigin origin(resource_name);
|
593
605
|
ScriptCompiler::Source source(source_string, origin);
|
594
606
|
Local<Script> script;
|
595
607
|
if (!ScriptCompiler::Compile(context, &source).ToLocal(&script))
|
596
608
|
return false;
|
597
|
-
if (script->Run(context).IsEmpty())
|
598
|
-
return false;
|
599
|
-
// CHECK(!try_catch.HasCaught());
|
609
|
+
if (script->Run(context).IsEmpty()) return false;
|
600
610
|
return true;
|
601
611
|
}
|
602
612
|
|
603
|
-
StartupData
|
613
|
+
static StartupData
|
604
614
|
create_snapshot_data_blob(const char *embedded_source = nullptr) {
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
SnapshotCreator snapshot_creator;
|
610
|
-
Isolate *isolate = snapshot_creator.GetIsolate();
|
615
|
+
Isolate *isolate = Isolate::Allocate();
|
616
|
+
|
617
|
+
// Optionally run a script to embed, and serialize to create a snapshot blob.
|
618
|
+
SnapshotCreator snapshot_creator(isolate);
|
611
619
|
{
|
612
620
|
HandleScope scope(isolate);
|
613
|
-
|
621
|
+
Local<v8::Context> context = v8::Context::New(isolate);
|
614
622
|
if (embedded_source != nullptr &&
|
615
|
-
!run_extra_code(isolate, context, embedded_source,
|
616
|
-
|
617
|
-
return result;
|
623
|
+
!run_extra_code(isolate, context, embedded_source, "<embedded>")) {
|
624
|
+
return {};
|
618
625
|
}
|
619
626
|
snapshot_creator.SetDefaultContext(context);
|
620
627
|
}
|
621
|
-
|
628
|
+
return snapshot_creator.CreateBlob(
|
622
629
|
SnapshotCreator::FunctionCodeHandling::kClear);
|
623
630
|
}
|
624
|
-
return result;
|
625
|
-
}
|
626
631
|
|
627
632
|
StartupData warm_up_snapshot_data_blob(StartupData cold_snapshot_blob,
|
628
633
|
const char *warmup_source) {
|
@@ -1062,7 +1067,9 @@ gvl_ruby_callback(void* data) {
|
|
1062
1067
|
callback_data.failed = false;
|
1063
1068
|
|
1064
1069
|
if ((bool)args->GetIsolate()->GetData(DO_TERMINATE) == true) {
|
1065
|
-
args->GetIsolate()->ThrowException(
|
1070
|
+
args->GetIsolate()->ThrowException(
|
1071
|
+
String::NewFromUtf8Literal(args->GetIsolate(),
|
1072
|
+
"Terminated execution during transition from Ruby to JS"));
|
1066
1073
|
args->GetIsolate()->TerminateExecution();
|
1067
1074
|
if (length > 0) {
|
1068
1075
|
rb_ary_clear(ruby_args);
|
@@ -1076,7 +1083,7 @@ gvl_ruby_callback(void* data) {
|
|
1076
1083
|
|
1077
1084
|
if(callback_data.failed) {
|
1078
1085
|
rb_iv_set(parent, "@current_exception", result);
|
1079
|
-
args->GetIsolate()->ThrowException(String::
|
1086
|
+
args->GetIsolate()->ThrowException(String::NewFromUtf8Literal(args->GetIsolate(), "Ruby exception"));
|
1080
1087
|
}
|
1081
1088
|
else {
|
1082
1089
|
HandleScope scope(args->GetIsolate());
|
@@ -1147,7 +1154,9 @@ static VALUE rb_external_function_notify_v8(VALUE self) {
|
|
1147
1154
|
|
1148
1155
|
if (parent_object == Qnil) {
|
1149
1156
|
context->Global()->Set(
|
1150
|
-
|
1157
|
+
context,
|
1158
|
+
v8_str,
|
1159
|
+
FunctionTemplate::New(isolate, ruby_callback, external)
|
1151
1160
|
->GetFunction(context)
|
1152
1161
|
.ToLocalChecked());
|
1153
1162
|
|
@@ -1160,7 +1169,7 @@ static VALUE rb_external_function_notify_v8(VALUE self) {
|
|
1160
1169
|
|
1161
1170
|
MaybeLocal<Script> parsed_script = Script::Compile(context, eval);
|
1162
1171
|
if (parsed_script.IsEmpty()) {
|
1163
|
-
|
1172
|
+
parse_error = true;
|
1164
1173
|
} else {
|
1165
1174
|
MaybeLocal<Value> maybe_value =
|
1166
1175
|
parsed_script.ToLocalChecked()->Run(context);
|
@@ -1170,11 +1179,12 @@ static VALUE rb_external_function_notify_v8(VALUE self) {
|
|
1170
1179
|
Local<Value> value = maybe_value.ToLocalChecked();
|
1171
1180
|
if (value->IsObject()) {
|
1172
1181
|
value.As<Object>()->Set(
|
1173
|
-
|
1174
|
-
|
1182
|
+
context,
|
1183
|
+
v8_str,
|
1184
|
+
FunctionTemplate::New(isolate, ruby_callback, external)
|
1175
1185
|
->GetFunction(context)
|
1176
1186
|
.ToLocalChecked());
|
1177
|
-
|
1187
|
+
attach_error = false;
|
1178
1188
|
}
|
1179
1189
|
}
|
1180
1190
|
}
|
@@ -1204,32 +1214,31 @@ static VALUE rb_context_isolate_mutex(VALUE self) {
|
|
1204
1214
|
return context_info->isolate_info->mutex;
|
1205
1215
|
}
|
1206
1216
|
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
if (isolate_info->isolate) {
|
1214
|
-
if (isolate_info->interrupted) {
|
1215
|
-
fprintf(stderr, "WARNING: V8 isolate was interrupted by Ruby, it can not be disposed and memory will not be reclaimed till the Ruby process exits.\n");
|
1217
|
+
IsolateInfo::~IsolateInfo() {
|
1218
|
+
if (isolate) {
|
1219
|
+
if (this->interrupted) {
|
1220
|
+
fprintf(stderr, "WARNING: V8 isolate was interrupted by Ruby, "
|
1221
|
+
"it can not be disposed and memory will not be "
|
1222
|
+
"reclaimed till the Ruby process exits.\n");
|
1216
1223
|
} else {
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1224
|
+
if (this->pid != getpid()) {
|
1225
|
+
fprintf(stderr, "WARNING: V8 isolate was forked, "
|
1226
|
+
"it can not be disposed and "
|
1227
|
+
"memory will not be reclaimed "
|
1228
|
+
"till the Ruby process exits.\n");
|
1220
1229
|
} else {
|
1221
|
-
|
1230
|
+
isolate->Dispose();
|
1222
1231
|
}
|
1223
1232
|
}
|
1224
|
-
|
1233
|
+
isolate = nullptr;
|
1225
1234
|
}
|
1226
1235
|
|
1227
|
-
if (
|
1228
|
-
delete[]
|
1229
|
-
delete
|
1236
|
+
if (startup_data) {
|
1237
|
+
delete[] startup_data->data;
|
1238
|
+
delete startup_data;
|
1230
1239
|
}
|
1231
1240
|
|
1232
|
-
delete
|
1241
|
+
delete allocator;
|
1233
1242
|
}
|
1234
1243
|
|
1235
1244
|
static void free_context_raw(void *arg) {
|
@@ -1301,7 +1310,7 @@ static void mark_isolate(void* data) {
|
|
1301
1310
|
isolate_info->mark();
|
1302
1311
|
}
|
1303
1312
|
|
1304
|
-
void deallocate(void* data) {
|
1313
|
+
static void deallocate(void* data) {
|
1305
1314
|
ContextInfo* context_info = (ContextInfo*)data;
|
1306
1315
|
|
1307
1316
|
free_context(context_info);
|
@@ -1316,22 +1325,22 @@ static void mark_context(void* data) {
|
|
1316
1325
|
}
|
1317
1326
|
}
|
1318
1327
|
|
1319
|
-
void deallocate_external_function(void * data) {
|
1328
|
+
static void deallocate_external_function(void * data) {
|
1320
1329
|
xfree(data);
|
1321
1330
|
}
|
1322
1331
|
|
1323
|
-
void deallocate_snapshot(void * data) {
|
1332
|
+
static void deallocate_snapshot(void * data) {
|
1324
1333
|
SnapshotInfo* snapshot_info = (SnapshotInfo*)data;
|
1325
1334
|
delete[] snapshot_info->data;
|
1326
1335
|
xfree(snapshot_info);
|
1327
1336
|
}
|
1328
1337
|
|
1329
|
-
VALUE allocate_external_function(VALUE klass) {
|
1338
|
+
static VALUE allocate_external_function(VALUE klass) {
|
1330
1339
|
VALUE* self = ALLOC(VALUE);
|
1331
1340
|
return Data_Wrap_Struct(klass, NULL, deallocate_external_function, (void*)self);
|
1332
1341
|
}
|
1333
1342
|
|
1334
|
-
VALUE allocate(VALUE klass) {
|
1343
|
+
static VALUE allocate(VALUE klass) {
|
1335
1344
|
ContextInfo* context_info = ALLOC(ContextInfo);
|
1336
1345
|
context_info->isolate_info = NULL;
|
1337
1346
|
context_info->context = NULL;
|
@@ -1339,7 +1348,7 @@ VALUE allocate(VALUE klass) {
|
|
1339
1348
|
return Data_Wrap_Struct(klass, mark_context, deallocate, (void*)context_info);
|
1340
1349
|
}
|
1341
1350
|
|
1342
|
-
VALUE allocate_snapshot(VALUE klass) {
|
1351
|
+
static VALUE allocate_snapshot(VALUE klass) {
|
1343
1352
|
SnapshotInfo* snapshot_info = ALLOC(SnapshotInfo);
|
1344
1353
|
snapshot_info->data = NULL;
|
1345
1354
|
snapshot_info->raw_size = 0;
|
@@ -1347,7 +1356,7 @@ VALUE allocate_snapshot(VALUE klass) {
|
|
1347
1356
|
return Data_Wrap_Struct(klass, NULL, deallocate_snapshot, (void*)snapshot_info);
|
1348
1357
|
}
|
1349
1358
|
|
1350
|
-
VALUE allocate_isolate(VALUE klass) {
|
1359
|
+
static VALUE allocate_isolate(VALUE klass) {
|
1351
1360
|
IsolateInfo* isolate_info = new IsolateInfo();
|
1352
1361
|
|
1353
1362
|
return Data_Wrap_Struct(klass, mark_isolate, deallocate_isolate, (void*)isolate_info);
|
@@ -1486,7 +1495,8 @@ nogvl_context_call(void *args) {
|
|
1486
1495
|
if (!call) {
|
1487
1496
|
return NULL;
|
1488
1497
|
}
|
1489
|
-
|
1498
|
+
IsolateInfo *isolate_info = call->context_info->isolate_info;
|
1499
|
+
Isolate* isolate = isolate_info->isolate;
|
1490
1500
|
|
1491
1501
|
// in gvl flag
|
1492
1502
|
isolate->SetData(IN_GVL, (void*)false);
|
@@ -1496,7 +1506,10 @@ nogvl_context_call(void *args) {
|
|
1496
1506
|
if (call->max_memory > 0) {
|
1497
1507
|
isolate->SetData(MEM_SOFTLIMIT_VALUE, &call->max_memory);
|
1498
1508
|
isolate->SetData(MEM_SOFTLIMIT_REACHED, (void*)false);
|
1509
|
+
if (!isolate_info->added_gc_cb) {
|
1499
1510
|
isolate->AddGCEpilogueCallback(gc_callback);
|
1511
|
+
isolate_info->added_gc_cb = true;
|
1512
|
+
}
|
1500
1513
|
}
|
1501
1514
|
|
1502
1515
|
Isolate::Scope isolate_scope(isolate);
|
@@ -1574,8 +1587,11 @@ static VALUE rb_context_call_unsafe(int argc, VALUE *argv, VALUE self) {
|
|
1574
1587
|
|
1575
1588
|
// examples of such usage can be found in
|
1576
1589
|
// https://github.com/v8/v8/blob/36b32aa28db5e993312f4588d60aad5c8330c8a5/test/cctest/test-api.cc#L15711
|
1577
|
-
|
1578
|
-
MaybeLocal<v8::Value> val
|
1590
|
+
MaybeLocal<String> fname = String::NewFromUtf8(isolate, call.function_name);
|
1591
|
+
MaybeLocal<v8::Value> val;
|
1592
|
+
if (!fname.IsEmpty()) {
|
1593
|
+
val = context->Global()->Get(context, fname.ToLocalChecked());
|
1594
|
+
}
|
1579
1595
|
|
1580
1596
|
if (val.IsEmpty() || !val.ToLocalChecked()->IsFunction()) {
|
1581
1597
|
missingFunction = true;
|
data/lib/mini_racer/version.rb
CHANGED
data/mini_racer.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency "rake-compiler"
|
33
33
|
spec.add_development_dependency "m"
|
34
34
|
|
35
|
-
spec.add_dependency 'libv8', '>
|
35
|
+
spec.add_dependency 'libv8', '> 8.4'
|
36
36
|
spec.require_paths = ["lib", "ext"]
|
37
37
|
|
38
38
|
spec.extensions = ["ext/mini_racer_extension/extconf.rb"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_racer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '8.4'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '8.4'
|
97
97
|
description: Minimal embedded v8 engine for Ruby
|
98
98
|
email:
|
99
99
|
- sam.saffron@gmail.com
|
@@ -122,9 +122,9 @@ licenses:
|
|
122
122
|
- MIT
|
123
123
|
metadata:
|
124
124
|
bug_tracker_uri: https://github.com/discourse/mini_racer/issues
|
125
|
-
changelog_uri: https://github.com/discourse/mini_racer/blob/v0.
|
126
|
-
documentation_uri: https://www.rubydoc.info/gems/mini_racer/0.
|
127
|
-
source_code_uri: https://github.com/discourse/mini_racer/tree/v0.
|
125
|
+
changelog_uri: https://github.com/discourse/mini_racer/blob/v0.3.0/CHANGELOG
|
126
|
+
documentation_uri: https://www.rubydoc.info/gems/mini_racer/0.3.0
|
127
|
+
source_code_uri: https://github.com/discourse/mini_racer/tree/v0.3.0
|
128
128
|
post_install_message:
|
129
129
|
rdoc_options: []
|
130
130
|
require_paths:
|