Lines Matching refs:v8
108 const char* ToCString(const v8::String::Utf8Value& value);
109 void ReportException(v8::TryCatch* handler);
110 v8::Handle<v8::String> ReadFile(const char* name);
111 v8::Handle<v8::String> ReadLine();
113 v8::Handle<v8::Value> Print(const v8::Arguments& args);
114 v8::Handle<v8::Value> ReadLine(const v8::Arguments& args);
115 bool RunCppCycle(v8::Handle<v8::Script> script, v8::Local<v8::Context> context,
120 v8::Persistent<v8::Context> debug_message_context;
134 v8::Context::Scope scope(debug_message_context); in DispatchDebugMessages()
136 v8::Debug::ProcessDebugMessages(); in DispatchDebugMessages()
142 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); in RunMain()
143 v8::HandleScope handle_scope; in RunMain()
145 v8::Handle<v8::String> script_source(NULL); in RunMain()
146 v8::Handle<v8::Value> script_name(NULL); in RunMain()
179 script_source = v8::String::New(argv[i + 1]); in RunMain()
180 script_name = v8::String::New("unnamed"); in RunMain()
186 script_name = v8::String::New(str); in RunMain()
205 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); in RunMain()
208 global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print)); in RunMain()
212 global->Set(v8::String::New("read_line"), in RunMain()
213 v8::FunctionTemplate::New(ReadLine)); in RunMain()
218 v8::Handle<v8::Context> context = v8::Context::New(NULL, global); in RunMain()
220 v8::Context::Scope context_scope(context); in RunMain()
223 debug_message_context = v8::Persistent<v8::Context>::New(context); in RunMain()
225 v8::Locker locker; in RunMain()
228 v8::Debug::SetDebugMessageDispatchHandler(DispatchDebugMessages, true); in RunMain()
232 v8::Debug::EnableAgent("lineprocessor", port_number, wait_for_connection); in RunMain()
238 v8::Handle<v8::Script> script; in RunMain()
241 v8::TryCatch try_catch; in RunMain()
242 script = v8::Script::Compile(script_source, script_name); in RunMain()
252 v8::TryCatch try_catch; in RunMain()
263 bool res = RunCppCycle(script, v8::Context::GetCurrent(), in RunMain()
273 bool RunCppCycle(v8::Handle<v8::Script> script, v8::Local<v8::Context> context, in RunCppCycle()
276 v8::Locker lock; in RunCppCycle()
279 v8::Handle<v8::String> fun_name = v8::String::New("ProcessLine"); in RunCppCycle()
280 v8::Handle<v8::Value> process_val = in RunCppCycle()
281 v8::Context::GetCurrent()->Global()->Get(fun_name); in RunCppCycle()
291 v8::Handle<v8::Function> process_fun = in RunCppCycle()
292 v8::Handle<v8::Function>::Cast(process_val); in RunCppCycle()
296 v8::HandleScope handle_scope; in RunCppCycle()
298 v8::Handle<v8::String> input_line = ReadLine(); in RunCppCycle()
299 if (input_line == v8::Undefined()) { in RunCppCycle()
304 v8::Handle<v8::Value> argv[argc] = { input_line }; in RunCppCycle()
306 v8::Handle<v8::Value> result; in RunCppCycle()
308 v8::TryCatch try_catch; in RunCppCycle()
309 result = process_fun->Call(v8::Context::GetCurrent()->Global(), in RunCppCycle()
317 v8::String::Utf8Value str(result); in RunCppCycle()
327 v8::V8::Dispose(); in main()
333 const char* ToCString(const v8::String::Utf8Value& value) { in ToCString()
339 v8::Handle<v8::String> ReadFile(const char* name) { in ReadFile()
341 if (file == NULL) return v8::Handle<v8::String>(); in ReadFile()
354 v8::Handle<v8::String> result = v8::String::New(chars, size); in ReadFile()
360 void ReportException(v8::TryCatch* try_catch) { in ReportException()
361 v8::HandleScope handle_scope; in ReportException()
362 v8::String::Utf8Value exception(try_catch->Exception()); in ReportException()
364 v8::Handle<v8::Message> message = try_catch->Message(); in ReportException()
371 v8::String::Utf8Value filename(message->GetScriptResourceName()); in ReportException()
376 v8::String::Utf8Value sourceline(message->GetSourceLine()); in ReportException()
396 v8::Handle<v8::Value> Print(const v8::Arguments& args) { in Print()
399 v8::HandleScope handle_scope; in Print()
405 v8::String::Utf8Value str(args[i]); in Print()
411 return v8::Undefined(); in Print()
417 v8::Handle<v8::Value> ReadLine(const v8::Arguments& args) { in ReadLine()
419 return v8::ThrowException(v8::String::New("Unexpected arguments")); in ReadLine()
424 v8::Handle<v8::String> ReadLine() { in ReadLine()
431 v8::Unlocker unlocker; in ReadLine()
436 v8::Handle<v8::Primitive> t = v8::Undefined(); in ReadLine()
437 return reinterpret_cast<v8::Handle<v8::String>&>(t); in ReadLine()
446 return v8::String::New(buffer); in ReadLine()