summaryrefslogtreecommitdiff
path: root/deps/v8/src/extensions/gc-extension.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/extensions/gc-extension.cc')
-rw-r--r--deps/v8/src/extensions/gc-extension.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/deps/v8/src/extensions/gc-extension.cc b/deps/v8/src/extensions/gc-extension.cc
index 813b9219bf..1a2fe8ff4b 100644
--- a/deps/v8/src/extensions/gc-extension.cc
+++ b/deps/v8/src/extensions/gc-extension.cc
@@ -26,12 +26,11 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "gc-extension.h"
+#include "platform.h"
namespace v8 {
namespace internal {
-const char* const GCExtension::kSource = "native function gc();";
-
v8::Handle<v8::FunctionTemplate> GCExtension::GetNativeFunction(
v8::Handle<v8::String> str) {
@@ -50,7 +49,15 @@ v8::Handle<v8::Value> GCExtension::GC(const v8::Arguments& args) {
void GCExtension::Register() {
- static GCExtension gc_extension;
+ static char buffer[50];
+ Vector<char> temp_vector(buffer, sizeof(buffer));
+ if (FLAG_expose_gc_as != NULL && strlen(FLAG_expose_gc_as) != 0) {
+ OS::SNPrintF(temp_vector, "native function %s();", FLAG_expose_gc_as);
+ } else {
+ OS::SNPrintF(temp_vector, "native function gc();");
+ }
+
+ static GCExtension gc_extension(buffer);
static v8::DeclareExtension declaration(&gc_extension);
}