Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/d8.cc

Issue 40290: Experimental: Merge 1395:1441 from bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/d8.h ('k') | src/d8.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 Context::Scope context_scope(utility_context_); 225 Context::Scope context_scope(utility_context_);
226 Handle<Object> global = utility_context_->Global(); 226 Handle<Object> global = utility_context_->Global();
227 Handle<Value> fun = global->Get(String::New("GetCompletions")); 227 Handle<Value> fun = global->Get(String::New("GetCompletions"));
228 static const int kArgc = 3; 228 static const int kArgc = 3;
229 Handle<Value> argv[kArgc] = { evaluation_context_->Global(), text, full }; 229 Handle<Value> argv[kArgc] = { evaluation_context_->Global(), text, full };
230 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); 230 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
231 return handle_scope.Close(Handle<Array>::Cast(val)); 231 return handle_scope.Close(Handle<Array>::Cast(val));
232 } 232 }
233 233
234 234
235 Handle<String> Shell::DebugEventToText(Handle<String> event) { 235 Handle<Object> Shell::DebugMessageDetails(Handle<String> message) {
236 HandleScope handle_scope;
237 Context::Scope context_scope(utility_context_); 236 Context::Scope context_scope(utility_context_);
238 Handle<Object> global = utility_context_->Global(); 237 Handle<Object> global = utility_context_->Global();
239 Handle<Value> fun = global->Get(String::New("DebugEventToText")); 238 Handle<Value> fun = global->Get(String::New("DebugMessageDetails"));
240 TryCatch try_catch;
241 try_catch.SetVerbose(true);
242 static const int kArgc = 1; 239 static const int kArgc = 1;
243 Handle<Value> argv[kArgc] = { event }; 240 Handle<Value> argv[kArgc] = { message };
244 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); 241 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
245 if (try_catch.HasCaught()) { 242 return Handle<Object>::Cast(val);
246 return handle_scope.Close(try_catch.Exception()->ToString());
247 } else {
248 return handle_scope.Close(Handle<String>::Cast(val));
249 }
250 } 243 }
251 244
252 245
253 Handle<Value> Shell::DebugCommandToJSONRequest(Handle<String> command) { 246 Handle<Value> Shell::DebugCommandToJSONRequest(Handle<String> command) {
254 Context::Scope context_scope(utility_context_); 247 Context::Scope context_scope(utility_context_);
255 Handle<Object> global = utility_context_->Global(); 248 Handle<Object> global = utility_context_->Global();
256 Handle<Value> fun = global->Get(String::New("DebugCommandToJSONRequest")); 249 Handle<Value> fun = global->Get(String::New("DebugCommandToJSONRequest"));
257 static const int kArgc = 1; 250 static const int kArgc = 1;
258 Handle<Value> argv[kArgc] = { command }; 251 Handle<Value> argv[kArgc] = { command };
259 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); 252 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
260 return val; 253 return val;
261 } 254 }
262 255
263 256
264 Handle<Object> Shell::DebugResponseDetails(Handle<String> response) {
265 Context::Scope context_scope(utility_context_);
266 Handle<Object> global = utility_context_->Global();
267 Handle<Value> fun = global->Get(String::New("DebugResponseDetails"));
268 static const int kArgc = 1;
269 Handle<Value> argv[kArgc] = { response };
270 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
271 return Handle<Object>::Cast(val);
272 }
273
274
275 int32_t* Counter::Bind(const char* name) { 257 int32_t* Counter::Bind(const char* name) {
276 int i; 258 int i;
277 for (i = 0; i < kMaxNameSize - 1 && name[i]; i++) 259 for (i = 0; i < kMaxNameSize - 1 && name[i]; i++)
278 name_[i] = static_cast<char>(name[i]); 260 name_[i] = static_cast<char>(name[i]);
279 name_[i] = '\0'; 261 name_[i] = '\0';
280 return &counter_; 262 return &counter_;
281 } 263 }
282 264
283 265
284 CounterCollection::CounterCollection() { 266 CounterCollection::CounterCollection() {
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 Handle<String> file_name = v8::String::New(str); 566 Handle<String> file_name = v8::String::New(str);
585 Handle<String> source = ReadFile(str); 567 Handle<String> source = ReadFile(str);
586 if (source.IsEmpty()) { 568 if (source.IsEmpty()) {
587 printf("Error reading '%s'\n", str); 569 printf("Error reading '%s'\n", str);
588 return 1; 570 return 1;
589 } 571 }
590 if (!ExecuteString(source, file_name, false, true)) 572 if (!ExecuteString(source, file_name, false, true))
591 return 1; 573 return 1;
592 } 574 }
593 } 575 }
594 if (i::FLAG_debugger) 576
577 // Run the remote debugger if requested.
578 if (i::FLAG_remote_debugger) {
579 RunRemoteDebugger(i::FLAG_debugger_port);
580 return 0;
581 }
582
583 // Start the debugger agent if requested.
584 if (i::FLAG_debugger_agent) {
585 v8::Debug::EnableAgent(i::FLAG_debugger_port);
586 }
587
588 // Start the in-process debugger if requested.
589 if (i::FLAG_debugger && !i::FLAG_debugger_agent) {
595 v8::Debug::SetDebugEventListener(HandleDebugEvent); 590 v8::Debug::SetDebugEventListener(HandleDebugEvent);
591 }
596 } 592 }
597 if (run_shell) 593 if (run_shell)
598 RunShell(); 594 RunShell();
599 for (int i = 0; i < threads.length(); i++) { 595 for (int i = 0; i < threads.length(); i++) {
600 i::Thread *thread = threads[i]; 596 i::Thread *thread = threads[i];
601 thread->Join(); 597 thread->Join();
602 delete thread; 598 delete thread;
603 } 599 }
604 OnExit(); 600 OnExit();
605 return 0; 601 return 0;
606 } 602 }
607 603
608 604
609 } // namespace v8 605 } // namespace v8
610 606
611 607
612 int main(int argc, char* argv[]) { 608 int main(int argc, char* argv[]) {
613 return v8::Shell::Main(argc, argv); 609 return v8::Shell::Main(argc, argv);
614 } 610 }
OLDNEW
« no previous file with comments | « src/d8.h ('k') | src/d8.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698