Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | |
| 2 | |
| 3 // 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.
| |
| 4 // StringInputBuffer. Check that Get(int) works on very deep stacks | |
| 5 // of ConsStrings. These operations may not be very fast, but they | |
| 6 // should be possible without getting errors due to too deep recursion. | |
| 7 | |
| 8 #include "v8.h" | |
| 9 | |
| 10 #include "platform.h" | |
| 11 | |
| 12 #include "cctest.h" | |
| 13 | |
| 14 | |
| 15 TEST(Preemption) { | |
| 16 v8::Locker locker; | |
| 17 v8::V8::Initialize(); | |
| 18 v8::HandleScope scope; | |
| 19 v8::Context::Scope context_scope(v8::Context::New()); | |
| 20 | |
| 21 v8::Locker::StartPreemption(100); | |
| 22 | |
| 23 v8::Handle<v8::Script> script = v8::Script::Compile( | |
| 24 v8::String::New("var count = 0; var obj = new Object(); count++;\n")); | |
| 25 | |
| 26 script->Run(); | |
| 27 | |
| 28 v8::Locker::StopPreemption(); | |
| 29 v8::internal::OS::Sleep(500); // Make sure the timer fires. | |
| 30 | |
| 31 script->Run(); | |
| 32 } | |
| 33 | |
| 34 | |
| OLD | NEW |