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

Side by Side Diff: src/d8.cc

Issue 10693: Merged bleeding_edge -r 685:746 into regexp2000. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 years, 1 month 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-readline.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:eol-style
+ native
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 Handle<ObjectTemplate> global_template = ObjectTemplate::New(); 228 Handle<ObjectTemplate> global_template = ObjectTemplate::New();
229 global_template->Set(String::New("print"), FunctionTemplate::New(Print)); 229 global_template->Set(String::New("print"), FunctionTemplate::New(Print));
230 global_template->Set(String::New("load"), FunctionTemplate::New(Load)); 230 global_template->Set(String::New("load"), FunctionTemplate::New(Load));
231 global_template->Set(String::New("quit"), FunctionTemplate::New(Quit)); 231 global_template->Set(String::New("quit"), FunctionTemplate::New(Quit));
232 global_template->Set(String::New("version"), FunctionTemplate::New(Version)); 232 global_template->Set(String::New("version"), FunctionTemplate::New(Version));
233 233
234 utility_context_ = Context::New(NULL, global_template); 234 utility_context_ = Context::New(NULL, global_template);
235 utility_context_->SetSecurityToken(Undefined()); 235 utility_context_->SetSecurityToken(Undefined());
236 Context::Scope utility_scope(utility_context_); 236 Context::Scope utility_scope(utility_context_);
237 237
238 i::JSArguments js_args = i::FLAG_js_arguments;
239 i::Handle<i::FixedArray> arguments_array =
240 i::Factory::NewFixedArray(js_args.argc());
241 for (int j = 0; j < js_args.argc(); j++) {
242 i::Handle<i::String> arg =
243 i::Factory::NewStringFromUtf8(i::CStrVector(js_args[j]));
244 arguments_array->set(j, *arg);
245 }
246 i::Handle<i::JSArray> arguments_jsarray =
247 i::Factory::NewJSArrayWithElements(arguments_array);
248 global_template->Set(String::New("arguments"),
249 Utils::ToLocal(arguments_jsarray));
250
238 // Install the debugger object in the utility scope 251 // Install the debugger object in the utility scope
239 i::Debug::Load(); 252 i::Debug::Load();
240 i::Debug::debug_context()->set_security_token(i::Heap::undefined_value()); 253 i::Debug::debug_context()->set_security_token(i::Heap::undefined_value());
241 i::JSObject* debug = i::Debug::debug_context()->global(); 254 i::JSObject* debug = i::Debug::debug_context()->global();
242 utility_context_->Global()->Set(String::New("$debug"), 255 utility_context_->Global()->Set(String::New("$debug"),
243 Utils::ToLocal(&debug)); 256 Utils::ToLocal(&debug));
244 257
245 // Run the d8 shell utility script in the utility context 258 // Run the d8 shell utility script in the utility context
246 int source_index = i::NativesCollection<i::D8>::GetIndex("d8"); 259 int source_index = i::NativesCollection<i::D8>::GetIndex("d8");
247 i::Vector<const char> shell_source 260 i::Vector<const char> shell_source
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 Handle<String> name = String::New("(d8)"); 324 Handle<String> name = String::New("(d8)");
312 ExecuteString(String::New(*input), name, true, true); 325 ExecuteString(String::New(*input), name, true, true);
313 } 326 }
314 editor->Close(); 327 editor->Close();
315 printf("\n"); 328 printf("\n");
316 } 329 }
317 330
318 331
319 int Shell::Main(int argc, char* argv[]) { 332 int Shell::Main(int argc, char* argv[]) {
320 i::FlagList::SetFlagsFromCommandLine(&argc, argv, true); 333 i::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
334 if (i::FLAG_help) {
335 return 1;
336 }
321 Initialize(); 337 Initialize();
322 bool run_shell = (argc == 1); 338 bool run_shell = (argc == 1);
323 Context::Scope context_scope(evaluation_context_); 339 Context::Scope context_scope(evaluation_context_);
324 for (int i = 1; i < argc; i++) { 340 for (int i = 1; i < argc; i++) {
325 char* str = argv[i]; 341 char* str = argv[i];
326 HandleScope handle_scope; 342 HandleScope handle_scope;
327 Handle<String> file_name = v8::String::New(str); 343 Handle<String> file_name = v8::String::New(str);
328 Handle<String> source = ReadFile(str); 344 Handle<String> source = ReadFile(str);
329 if (source.IsEmpty()) { 345 if (source.IsEmpty()) {
330 printf("Error reading '%s'\n", str); 346 printf("Error reading '%s'\n", str);
331 return 1; 347 return 1;
332 } 348 }
333 if (!ExecuteString(source, file_name, false, true)) 349 if (!ExecuteString(source, file_name, false, true))
334 return 1; 350 return 1;
335 } 351 }
336 if (run_shell) 352 if (run_shell)
337 RunShell(); 353 RunShell();
338 OnExit(); 354 OnExit();
339 return 0; 355 return 0;
340 } 356 }
341 357
342 358
343 } // namespace v8 359 } // namespace v8
344 360
345 361
346 int main(int argc, char* argv[]) { 362 int main(int argc, char* argv[]) {
347 return v8::Shell::Main(argc, argv); 363 return v8::Shell::Main(argc, argv);
348 } 364 }
OLDNEW
« no previous file with comments | « src/d8.h ('k') | src/d8-readline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698