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

Side by Side Diff: src/d8.cc

Issue 7851011: Functions in d8 to turn the profiler on/off (enableProfiler() and disableProfiler()). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 int n = static_cast<int>(fwrite(*str, sizeof(**str), str.length(), stdout)); 203 int n = static_cast<int>(fwrite(*str, sizeof(**str), str.length(), stdout));
204 if (n != str.length()) { 204 if (n != str.length()) {
205 printf("Error in fwrite\n"); 205 printf("Error in fwrite\n");
206 exit(1); 206 exit(1);
207 } 207 }
208 } 208 }
209 return Undefined(); 209 return Undefined();
210 } 210 }
211 211
212 212
213 Handle<Value> Shell::EnableProfiler(const Arguments& args) {
214 V8::ResumeProfiler();
215 return Undefined();
216 }
217
218
219 Handle<Value> Shell::DisableProfiler(const Arguments& args) {
220 V8::PauseProfiler();
221 return Undefined();
222 }
223
224
213 Handle<Value> Shell::Read(const Arguments& args) { 225 Handle<Value> Shell::Read(const Arguments& args) {
214 String::Utf8Value file(args[0]); 226 String::Utf8Value file(args[0]);
215 if (*file == NULL) { 227 if (*file == NULL) {
216 return ThrowException(String::New("Error loading file")); 228 return ThrowException(String::New("Error loading file"));
217 } 229 }
218 Handle<String> source = ReadFile(*file); 230 Handle<String> source = ReadFile(*file);
219 if (source.IsEmpty()) { 231 if (source.IsEmpty()) {
220 return ThrowException(String::New("Error loading file")); 232 return ThrowException(String::New("Error loading file"));
221 } 233 }
222 return source; 234 return source;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 Handle<ObjectTemplate> Shell::CreateGlobalTemplate() { 661 Handle<ObjectTemplate> Shell::CreateGlobalTemplate() {
650 Handle<ObjectTemplate> global_template = ObjectTemplate::New(); 662 Handle<ObjectTemplate> global_template = ObjectTemplate::New();
651 global_template->Set(String::New("print"), FunctionTemplate::New(Print)); 663 global_template->Set(String::New("print"), FunctionTemplate::New(Print));
652 global_template->Set(String::New("write"), FunctionTemplate::New(Write)); 664 global_template->Set(String::New("write"), FunctionTemplate::New(Write));
653 global_template->Set(String::New("read"), FunctionTemplate::New(Read)); 665 global_template->Set(String::New("read"), FunctionTemplate::New(Read));
654 global_template->Set(String::New("readline"), 666 global_template->Set(String::New("readline"),
655 FunctionTemplate::New(ReadLine)); 667 FunctionTemplate::New(ReadLine));
656 global_template->Set(String::New("load"), FunctionTemplate::New(Load)); 668 global_template->Set(String::New("load"), FunctionTemplate::New(Load));
657 global_template->Set(String::New("quit"), FunctionTemplate::New(Quit)); 669 global_template->Set(String::New("quit"), FunctionTemplate::New(Quit));
658 global_template->Set(String::New("version"), FunctionTemplate::New(Version)); 670 global_template->Set(String::New("version"), FunctionTemplate::New(Version));
671 if (i::FLAG_prof) {
672 global_template->Set(String::New("enableProfiler"),
673 FunctionTemplate::New(EnableProfiler));
674 global_template->Set(String::New("disableProfiler"),
675 FunctionTemplate::New(DisableProfiler));
676 }
659 677
660 // Bind the handlers for external arrays. 678 // Bind the handlers for external arrays.
661 global_template->Set(String::New("Int8Array"), 679 global_template->Set(String::New("Int8Array"),
662 FunctionTemplate::New(Int8Array)); 680 FunctionTemplate::New(Int8Array));
663 global_template->Set(String::New("Uint8Array"), 681 global_template->Set(String::New("Uint8Array"),
664 FunctionTemplate::New(Uint8Array)); 682 FunctionTemplate::New(Uint8Array));
665 global_template->Set(String::New("Int16Array"), 683 global_template->Set(String::New("Int16Array"),
666 FunctionTemplate::New(Int16Array)); 684 FunctionTemplate::New(Int16Array));
667 global_template->Set(String::New("Uint16Array"), 685 global_template->Set(String::New("Uint16Array"),
668 FunctionTemplate::New(Uint16Array)); 686 FunctionTemplate::New(Uint16Array));
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 } 1316 }
1299 1317
1300 } // namespace v8 1318 } // namespace v8
1301 1319
1302 1320
1303 #ifndef GOOGLE3 1321 #ifndef GOOGLE3
1304 int main(int argc, char* argv[]) { 1322 int main(int argc, char* argv[]) {
1305 return v8::Shell::Main(argc, argv); 1323 return v8::Shell::Main(argc, argv);
1306 } 1324 }
1307 #endif 1325 #endif
OLDNEW
« no previous file with comments | « src/d8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698