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

Side by Side Diff: src/runtime.cc

Issue 10837308: Add input check to %DebugSetScriptSource. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 | test/mjsunit/regress/regress-2296.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 12209 matching lines...) Expand 10 before | Expand all | Expand 10 after
12220 return Accessors::ObjectPrototype.getter(obj, NULL); 12220 return Accessors::ObjectPrototype.getter(obj, NULL);
12221 } 12221 }
12222 12222
12223 12223
12224 // Patches script source (should be called upon BeforeCompile event). 12224 // Patches script source (should be called upon BeforeCompile event).
12225 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugSetScriptSource) { 12225 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugSetScriptSource) {
12226 HandleScope scope(isolate); 12226 HandleScope scope(isolate);
12227 ASSERT(args.length() == 2); 12227 ASSERT(args.length() == 2);
12228 12228
12229 CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0); 12229 CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0);
12230 Handle<String> source(String::cast(args[1])); 12230 CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
12231 12231
12232 RUNTIME_ASSERT(script_wrapper->value()->IsScript()); 12232 RUNTIME_ASSERT(script_wrapper->value()->IsScript());
12233 Handle<Script> script(Script::cast(script_wrapper->value())); 12233 Handle<Script> script(Script::cast(script_wrapper->value()));
12234 12234
12235 int compilation_state = Smi::cast(script->compilation_state())->value(); 12235 int compilation_state = Smi::cast(script->compilation_state())->value();
12236 RUNTIME_ASSERT(compilation_state == Script::COMPILATION_STATE_INITIAL); 12236 RUNTIME_ASSERT(compilation_state == Script::COMPILATION_STATE_INITIAL);
12237 script->set_source(*source); 12237 script->set_source(*source);
12238 12238
12239 return isolate->heap()->undefined_value(); 12239 return isolate->heap()->undefined_value();
12240 } 12240 }
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
13347 // Handle last resort GC and make sure to allow future allocations 13347 // Handle last resort GC and make sure to allow future allocations
13348 // to grow the heap without causing GCs (if possible). 13348 // to grow the heap without causing GCs (if possible).
13349 isolate->counters()->gc_last_resort_from_js()->Increment(); 13349 isolate->counters()->gc_last_resort_from_js()->Increment();
13350 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13350 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13351 "Runtime::PerformGC"); 13351 "Runtime::PerformGC");
13352 } 13352 }
13353 } 13353 }
13354 13354
13355 13355
13356 } } // namespace v8::internal 13356 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2296.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698