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

Side by Side Diff: src/d8.cc

Issue 7189007: Reinitialize the arguments object in d8 when renewing the evaluation context (fixes issue 1477). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 6 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 | « no previous file | 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 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 HandleScope scope; 643 HandleScope scope;
644 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(); 644 Handle<ObjectTemplate> global_template = CreateGlobalTemplate();
645 645
646 // (Re-)create the evaluation context 646 // (Re-)create the evaluation context
647 if (!evaluation_context_.IsEmpty()) { 647 if (!evaluation_context_.IsEmpty()) {
648 evaluation_context_.Dispose(); 648 evaluation_context_.Dispose();
649 } 649 }
650 evaluation_context_ = Context::New(NULL, global_template); 650 evaluation_context_ = Context::New(NULL, global_template);
651 evaluation_context_->SetSecurityToken(Undefined()); 651 evaluation_context_->SetSecurityToken(Undefined());
652 652
653 Context::Scope utility_scope(utility_context_);
Søren Thygesen Gjesse 2011/06/16 08:22:20 Isn't this code now repeated twice (also in Shell:
Rico 2011/06/16 08:35:18 As discussed offline, the other place where this i
654 i::JSArguments js_args = i::FLAG_js_arguments;
655 i::Handle<i::FixedArray> arguments_array =
656 FACTORY->NewFixedArray(js_args.argc());
657 for (int j = 0; j < js_args.argc(); j++) {
658 i::Handle<i::String> arg =
659 FACTORY->NewStringFromUtf8(i::CStrVector(js_args[j]));
660 arguments_array->set(j, *arg);
661 }
662 i::Handle<i::JSArray> arguments_jsarray =
663 FACTORY->NewJSArrayWithElements(arguments_array);
664 evaluation_context_->Global()->Set(String::New("arguments"),
665 Utils::ToLocal(arguments_jsarray));
666
653 #ifdef ENABLE_DEBUGGER_SUPPORT 667 #ifdef ENABLE_DEBUGGER_SUPPORT
654 i::Debug* debug = i::Isolate::Current()->debug(); 668 i::Debug* debug = i::Isolate::Current()->debug();
655 debug->Load(); 669 debug->Load();
656 670
657 // Set the security token of the debug context to allow access. 671 // Set the security token of the debug context to allow access.
658 debug->debug_context()->set_security_token(HEAP->undefined_value()); 672 debug->debug_context()->set_security_token(HEAP->undefined_value());
659 673
660 // Start the debugger agent if requested. 674 // Start the debugger agent if requested.
661 if (i::FLAG_debugger_agent) { 675 if (i::FLAG_debugger_agent) {
662 v8::Debug::EnableAgent("d8 shell", i::FLAG_debugger_port, true); 676 v8::Debug::EnableAgent("d8 shell", i::FLAG_debugger_port, true);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 } 993 }
980 994
981 } // namespace v8 995 } // namespace v8
982 996
983 997
984 #ifndef GOOGLE3 998 #ifndef GOOGLE3
985 int main(int argc, char* argv[]) { 999 int main(int argc, char* argv[]) {
986 return v8::Shell::Main(argc, argv); 1000 return v8::Shell::Main(argc, argv);
987 } 1001 }
988 #endif 1002 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698