Can't reproduce this after syncing up with v8 bleeding edge. Thanks! On Fri, Mar 9, 2012 at 8:03 AM, Michael Starzinger <[email protected] > wrote:
> This should have been fixed by the following change, can you try again > with a later version? It should work fine without any flags and also > with the "--inline-construct" flag. > > http://code.google.com/p/v8/source/detail?r=10920 > > Best regards, > Michael > > > > On Fri, Mar 9, 2012 at 16:23, Henry Rodrick <[email protected]> wrote: > >> Hi all! >> >> I have a strange issue with V8 where my JavaScript programs crash with >> the following kind of error: >> >> <unknown>:132: Uncaught TypeError: Cannot set property 'x' of >> undefined >> >> A small test JavaScript that will reproduce the problem looks like >> this: >> >> ------------------------------------ 8< >> ------------------------------------- >> >> "use strict"; >> >> var Thing = function (x, y) { >> this.x = x; >> this.y = y; >> }; >> >> >> for (var i = 0; ; i++) { >> print('pass ' + i); >> new Thing(1, 2); >> } >> >> >> -------------------------------------------------------------------------------- >> >> There is some random behavior here. It will fail if you run the loop >> for some number of iterations, usually around 1000-2000 on my system. >> The problem doesn't seem to be reproducible without strict mode. >> >> Here is the minimal embedded V8 that i'm using: >> >> ------------------------------------ 8< >> ------------------------------------- >> >> #include <v8.h> >> #include <cstdio> >> #include <fstream> >> >> using namespace v8; >> >> std::string load_script(const char *filename) >> { >> std::ifstream t(filename); >> std::string str; >> >> t.seekg(0, std::ios::end); >> str.reserve(t.tellg()); >> t.seekg(0, std::ios::beg); >> >> str.assign((std::istreambuf_iterator<char>(t)), >> std::istreambuf_iterator<char>()); >> return str; >> } >> >> static Handle<Value> print_callback(const Arguments& args) >> { >> HandleScope handle_scope; >> Local<Value> arg = args[0]; >> String::Utf8Value value(arg); >> printf("%s\n", *value); >> return Undefined(); >> } >> >> int main(int argc, char* argv[]) { >> HandleScope handle_scope; >> Handle<ObjectTemplate> global = ObjectTemplate::New(); >> global->Set(String::New("print"), >> FunctionTemplate::New(print_callback)); >> >> Persistent<Context> context = Context::New(NULL, global); >> >> Context::Scope context_scope(context); >> Handle<String> source = >> String::New(load_script("test.js").c_str()); >> >> Handle<Script> script = Script::Compile(source); >> Handle<Value> result = script->Run(); >> >> context.Dispose(); >> >> String::AsciiValue ascii(result); >> printf("%s\n", *ascii); >> return 0; >> } >> >> >> -------------------------------------------------------------------------------- >> >> I've built the latest stable version of V8 on Illumos with some minor >> SConstruct customizations from node.js. >> >> Has anyone seen this issue before? Can you help me investigate whether >> it's reproducible on other systems? >> >> Thanks, >> Henry >> >> -- >> v8-users mailing list >> [email protected] >> http://groups.google.com/group/v8-users >> > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
