v8

Javascript regex hangs (using v8)

Im using this regex to get the contents of a tag in a file. var regex = new RegExp("<tag:main>((?:.|\\s)*)</tag:main>"); This causes the v8 engine to hang indefinitely. Now, if I use new RegExp("<tag:main>([\s\S]*)</tag:main>"), all is good. Anyone have an idea why the first one takes too long? ...

How to use V8's built in functions

I'm new in both javascript and V8. According to Google's Embedder's Guide, I saw something in the context section talking about built-in utility javascript functions. And I also found some .js files(e.g. math.js) in the downloaded source code, so I tried to write a simple program to call functions in these files, but I failed. Does a c...

Google Javascript v8 - multithreading

Hi guys Suppose I have the following piece of code bool run (void) { HandleScope hande_scope; Handle<String> source; Local<Script> script; Persistent<Context> context; context = Context::New(); Context::Scope context_scope(context); script = Script::Compile("var a = 1; var b = 2;"); Local<Value> result...

Javascript Getting Objects to Fallback to One Another

Here's a ugly bit of Javascript it would be nice to find a workaround. Javascript has no classes, and that is a good thing. But it implements fallback between objects in a rather ugly way. The foundational construct should be to have one object that, when a property fails to be found, it falls back to another object. So if we want a to...

Executing Javascript without a browser?

I am looking into Javascript programming without a browser. I want to run scripts from the Linux or Mac OS X command line, much like we run any other scripting language (ruby, php, perl, python...) $ javascript my_javascript_code.js I looked into spider monkey (Mozilla) and v8 (Google), but both of these appear to be embedded. Is a...

Compile JavaScript to Native Code with V8

Is it really possible, with Google's V8 Engine, to compile JavaScript into Native Code, save it as a binary file, and execute it whenever I want through my software envorinment, on any machine? ...

Where Do I Download TraceMonkey?

I can get the Spidermonkey javascript engine from here: http://www.mozilla.org/js/spidermonkey/ And, I know that Tracemonkey is the newer version released after SpiderMonkey but I cannot find the download link for it in Mozilla? Is it released for public use? Should I stick back to SpiderMonkey or switch to Google's V8 altogether - i...

v8 is too slow for my purpose

I'm working on a music visualization plugin for libvisual. It's an AVS clone -- AVS being from Winamp. Right now I have a superscope plugin. This element has 4 scripts, and "point" is run at every pixel. You can imagine that it has to be rather fast. The original libvisual avs clone had a JIT compiler that was really fast, but it had som...

How do you expose a C++ class in the V8 Javascript Engine so it can be created using new?

The official examples of exposing a Point class seem to assume that there will be a fixed number of instances of it in your program. It is not clear how new instances are allocated in the C++ code, when new is called in Javascript. How would you expose a class that can have multiple instances? For example, an Image class: var img1 = ne...

String::New: what is it?

I am from a Java background and is learning C++. I encountered the following C++ code: String source = String::New("'Hello' + ', World'"); As what I understand so far, this should be a call to static member function 'New' of class 'String'. But, I've searched through the whole header file defining 'String', there is not any static me...

Embedding v8 with Visual C++ 2010

Hi I'm trying to embed the v8 engine to my C++ application. I use Visual C++ 2010. I've built it successfully using this command: scons env="INCLUDE:C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include;C:\Program Files\Microsoft Visual Studio 10.0\VC\include,LIB:C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib;C:\Program Files\Micros...

Understanding Google V8's Architecture

I'm not sure I understand V8's architecture (yes, I've read its documentation). In C# with the v8sharp wrapper I write something like this, for example: namespace App { class Point { public Point() { } public Point(double x, double y) { this.X = x; this.Y = y; } public d...

V8 compilation problems.

Hi, I'm trying to compile a file with the V8 the JavaScript Engine by Google. I installed scons and have compiled the V8 engine. But, here is where the problem lies, I stay in the V8 directory as they say and make a file named hello_world.cpp with the code: #include <v8.h> using namespace v8; int main(int argc, char* argv[]) { ...

Why does this pointer point to nowhere?

I'm trying to add functionality to the v8sharp project and I'm having some issues (I'm not very good at C++ so I'm pretty sure the issue lies in my lack of C++ abilities rather than misusing v8.) Anyone in v8sharp we have this code v8value.cpp: v8sharp::V8FunctionWrapper^ V8ValueWrapper::WrapFunction(v8::Handle<v8::Value> value) { ...

JavaScript Standard Library for V8

Hi In my application, I allow users to write plugins using JavaScript. I embed V8 for that purpose. The problem is that developers can't use things like HTTP, Sockets, Streams, Timers, Threading, Crypotography, Unit tests, et cetra. I searched Stack Overflow and I found node.js. The problem with it is that you can actually create HTTP...

XMLHttpRequest Implementation

I would like to understand the low level details of how XMLHttpRequest works in Javascript, however I have not had any luck finding the implementation code within either the Rhino or V8 code. I'm not familiar with the code in either projects, so I may not be looking in the right spots. Is there an available open-source implementation a...

Cross platform recursive file list using C++?

What is the most efficient way to recursively list files in a specific directory and its subdirectories? Should I use the standard library, or use some third party? I want this because I use v8 as a JavaScript engine, and I want to execute all scripts in some directory (and its subdirectories). If there's any built-in way to do that in...

V8 FunctionTemplate Class Instance

I have the following class: class PluginManager { public: Handle<Value> Register(const Arguments& args); Handle<ObjectTemplate> GetObjectTemplate(); }; I want the Register method to be accessible from JavaScript. I add it to the global object like this: PluginManager pluginManagerInstance; global->Set(String::New("register...

How to execute JS from Python, that uses 'Document' and/or 'Window'

I am currently working on getting JavaScript to execute successfully from within Python. I have implemented a JS engine (v8) using the PyV8 package. From here I can execute primitive JavaScript ("1+2", etc). However, for JavaScript that uses references to "document" or "window" the code will throw an error. I am looking, ideally, for a P...

Running Less.js on C#/Javascript.net/V8

I'm trying to run less.js in a C# application. I tried running the default distro using JavaScript.net but I'm getting window is undefined error. I think that is caused due to this not being run in a browser but on a JS engine. Is there any workaround / any pointers to resources that can help? ...