| OLD | NEW | 
|---|
| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 344   // Run the d8 shell utility script in the utility context | 344   // Run the d8 shell utility script in the utility context | 
| 345   int source_index = i::NativesCollection<i::D8>::GetIndex("d8"); | 345   int source_index = i::NativesCollection<i::D8>::GetIndex("d8"); | 
| 346   i::Vector<const char> shell_source | 346   i::Vector<const char> shell_source | 
| 347       = i::NativesCollection<i::D8>::GetScriptSource(source_index); | 347       = i::NativesCollection<i::D8>::GetScriptSource(source_index); | 
| 348   i::Vector<const char> shell_source_name | 348   i::Vector<const char> shell_source_name | 
| 349       = i::NativesCollection<i::D8>::GetScriptName(source_index); | 349       = i::NativesCollection<i::D8>::GetScriptName(source_index); | 
| 350   Handle<String> source = String::New(shell_source.start(), | 350   Handle<String> source = String::New(shell_source.start(), | 
| 351                                       shell_source.length()); | 351                                       shell_source.length()); | 
| 352   Handle<String> name = String::New(shell_source_name.start(), | 352   Handle<String> name = String::New(shell_source_name.start(), | 
| 353                                     shell_source_name.length()); | 353                                     shell_source_name.length()); | 
| 354   Script::Compile(source, name)->Run(); | 354   Handle<Script> script = Script::Compile(source, name); | 
|  | 355   script->Run(); | 
|  | 356 | 
|  | 357   // Mark the d8 shell script as native to avoid it showing up as normal source | 
|  | 358   // in the debugger. | 
|  | 359   i::Handle<i::JSFunction> script_fun = Utils::OpenHandle(*script); | 
|  | 360   i::Handle<i::Script> script_object = | 
|  | 361       i::Handle<i::Script>(i::Script::cast(script_fun->shared()->script())); | 
|  | 362   script_object->set_type(i::Smi::FromInt(i::SCRIPT_TYPE_NATIVE)); | 
| 355 | 363 | 
| 356   // Create the evaluation context | 364   // Create the evaluation context | 
| 357   evaluation_context_ = Context::New(NULL, global_template); | 365   evaluation_context_ = Context::New(NULL, global_template); | 
| 358   evaluation_context_->SetSecurityToken(Undefined()); | 366   evaluation_context_->SetSecurityToken(Undefined()); | 
| 359 | 367 | 
| 360   // Set the security token of the debug context to allow access. | 368   // Set the security token of the debug context to allow access. | 
| 361   i::Debug::debug_context()->set_security_token(i::Heap::undefined_value()); | 369   i::Debug::debug_context()->set_security_token(i::Heap::undefined_value()); | 
| 362 } | 370 } | 
| 363 | 371 | 
| 364 | 372 | 
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 601   return 0; | 609   return 0; | 
| 602 } | 610 } | 
| 603 | 611 | 
| 604 | 612 | 
| 605 }  // namespace v8 | 613 }  // namespace v8 | 
| 606 | 614 | 
| 607 | 615 | 
| 608 int main(int argc, char* argv[]) { | 616 int main(int argc, char* argv[]) { | 
| 609   return v8::Shell::Main(argc, argv); | 617   return v8::Shell::Main(argc, argv); | 
| 610 } | 618 } | 
| OLD | NEW | 
|---|