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

Side by Side Diff: src/runtime.cc

Issue 9677043: Debugger: add ability to set script source from within OnBeforeCompile. (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 9 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 | « src/runtime.h ('k') | test/mjsunit/debug-set-script-source.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 12250 matching lines...) Expand 10 before | Expand all | Expand 10 after
12261 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPrototype) { 12261 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPrototype) {
12262 ASSERT(args.length() == 1); 12262 ASSERT(args.length() == 1);
12263 12263
12264 CONVERT_ARG_CHECKED(JSObject, obj, 0); 12264 CONVERT_ARG_CHECKED(JSObject, obj, 0);
12265 12265
12266 // Use the __proto__ accessor. 12266 // Use the __proto__ accessor.
12267 return Accessors::ObjectPrototype.getter(obj, NULL); 12267 return Accessors::ObjectPrototype.getter(obj, NULL);
12268 } 12268 }
12269 12269
12270 12270
12271 // Patches script source (should be called upon BeforeCompile event).
12272 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugSetScriptSource) {
12273 HandleScope scope(isolate);
12274 ASSERT(args.length() == 2);
12275
12276 CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0);
12277 Handle<String> source(String::cast(args[1]));
12278
12279 RUNTIME_ASSERT(script_wrapper->value()->IsScript());
12280 Handle<Script> script(Script::cast(script_wrapper->value()));
12281
12282 int compilation_state = Smi::cast(script->compilation_state())->value();
12283 if (compilation_state == Script::COMPILATION_STATE_INITIAL)
12284 script->set_source(*source);
Yang 2012/03/14 14:14:20 Not sure if silent failure is the best thing to do
12285
12286 return isolate->heap()->undefined_value();
12287 }
12288
12289
12271 RUNTIME_FUNCTION(MaybeObject*, Runtime_SystemBreak) { 12290 RUNTIME_FUNCTION(MaybeObject*, Runtime_SystemBreak) {
12272 ASSERT(args.length() == 0); 12291 ASSERT(args.length() == 0);
12273 CPU::DebugBreak(); 12292 CPU::DebugBreak();
12274 return isolate->heap()->undefined_value(); 12293 return isolate->heap()->undefined_value();
12275 } 12294 }
12276 12295
12277 12296
12278 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) { 12297 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugDisassembleFunction) {
12279 #ifdef DEBUG 12298 #ifdef DEBUG
12280 HandleScope scope(isolate); 12299 HandleScope scope(isolate);
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
13332 // Handle last resort GC and make sure to allow future allocations 13351 // Handle last resort GC and make sure to allow future allocations
13333 // to grow the heap without causing GCs (if possible). 13352 // to grow the heap without causing GCs (if possible).
13334 isolate->counters()->gc_last_resort_from_js()->Increment(); 13353 isolate->counters()->gc_last_resort_from_js()->Increment();
13335 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13354 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13336 "Runtime::PerformGC"); 13355 "Runtime::PerformGC");
13337 } 13356 }
13338 } 13357 }
13339 13358
13340 13359
13341 } } // namespace v8::internal 13360 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/debug-set-script-source.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698