1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

start adding support for V8 VM introspection functions.

This commit is contained in:
Charles Lowell 2011-03-21 13:32:47 -05:00
parent b23c6e96fc
commit 96eb8463c0
3 changed files with 36 additions and 0 deletions

View file

@ -14,6 +14,7 @@
#include "v8_exception.h"
#include "v8_locker.h"
#include "v8_debug.h"
#include "v8_v8.h"
#include <stdio.h>
@ -39,5 +40,6 @@ extern "C" {
rr_init_v8_exception();
rr_init_v8_locker();
rr_init_v8_debug();
rr_init_v8_v8();
}
}

28
ext/v8/v8_v8.cpp Normal file
View file

@ -0,0 +1,28 @@
#include "rr.h"
using namespace v8;
namespace {
VALUE IsDead(VALUE self) {
return rr_v82rb(V8::IsDead());
}
VALUE AdjustAmountOfExternalAllocatedMemory(VALUE self, VALUE bytes) {
V8::AdjustAmountOfExternalAllocatedMemory(NUM2INT(bytes));
return Qnil;
}
VALUE IdleNotification(VALUE self) {
return rr_v82rb(V8::IdleNotification());
}
}
void rr_init_v8_v8() {
VALUE V8Module = rr_define_module("V8");
rr_define_singleton_method(V8Module, "IsDead", IsDead, 0);
rr_define_singleton_method(V8Module, "AdjustAmountOfExternalAllocatedMemory", AdjustAmountOfExternalAllocatedMemory, 1);
rr_define_singleton_method(V8Module, "IdleNotification", IdleNotification, 0);
}

6
ext/v8/v8_v8.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef _RR_V8_V8_
#define _RR_V8_V8_
void rr_init_v8_v8();
#endif