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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 CHECK(try_catch.Message().IsEmpty()); | 98 CHECK(try_catch.Message().IsEmpty()); |
99 CHECK(!try_catch.CanContinue()); | 99 CHECK(!try_catch.CanContinue()); |
100 CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate())); | 100 CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate())); |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 v8::Handle<v8::ObjectTemplate> CreateGlobalTemplate( | 104 v8::Handle<v8::ObjectTemplate> CreateGlobalTemplate( |
105 v8::Isolate* isolate, | 105 v8::Isolate* isolate, |
106 v8::FunctionCallback terminate, | 106 v8::FunctionCallback terminate, |
107 v8::FunctionCallback doloop) { | 107 v8::FunctionCallback doloop) { |
108 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); | 108 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); |
109 global->Set(v8::String::NewFromUtf8(isolate, "terminate"), | 109 global->Set(v8::String::NewFromUtf8(isolate, "terminate"), |
110 v8::FunctionTemplate::New(isolate, terminate)); | 110 v8::FunctionTemplate::New(isolate, terminate)); |
111 global->Set(v8::String::NewFromUtf8(isolate, "fail"), | 111 global->Set(v8::String::NewFromUtf8(isolate, "fail"), |
112 v8::FunctionTemplate::New(isolate, Fail)); | 112 v8::FunctionTemplate::New(isolate, Fail)); |
113 global->Set(v8::String::NewFromUtf8(isolate, "loop"), | 113 global->Set(v8::String::NewFromUtf8(isolate, "loop"), |
114 v8::FunctionTemplate::New(isolate, Loop)); | 114 v8::FunctionTemplate::New(isolate, Loop)); |
115 global->Set(v8::String::NewFromUtf8(isolate, "doloop"), | 115 global->Set(v8::String::NewFromUtf8(isolate, "doloop"), |
116 v8::FunctionTemplate::New(isolate, doloop)); | 116 v8::FunctionTemplate::New(isolate, doloop)); |
117 return global; | 117 return global; |
118 } | 118 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 CHECK(!try_catch.CanContinue()); | 237 CHECK(!try_catch.CanContinue()); |
238 CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate())); | 238 CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate())); |
239 } | 239 } |
240 | 240 |
241 | 241 |
242 // Test that we correctly handle termination exceptions if they are | 242 // Test that we correctly handle termination exceptions if they are |
243 // triggered by the creation of error objects in connection with ICs. | 243 // triggered by the creation of error objects in connection with ICs. |
244 TEST(TerminateLoadICException) { | 244 TEST(TerminateLoadICException) { |
245 v8::Isolate* isolate = CcTest::isolate(); | 245 v8::Isolate* isolate = CcTest::isolate(); |
246 v8::HandleScope scope(isolate); | 246 v8::HandleScope scope(isolate); |
247 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); | 247 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); |
248 global->Set( | 248 global->Set( |
249 v8::String::NewFromUtf8(isolate, "terminate_or_return_object"), | 249 v8::String::NewFromUtf8(isolate, "terminate_or_return_object"), |
250 v8::FunctionTemplate::New(isolate, TerminateOrReturnObject)); | 250 v8::FunctionTemplate::New(isolate, TerminateOrReturnObject)); |
251 global->Set(v8::String::NewFromUtf8(isolate, "fail"), | 251 global->Set(v8::String::NewFromUtf8(isolate, "fail"), |
252 v8::FunctionTemplate::New(isolate, Fail)); | 252 v8::FunctionTemplate::New(isolate, Fail)); |
253 global->Set(v8::String::NewFromUtf8(isolate, "loop"), | 253 global->Set(v8::String::NewFromUtf8(isolate, "loop"), |
254 v8::FunctionTemplate::New(isolate, LoopGetProperty)); | 254 v8::FunctionTemplate::New(isolate, LoopGetProperty)); |
255 | 255 |
256 v8::Handle<v8::Context> context = | 256 v8::Handle<v8::Context> context = |
257 v8::Context::New(isolate, NULL, global); | 257 v8::Context::New(isolate, NULL, global); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate( | 351 v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate( |
352 isolate, TerminateCurrentThread, DoLoopCancelTerminate); | 352 isolate, TerminateCurrentThread, DoLoopCancelTerminate); |
353 v8::Handle<v8::Context> context = v8::Context::New(isolate, NULL, global); | 353 v8::Handle<v8::Context> context = v8::Context::New(isolate, NULL, global); |
354 v8::Context::Scope context_scope(context); | 354 v8::Context::Scope context_scope(context); |
355 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate())); | 355 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate())); |
356 v8::Handle<v8::String> source = v8::String::NewFromUtf8( | 356 v8::Handle<v8::String> source = v8::String::NewFromUtf8( |
357 isolate, "try { doloop(); } catch(e) { fail(); } 'completed';"); | 357 isolate, "try { doloop(); } catch(e) { fail(); } 'completed';"); |
358 // Check that execution completed with correct return value. | 358 // Check that execution completed with correct return value. |
359 CHECK(v8::Script::Compile(source)->Run()->Equals(v8_str("completed"))); | 359 CHECK(v8::Script::Compile(source)->Run()->Equals(v8_str("completed"))); |
360 } | 360 } |
OLD | NEW |