• Home
  • Raw
  • Download

Lines Matching refs:v8

48 v8::Handle<v8::Context> CreateShellContext(v8::Isolate* isolate);
49 void RunShell(v8::Handle<v8::Context> context);
50 int RunMain(v8::Isolate* isolate, int argc, char* argv[]);
51 bool ExecuteString(v8::Isolate* isolate,
52 v8::Handle<v8::String> source,
53 v8::Handle<v8::Value> name,
56 void Print(const v8::FunctionCallbackInfo<v8::Value>& args);
57 void Read(const v8::FunctionCallbackInfo<v8::Value>& args);
58 void Load(const v8::FunctionCallbackInfo<v8::Value>& args);
59 void Quit(const v8::FunctionCallbackInfo<v8::Value>& args);
60 void Version(const v8::FunctionCallbackInfo<v8::Value>& args);
61 v8::Handle<v8::String> ReadFile(v8::Isolate* isolate, const char* name);
62 void ReportException(v8::Isolate* isolate, v8::TryCatch* handler);
69 v8::V8::InitializeICU(); in main()
70 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); in main()
71 v8::Isolate* isolate = v8::Isolate::GetCurrent(); in main()
75 v8::HandleScope handle_scope(isolate); in main()
76 v8::Handle<v8::Context> context = CreateShellContext(isolate); in main()
86 v8::V8::Dispose(); in main()
92 const char* ToCString(const v8::String::Utf8Value& value) { in ToCString()
99 v8::Handle<v8::Context> CreateShellContext(v8::Isolate* isolate) { in CreateShellContext()
101 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); in CreateShellContext()
103 global->Set(v8::String::NewFromUtf8(isolate, "print"), in CreateShellContext()
104 v8::FunctionTemplate::New(Print)); in CreateShellContext()
106 global->Set(v8::String::NewFromUtf8(isolate, "read"), in CreateShellContext()
107 v8::FunctionTemplate::New(Read)); in CreateShellContext()
109 global->Set(v8::String::NewFromUtf8(isolate, "load"), in CreateShellContext()
110 v8::FunctionTemplate::New(Load)); in CreateShellContext()
112 global->Set(v8::String::NewFromUtf8(isolate, "quit"), in CreateShellContext()
113 v8::FunctionTemplate::New(Quit)); in CreateShellContext()
115 global->Set(v8::String::NewFromUtf8(isolate, "version"), in CreateShellContext()
116 v8::FunctionTemplate::New(Version)); in CreateShellContext()
118 return v8::Context::New(isolate, NULL, global); in CreateShellContext()
125 void Print(const v8::FunctionCallbackInfo<v8::Value>& args) { in Print()
128 v8::HandleScope handle_scope(args.GetIsolate()); in Print()
134 v8::String::Utf8Value str(args[i]); in Print()
146 void Read(const v8::FunctionCallbackInfo<v8::Value>& args) { in Read()
149 v8::String::NewFromUtf8(args.GetIsolate(), "Bad parameters")); in Read()
152 v8::String::Utf8Value file(args[0]); in Read()
155 v8::String::NewFromUtf8(args.GetIsolate(), "Error loading file")); in Read()
158 v8::Handle<v8::String> source = ReadFile(args.GetIsolate(), *file); in Read()
161 v8::String::NewFromUtf8(args.GetIsolate(), "Error loading file")); in Read()
171 void Load(const v8::FunctionCallbackInfo<v8::Value>& args) { in Load()
173 v8::HandleScope handle_scope(args.GetIsolate()); in Load()
174 v8::String::Utf8Value file(args[i]); in Load()
177 v8::String::NewFromUtf8(args.GetIsolate(), "Error loading file")); in Load()
180 v8::Handle<v8::String> source = ReadFile(args.GetIsolate(), *file); in Load()
183 v8::String::NewFromUtf8(args.GetIsolate(), "Error loading file")); in Load()
188 v8::String::NewFromUtf8(args.GetIsolate(), *file), in Load()
192 v8::String::NewFromUtf8(args.GetIsolate(), "Error executing file")); in Load()
201 void Quit(const v8::FunctionCallbackInfo<v8::Value>& args) { in Quit()
211 void Version(const v8::FunctionCallbackInfo<v8::Value>& args) { in Version()
213 v8::String::NewFromUtf8(args.GetIsolate(), v8::V8::GetVersion())); in Version()
218 v8::Handle<v8::String> ReadFile(v8::Isolate* isolate, const char* name) { in ReadFile()
220 if (file == NULL) return v8::Handle<v8::String>(); in ReadFile()
233 v8::Handle<v8::String> result = in ReadFile()
234 v8::String::NewFromUtf8(isolate, chars, v8::String::kNormalString, size); in ReadFile()
241 int RunMain(v8::Isolate* isolate, int argc, char* argv[]) { in RunMain()
255 v8::Handle<v8::String> file_name = in RunMain()
256 v8::String::NewFromUtf8(isolate, "unnamed"); in RunMain()
257 v8::Handle<v8::String> source = in RunMain()
258 v8::String::NewFromUtf8(isolate, argv[++i]); in RunMain()
262 v8::Handle<v8::String> file_name = v8::String::NewFromUtf8(isolate, str); in RunMain()
263 v8::Handle<v8::String> source = ReadFile(isolate, str); in RunMain()
276 void RunShell(v8::Handle<v8::Context> context) { in RunShell()
277 fprintf(stderr, "V8 version %s [sample shell]\n", v8::V8::GetVersion()); in RunShell()
280 v8::Context::Scope context_scope(context); in RunShell()
281 v8::Local<v8::String> name( in RunShell()
282 v8::String::NewFromUtf8(context->GetIsolate(), "(shell)")); in RunShell()
288 v8::HandleScope handle_scope(context->GetIsolate()); in RunShell()
290 v8::String::NewFromUtf8(context->GetIsolate(), str), in RunShell()
300 bool ExecuteString(v8::Isolate* isolate, in ExecuteString()
301 v8::Handle<v8::String> source, in ExecuteString()
302 v8::Handle<v8::Value> name, in ExecuteString()
305 v8::HandleScope handle_scope(isolate); in ExecuteString()
306 v8::TryCatch try_catch; in ExecuteString()
307 v8::Handle<v8::Script> script = v8::Script::Compile(source, name); in ExecuteString()
314 v8::Handle<v8::Value> result = script->Run(); in ExecuteString()
326 v8::String::Utf8Value str(result); in ExecuteString()
336 void ReportException(v8::Isolate* isolate, v8::TryCatch* try_catch) { in ReportException()
337 v8::HandleScope handle_scope(isolate); in ReportException()
338 v8::String::Utf8Value exception(try_catch->Exception()); in ReportException()
340 v8::Handle<v8::Message> message = try_catch->Message(); in ReportException()
347 v8::String::Utf8Value filename(message->GetScriptResourceName()); in ReportException()
352 v8::String::Utf8Value sourceline(message->GetSourceLine()); in ReportException()
365 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); in ReportException()