OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 = i::NativesCollection<i::D8>::GetScriptName(source_index); | 460 = i::NativesCollection<i::D8>::GetScriptName(source_index); |
461 Handle<String> source = String::New(shell_source.start(), | 461 Handle<String> source = String::New(shell_source.start(), |
462 shell_source.length()); | 462 shell_source.length()); |
463 Handle<String> name = String::New(shell_source_name.start(), | 463 Handle<String> name = String::New(shell_source_name.start(), |
464 shell_source_name.length()); | 464 shell_source_name.length()); |
465 Handle<Script> script = Script::Compile(source, name); | 465 Handle<Script> script = Script::Compile(source, name); |
466 script->Run(); | 466 script->Run(); |
467 | 467 |
468 // Mark the d8 shell script as native to avoid it showing up as normal source | 468 // Mark the d8 shell script as native to avoid it showing up as normal source |
469 // in the debugger. | 469 // in the debugger. |
470 i::Handle<i::JSFunction> script_fun = Utils::OpenHandle(*script); | 470 i::Handle<i::Object> compiled_script = Utils::OpenHandle(*script); |
471 i::Handle<i::Script> script_object = | 471 i::Handle<i::Script> script_object = compiled_script->IsJSFunction() |
472 i::Handle<i::Script>(i::Script::cast(script_fun->shared()->script())); | 472 ? i::Handle<i::Script>(i::Script::cast( |
| 473 i::JSFunction::cast(*compiled_script)->shared()->script())) |
| 474 : i::Handle<i::Script>(i::Script::cast( |
| 475 i::SharedFunctionInfo::cast(*compiled_script)->script())); |
473 script_object->set_type(i::Smi::FromInt(i::Script::TYPE_NATIVE)); | 476 script_object->set_type(i::Smi::FromInt(i::Script::TYPE_NATIVE)); |
474 | 477 |
475 // Create the evaluation context | 478 // Create the evaluation context |
476 evaluation_context_ = Context::New(NULL, global_template); | 479 evaluation_context_ = Context::New(NULL, global_template); |
477 evaluation_context_->SetSecurityToken(Undefined()); | 480 evaluation_context_->SetSecurityToken(Undefined()); |
478 | 481 |
479 #ifdef ENABLE_DEBUGGER_SUPPORT | 482 #ifdef ENABLE_DEBUGGER_SUPPORT |
480 // Set the security token of the debug context to allow access. | 483 // Set the security token of the debug context to allow access. |
481 i::Debug::debug_context()->set_security_token(i::Heap::undefined_value()); | 484 i::Debug::debug_context()->set_security_token(i::Heap::undefined_value()); |
482 | 485 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 return 0; | 770 return 0; |
768 } | 771 } |
769 | 772 |
770 | 773 |
771 } // namespace v8 | 774 } // namespace v8 |
772 | 775 |
773 | 776 |
774 int main(int argc, char* argv[]) { | 777 int main(int argc, char* argv[]) { |
775 return v8::Shell::Main(argc, argv); | 778 return v8::Shell::Main(argc, argv); |
776 } | 779 } |
OLD | NEW |