mirror of
				https://github.com/rubyjs/mini_racer
				synced 2023-03-27 23:21:28 -04:00 
			
		
		
		
	Introduce changes to account for upstream V8 API deprecations
This commit is contained in:
		
							parent
							
								
									4c104f6a91
								
							
						
					
					
						commit
						bbf46101cd
					
				
					 3 changed files with 13 additions and 8 deletions
				
			
		| 
						 | 
					@ -1,3 +1,8 @@
 | 
				
			||||||
 | 
					- Unreleased
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - Deprecate Isolate#idle_notification in favour of Isolate#idle_notification_deadline @ignisf
 | 
				
			||||||
 | 
					  - Account for changes in the upstream V8 API @ignisf
 | 
				
			||||||
 | 
					  - Bump dependency of V8 to 6.7
 | 
				
			||||||
 | 
					
 | 
				
			||||||
23-08-2017
 | 
					23-08-2017
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -202,7 +202,7 @@ static void gc_callback(Isolate *isolate, GCType type, GCCallbackFlags flags) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(used > softlimit) {
 | 
					    if(used > softlimit) {
 | 
				
			||||||
        isolate->SetData(MEM_SOFTLIMIT_REACHED, (void*)true);
 | 
					        isolate->SetData(MEM_SOFTLIMIT_REACHED, (void*)true);
 | 
				
			||||||
        V8::TerminateExecution(isolate);
 | 
					        isolate->TerminateExecution();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -626,11 +626,11 @@ static VALUE rb_isolate_init_with_snapshot(VALUE self, VALUE snapshot) {
 | 
				
			||||||
    return Qnil;
 | 
					    return Qnil;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static VALUE rb_isolate_idle_notification(VALUE self, VALUE idle_time_in_ms) {
 | 
					static VALUE rb_isolate_idle_notification_deadline(VALUE self, VALUE idle_time_in_s) {
 | 
				
			||||||
    IsolateInfo* isolate_info;
 | 
					    IsolateInfo* isolate_info;
 | 
				
			||||||
    Data_Get_Struct(self, IsolateInfo, isolate_info);
 | 
					    Data_Get_Struct(self, IsolateInfo, isolate_info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return isolate_info->isolate->IdleNotification(NUM2INT(idle_time_in_ms)) ? Qtrue : Qfalse;
 | 
					    return isolate_info->isolate->IdleNotificationDeadline(NUM2DBL(idle_time_in_s)) ? Qtrue : Qfalse;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static VALUE rb_context_init_unsafe(VALUE self, VALUE isolate, VALUE snap) {
 | 
					static VALUE rb_context_init_unsafe(VALUE self, VALUE isolate, VALUE snap) {
 | 
				
			||||||
| 
						 | 
					@ -901,7 +901,7 @@ gvl_ruby_callback(void* data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((bool)args->GetIsolate()->GetData(DO_TERMINATE) == true) {
 | 
					    if ((bool)args->GetIsolate()->GetData(DO_TERMINATE) == true) {
 | 
				
			||||||
	args->GetIsolate()->ThrowException(String::NewFromUtf8(args->GetIsolate(), "Terminated execution during transition from Ruby to JS"));
 | 
						args->GetIsolate()->ThrowException(String::NewFromUtf8(args->GetIsolate(), "Terminated execution during transition from Ruby to JS"));
 | 
				
			||||||
	V8::TerminateExecution(args->GetIsolate());
 | 
						args->GetIsolate()->TerminateExecution();
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -924,7 +924,7 @@ gvl_ruby_callback(void* data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((bool)args->GetIsolate()->GetData(DO_TERMINATE) == true) {
 | 
					    if ((bool)args->GetIsolate()->GetData(DO_TERMINATE) == true) {
 | 
				
			||||||
      Isolate* isolate = args->GetIsolate();
 | 
					      Isolate* isolate = args->GetIsolate();
 | 
				
			||||||
      V8::TerminateExecution(isolate);
 | 
					      isolate->TerminateExecution();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return NULL;
 | 
					    return NULL;
 | 
				
			||||||
| 
						 | 
					@ -1180,7 +1180,7 @@ rb_context_stop(VALUE self) {
 | 
				
			||||||
    // flag for termination
 | 
					    // flag for termination
 | 
				
			||||||
    isolate->SetData(DO_TERMINATE, (void*)true);
 | 
					    isolate->SetData(DO_TERMINATE, (void*)true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    V8::TerminateExecution(isolate);
 | 
					    isolate->TerminateExecution();
 | 
				
			||||||
    rb_funcall(self, rb_intern("stop_attached"), 0);
 | 
					    rb_funcall(self, rb_intern("stop_attached"), 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Qnil;
 | 
					    return Qnil;
 | 
				
			||||||
| 
						 | 
					@ -1361,7 +1361,7 @@ extern "C" {
 | 
				
			||||||
	rb_define_method(rb_cSnapshot, "warmup!", (VALUE(*)(...))&rb_snapshot_warmup, 1);
 | 
						rb_define_method(rb_cSnapshot, "warmup!", (VALUE(*)(...))&rb_snapshot_warmup, 1);
 | 
				
			||||||
	rb_define_private_method(rb_cSnapshot, "load", (VALUE(*)(...))&rb_snapshot_load, 1);
 | 
						rb_define_private_method(rb_cSnapshot, "load", (VALUE(*)(...))&rb_snapshot_load, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rb_define_method(rb_cIsolate, "idle_notification", (VALUE(*)(...))&rb_isolate_idle_notification, 1);
 | 
						rb_define_method(rb_cIsolate, "idle_notification_deadline", (VALUE(*)(...))&rb_isolate_idle_notification_deadline, 1);
 | 
				
			||||||
	rb_define_private_method(rb_cIsolate, "init_with_snapshot",(VALUE(*)(...))&rb_isolate_init_with_snapshot, 1);
 | 
						rb_define_private_method(rb_cIsolate, "init_with_snapshot",(VALUE(*)(...))&rb_isolate_init_with_snapshot, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rb_define_singleton_method(rb_cPlatform, "set_flag_as_str!", (VALUE(*)(...))&rb_platform_set_flag_as_str, 1);
 | 
						rb_define_singleton_method(rb_cPlatform, "set_flag_as_str!", (VALUE(*)(...))&rb_platform_set_flag_as_str, 1);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -502,7 +502,7 @@ raise FooError, "I like foos"
 | 
				
			||||||
  def test_isolate_can_be_notified_of_idle_time
 | 
					  def test_isolate_can_be_notified_of_idle_time
 | 
				
			||||||
    isolate = MiniRacer::Isolate.new
 | 
					    isolate = MiniRacer::Isolate.new
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(isolate.idle_notification(1000))
 | 
					    assert(isolate.idle_notification_deadline(1))
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_concurrent_access_over_the_same_isolate_1
 | 
					  def test_concurrent_access_over_the_same_isolate_1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue