| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 v8::internal::Semaphore* semaphore = NULL; | 33 v8::internal::Semaphore* semaphore = NULL; |
| 34 | 34 |
| 35 | 35 |
| 36 void Signal(const v8::FunctionCallbackInfo<v8::Value>& args) { | 36 void Signal(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 37 semaphore->Signal(); | 37 semaphore->Signal(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 | 40 |
| 41 void TerminateCurrentThread(const v8::FunctionCallbackInfo<v8::Value>& args) { | 41 void TerminateCurrentThread(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 42 CHECK(!v8::V8::IsExecutionTerminating()); | 42 CHECK(!v8::V8::IsExecutionTerminating()); |
| 43 v8::V8::TerminateExecution(); | 43 v8::V8::TerminateExecution(args.GetIsolate()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 | 46 |
| 47 void Fail(const v8::FunctionCallbackInfo<v8::Value>& args) { | 47 void Fail(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 48 CHECK(false); | 48 CHECK(false); |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 void Loop(const v8::FunctionCallbackInfo<v8::Value>& args) { | 52 void Loop(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 53 CHECK(!v8::V8::IsExecutionTerminating()); | 53 CHECK(!v8::V8::IsExecutionTerminating()); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 CHECK(try_catch.HasCaught()); | 224 CHECK(try_catch.HasCaught()); |
| 225 CHECK(try_catch.Exception()->IsNull()); | 225 CHECK(try_catch.Exception()->IsNull()); |
| 226 CHECK(try_catch.Message().IsEmpty()); | 226 CHECK(try_catch.Message().IsEmpty()); |
| 227 CHECK(!try_catch.CanContinue()); | 227 CHECK(!try_catch.CanContinue()); |
| 228 CHECK(v8::V8::IsExecutionTerminating()); | 228 CHECK(v8::V8::IsExecutionTerminating()); |
| 229 } | 229 } |
| 230 | 230 |
| 231 | 231 |
| 232 // Test that we correctly handle termination exceptions if they are | 232 // Test that we correctly handle termination exceptions if they are |
| 233 // triggered by the creation of error objects in connection with ICs. | 233 // triggered by the creation of error objects in connection with ICs. |
| 234 TEST(TerminateLoadICException) { | 234 UNINITIALIZED_TEST(TerminateLoadICException) { |
| 235 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 235 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 236 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); | 236 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); |
| 237 global->Set(v8::String::New("terminate_or_return_object"), | 237 global->Set(v8::String::New("terminate_or_return_object"), |
| 238 v8::FunctionTemplate::New(TerminateOrReturnObject)); | 238 v8::FunctionTemplate::New(TerminateOrReturnObject)); |
| 239 global->Set(v8::String::New("fail"), v8::FunctionTemplate::New(Fail)); | 239 global->Set(v8::String::New("fail"), v8::FunctionTemplate::New(Fail)); |
| 240 global->Set(v8::String::New("loop"), | 240 global->Set(v8::String::New("loop"), |
| 241 v8::FunctionTemplate::New(LoopGetProperty)); | 241 v8::FunctionTemplate::New(LoopGetProperty)); |
| 242 | 242 |
| 243 v8::Handle<v8::Context> context = | 243 v8::Handle<v8::Context> context = |
| 244 v8::Context::New(v8::Isolate::GetCurrent(), NULL, global); | 244 v8::Context::New(v8::Isolate::GetCurrent(), NULL, global); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 v8::Handle<v8::ObjectTemplate> global = | 329 v8::Handle<v8::ObjectTemplate> global = |
| 330 CreateGlobalTemplate(TerminateCurrentThread, DoLoopCancelTerminate); | 330 CreateGlobalTemplate(TerminateCurrentThread, DoLoopCancelTerminate); |
| 331 v8::Handle<v8::Context> context = v8::Context::New(isolate, NULL, global); | 331 v8::Handle<v8::Context> context = v8::Context::New(isolate, NULL, global); |
| 332 v8::Context::Scope context_scope(context); | 332 v8::Context::Scope context_scope(context); |
| 333 CHECK(!v8::V8::IsExecutionTerminating()); | 333 CHECK(!v8::V8::IsExecutionTerminating()); |
| 334 v8::Handle<v8::String> source = | 334 v8::Handle<v8::String> source = |
| 335 v8::String::New("try { doloop(); } catch(e) { fail(); } 'completed';"); | 335 v8::String::New("try { doloop(); } catch(e) { fail(); } 'completed';"); |
| 336 // Check that execution completed with correct return value. | 336 // Check that execution completed with correct return value. |
| 337 CHECK(v8::Script::Compile(source)->Run()->Equals(v8_str("completed"))); | 337 CHECK(v8::Script::Compile(source)->Run()->Equals(v8_str("completed"))); |
| 338 } | 338 } |
| OLD | NEW |