Chromium Code Reviews| Index: test/cctest/test-threads.cc |
| =================================================================== |
| --- test/cctest/test-threads.cc (revision 0) |
| +++ test/cctest/test-threads.cc (revision 0) |
| @@ -0,0 +1,34 @@ |
| +// Copyright 2006-2008 the V8 project authors. All rights reserved. |
| + |
| +// Check that we can traverse very deep stacks of ConsStrings using |
|
Erik Corry
2008/12/17 14:30:07
Stale comment (should be replaced with copyright b
iposva
2008/12/17 17:39:24
Done.
|
| +// StringInputBuffer. Check that Get(int) works on very deep stacks |
| +// of ConsStrings. These operations may not be very fast, but they |
| +// should be possible without getting errors due to too deep recursion. |
| + |
| +#include "v8.h" |
| + |
| +#include "platform.h" |
| + |
| +#include "cctest.h" |
| + |
| + |
| +TEST(Preemption) { |
| + v8::Locker locker; |
| + v8::V8::Initialize(); |
| + v8::HandleScope scope; |
| + v8::Context::Scope context_scope(v8::Context::New()); |
| + |
| + v8::Locker::StartPreemption(100); |
| + |
| + v8::Handle<v8::Script> script = v8::Script::Compile( |
| + v8::String::New("var count = 0; var obj = new Object(); count++;\n")); |
| + |
| + script->Run(); |
| + |
| + v8::Locker::StopPreemption(); |
| + v8::internal::OS::Sleep(500); // Make sure the timer fires. |
| + |
| + script->Run(); |
| +} |
| + |
| + |