Index: src/extensions/gc-extension.cc |
diff --git a/src/extensions/gc-extension.cc b/src/extensions/gc-extension.cc |
index 813b9219bfec7eacd0638cf002c8abb368bba3d2..1a2fe8ff4b3ff89a662d183c3cfcda9be8a149b7 100644 |
--- a/src/extensions/gc-extension.cc |
+++ b/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); |
} |