Home | History | Annotate | Download | only in cctest

Lines Matching refs:v8

1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
12 #include "v8.h"
21 using v8::internal::Address;
22 using v8::internal::EmbeddedVector;
23 using v8::internal::Logger;
24 using v8::internal::StrLength;
40 env_(v8::Context::New()) {
54 v8::Handle<v8::Context>& env() { return env_; }
80 v8::HandleScope scope_;
81 v8::Handle<v8::Context> env_;
102 if (!i::V8::UseCrankshaft()) return;
107 v8::V8::ResumeProfiler();
113 v8::V8::PauseProfiler();
118 v8::V8::ResumeProfiler();
124 v8::V8::PauseProfiler();
167 class LoopingThread : public v8::internal::Thread {
169 explicit LoopingThread(v8::internal::Isolate* isolate)
170 : v8::internal::Thread(isolate),
171 semaphore_(v8::internal::OS::CreateSemaphore(0)),
194 v8_thread_id_ = v8::V8::GetCurrentThreadId();
200 v8::internal::Semaphore* semaphore_;
209 explicit LoopingJsThread(v8::internal::Isolate* isolate)
212 v8::Locker locker;
217 v8::HandleScope scope;
218 v8::Persistent<v8::Context> context = v8::Context::New();
221 v8::Context::Scope context_scope(context);
235 explicit LoopingNonJsThread(v8::internal::Isolate* isolate)
238 v8::Locker locker;
239 v8::Unlocker unlocker;
240 // Now thread has V8's id, but will not run VM code.
253 class TestSampler : public v8::internal::Sampler {
255 explicit TestSampler(v8::internal::Isolate* isolate)
257 semaphore_(v8::internal::OS::CreateSemaphore(0)),
263 void SampleStack(v8::internal::TickSample*) {
267 void Tick(v8::internal::TickSample*) { semaphore_->Signal(); }
276 v8::internal::Semaphore* semaphore_;
286 v8::Locker locker;
287 sampler = new TestSampler(v8::internal::Isolate::Current());
292 LoopingJsThread jsThread(v8::internal::Isolate::Current());
294 LoopingNonJsThread nonJsThread(v8::internal::Isolate::Current());
326 class SimpleExternalString : public v8::String::ExternalStringResource {
343 v8::HandleScope scope;
344 v8::Handle<v8::Context> env = v8::Context::New();
348 v8::Local<v8::String> source = v8::String::NewExternal(&source_ext_str);
350 v8::Handle<v8::String> origin = v8::String::New("issue-23768-test");
351 v8::Handle<v8::Script> evil_script = v8::Script::Compile(source, origin);
355 i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source)));
365 static v8::Handle<v8::Value> ObjMethod1(const v8::Arguments& args) {
366 return v8::Handle<v8::Value>();
372 v8::Persistent<v8::FunctionTemplate> obj =
373 v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
375 v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate();
376 v8::Local<v8::Signature> signature = v8::Signature::New(obj);
378 v8::FunctionTemplate::New(ObjMethod1,
379 v8::Handle<v8::Value>(),
381 static_cast<v8::PropertyAttribute>(v8::DontDelete));
404 static v8::Handle<v8::Value> Prop1Getter(v8::Local<v8::String> property,
405 const v8::AccessorInfo& info) {
406 return v8::Handle<v8::Value>();
409 static void Prop1Setter(v8::Local<v8::String> property,
410 v8::Local<v8::Value> value,
411 const v8::AccessorInfo& info) {
414 static v8::Handle<v8::Value> Prop2Getter(v8::Local<v8::String> property,
415 const v8::AccessorInfo& info) {
416 return v8::Handle<v8::Value>();
422 v8::Persistent<v8::FunctionTemplate> obj =
423 v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
425 v8::Handle<v8::ObjectTemplate> inst = obj->InstanceTemplate();
478 // This test needs to be run on a "clean" V8 to ensure that snapshot log
482 // are using V8.
484 // P.S. No, V8 can't be re-initialized after disposal, see include/v8.h.
485 CHECK(!i::V8::IsRunning());
496 v8::V8::PauseProfiler();
508 v8::Handle<v8::String> log_str = v8::String::New(log.start(), log.length());
512 v8::Handle<v8::String> source_str = v8::String::New(
514 v8::TryCatch try_catch;
515 v8::Handle<v8::Script> script = v8::Script::Compile(source_str, v8_str(""));
517 v8::String::Utf8Value exception(try_catch.Exception());
521 v8::Handle<v8::Value> result = script->Run();
523 v8::String::Utf8Value exception(try_catch.Exception());
529 v8::Local<v8::String> s = result->ToString();