Commit f953e7fc authored by yangguo@chromium.org's avatar yangguo@chromium.org

Fix windows build.

Review URL: http://codereview.chromium.org/8983014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10328 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0f8be1f9
...@@ -15732,29 +15732,30 @@ uint8_t callback_fired = 0; ...@@ -15732,29 +15732,30 @@ uint8_t callback_fired = 0;
void CallCompletedCallback1() { void CallCompletedCallback1() {
printf("Firing callback 1.\n"); i::OS::Print("Firing callback 1.\n");
callback_fired ^= 1; // Toggle first bit. callback_fired ^= 1; // Toggle first bit.
} }
void CallCompletedCallback2() { void CallCompletedCallback2() {
printf("Firing callback 2.\n"); i::OS::Print("Firing callback 2.\n");
callback_fired ^= 2; // Toggle second bit. callback_fired ^= 2; // Toggle second bit.
} }
Handle<Value> RecursiveCall(const Arguments& args) { Handle<Value> RecursiveCall(const Arguments& args) {
uint32_t level = args[0]->Uint32Value(); int32_t level = args[0]->Int32Value();
if (level < 3) { if (level < 3) {
level++; level++;
printf("Entering recursion level %d.\n", level); i::OS::Print("Entering recursion level %d.\n", level);
char script[64]; char script[64];
snprintf(script, sizeof(script), "recursion(%d)", level); i::Vector<char> script_vector(script, sizeof(script));
CompileRun(script); i::OS::SNPrintF(script_vector, "recursion(%d)", level);
printf("Leaving recursion level %d.\n", level); CompileRun(script_vector.start());
i::OS::Print("Leaving recursion level %d.\n", level);
CHECK_EQ(0, callback_fired); CHECK_EQ(0, callback_fired);
} else { } else {
printf("Recursion ends.\n"); i::OS::Print("Recursion ends.\n");
CHECK_EQ(0, callback_fired); CHECK_EQ(0, callback_fired);
} }
return Undefined(); return Undefined();
...@@ -15772,19 +15773,19 @@ TEST(CallCompletedCallback) { ...@@ -15772,19 +15773,19 @@ TEST(CallCompletedCallback) {
v8::V8::AddCallCompletedCallback(CallCompletedCallback1); v8::V8::AddCallCompletedCallback(CallCompletedCallback1);
v8::V8::AddCallCompletedCallback(CallCompletedCallback1); v8::V8::AddCallCompletedCallback(CallCompletedCallback1);
v8::V8::AddCallCompletedCallback(CallCompletedCallback2); v8::V8::AddCallCompletedCallback(CallCompletedCallback2);
printf("--- Script (1) ---\n"); i::OS::Print("--- Script (1) ---\n");
Local<Script> script = Local<Script> script =
v8::Script::Compile(v8::String::New("recursion(0)")); v8::Script::Compile(v8::String::New("recursion(0)"));
script->Run(); script->Run();
CHECK_EQ(3, callback_fired); CHECK_EQ(3, callback_fired);
printf("\n--- Script (2) ---\n"); i::OS::Print("\n--- Script (2) ---\n");
callback_fired = 0; callback_fired = 0;
v8::V8::RemoveCallCompletedCallback(CallCompletedCallback1); v8::V8::RemoveCallCompletedCallback(CallCompletedCallback1);
script->Run(); script->Run();
CHECK_EQ(2, callback_fired); CHECK_EQ(2, callback_fired);
printf("\n--- Function ---\n"); i::OS::Print("\n--- Function ---\n");
callback_fired = 0; callback_fired = 0;
Local<Function> recursive_function = Local<Function> recursive_function =
Local<Function>::Cast(env->Global()->Get(v8_str("recursion"))); Local<Function>::Cast(env->Global()->Get(v8_str("recursion")));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment