Home | History | Annotate | Download | only in cctest

Lines Matching refs:V8

1 // Copyright 2009 the V8 project authors. All rights reserved.
28 #include "v8.h"
33 v8::internal::Semaphore* semaphore = NULL;
36 void Signal(const v8::FunctionCallbackInfo<v8::Value>& args) {
41 void TerminateCurrentThread(const v8::FunctionCallbackInfo<v8::Value>& args) {
42 CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
43 v8::V8::TerminateExecution(args.GetIsolate());
47 void Fail(const v8::FunctionCallbackInfo<v8::Value>& args) {
52 void Loop(const v8::FunctionCallbackInfo<v8::Value>& args) {
53 CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
54 v8::Handle<v8::String> source = v8::String::NewFromUtf8(
56 v8::Handle<v8::Value> result = v8::Script::Compile(source)->Run();
58 CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
62 void DoLoop(const v8::FunctionCallbackInfo<v8::Value>& args) {
63 v8::TryCatch try_catch;
64 CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
65 v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
83 CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
87 void DoLoopNoCall(const v8::FunctionCallbackInfo<v8::Value>& args) {
88 v8::TryCatch try_catch;
89 CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
90 v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
100 CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
104 v8::Handle<v8::ObjectTemplate> CreateGlobalTemplate(
105 v8::Isolate* isolate,
106 v8::FunctionCallback terminate,
107 v8::FunctionCallback doloop) {
108 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
109 global->Set(v8::String::NewFromUtf8(isolate, "terminate"),
110 v8::FunctionTemplate::New(terminate));
111 global->Set(v8::String::NewFromUtf8(isolate, "fail"),
112 v8::FunctionTemplate::New(Fail));
113 global->Set(v8::String::NewFromUtf8(isolate, "loop"),
114 v8::FunctionTemplate::New(Loop));
115 global->Set(v8::String::NewFromUtf8(isolate, "doloop"),
116 v8::FunctionTemplate::New(doloop));
124 v8::HandleScope scope(CcTest::isolate());
125 v8::Handle<v8::ObjectTemplate> global =
127 v8::Handle<v8::Context> context =
128 v8::Context::New(CcTest::isolate(), NULL, global);
129 v8::Context::Scope context_scope(context);
130 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
132 v8::Handle<v8::String> source = v8::String::NewFromUtf8(
134 v8::Script::Compile(source)->Run();
136 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
137 v8::Script::Compile(source)->Run();
144 v8::HandleScope scope(CcTest::isolate());
145 v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(
147 v8::Handle<v8::Context> context =
148 v8::Context::New(CcTest::isolate(), NULL, global);
149 v8::Context::Scope context_scope(context);
150 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
152 v8::Handle<v8::String> source = v8::String::NewFromUtf8(
154 v8::Script::Compile(source)->Run();
155 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
157 v8::Script::Compile(source)->Run();
161 class TerminatorThread : public v8::internal::Thread {
165 isolate_(reinterpret_cast<v8::Isolate*>(isolate)) { }
168 CHECK(!v8::V8::IsExecutionTerminating(isolate_));
169 v8::V8::TerminateExecution(isolate_);
173 v8::Isolate* isolate_;
180 semaphore = new v8::internal::Semaphore(0);
184 v8::HandleScope scope(CcTest::isolate());
185 v8::Handle<v8::ObjectTemplate> global =
187 v8::Handle<v8::Context> context =
188 v8::Context::New(CcTest::isolate(), NULL, global);
189 v8::Context::Scope context_scope(context);
190 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
192 v8::Handle<v8::String> source = v8::String::NewFromUtf8(
194 v8::Script::Compile(source)->Run();
205 void TerminateOrReturnObject(const v8::FunctionCallbackInfo<v8::Value>& args) {
207 CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
208 v8::V8::TerminateExecution(args.GetIsolate());
211 v8::Local<v8::Object> result = v8::Object::New();
212 result->Set(v8::String::NewFromUtf8(args.GetIsolate(), "x"),
213 v8::Integer::New(42));
218 void LoopGetProperty(const v8::FunctionCallbackInfo<v8::Value>& args) {
219 v8::TryCatch try_catch;
220 CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
221 v8::Script::Compile(
222 v8::String::NewFromUtf8(args.GetIsolate(),
238 CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
245 v8::HandleScope scope(CcTest::isolate());
246 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
248 v8::String::NewFromUtf8(CcTest::isolate(), "terminate_or_return_object"),
249 v8::FunctionTemplate::New(TerminateOrReturnObject));
250 global->Set(v8::String::NewFromUtf8(CcTest::isolate(), "fail"),
251 v8::FunctionTemplate::New(Fail));
252 global->Set(v8::String::NewFromUtf8(CcTest::isolate(), "loop"),
253 v8::FunctionTemplate::New(LoopGetProperty));
255 v8::Handle<v8::Context> context =
256 v8::Context::New(CcTest::isolate(), NULL, global);
257 v8::Context::Scope context_scope(context);
258 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
260 v8::Handle<v8::String> source = v8::String::NewFromUtf8(
263 v8::Script::Compile(source)->Run();
265 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
267 v8::Script::Compile(source)->Run();
271 void ReenterAfterTermination(const v8::FunctionCallbackInfo<v8::Value>& args) {
272 v8::TryCatch try_catch;
273 CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
274 v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
292 CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
293 v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
299 // Test that reentry into V8 while the termination exception is still pending
302 v8::HandleScope scope(CcTest::isolate());
303 v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(
305 v8::Handle<v8::Context> context =
306 v8::Context::New(CcTest::isolate(), NULL, global);
307 v8::Context::Scope context_scope(context);
308 CHECK(!v8::V8::IsExecutionTerminating());
309 v8::Handle<v8::String> source = v8::String::NewFromUtf8(
311 v8::Script::Compile(source)->Run();
312 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
314 CHECK(v8::Script::Compile(
315 v8::String::NewFromUtf8(CcTest::isolate(),
323 void DoLoopCancelTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
324 v8::TryCatch try_catch;
325 CHECK(!v8::V8::IsExecutionTerminating());
326 v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
337 CHECK(v8::V8::IsExecutionTerminating());
339 v8::V8::CancelTerminateExecution(CcTest::isolate());
340 CHECK(!v8::V8::IsExecutionTerminating());
347 v8::Isolate* isolate = CcTest::isolate();
348 v8::HandleScope scope(isolate);
349 v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(
351 v8::Handle<v8::Context> context = v8::Context::New(isolate, NULL, global);
352 v8::Context::Scope context_scope(context);
353 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
354 v8::Handle<v8::String> source = v8::String::NewFromUtf8(
357 CHECK(v8::Script::Compile(source)->Run()->Equals(v8_str("completed")));