Index: src/runtime.cc |
=================================================================== |
--- src/runtime.cc (revision 11040) |
+++ src/runtime.cc (working copy) |
@@ -12268,6 +12268,25 @@ |
} |
+// Patches script source (should be called upon BeforeCompile event). |
+RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugSetScriptSource) { |
+ HandleScope scope(isolate); |
+ ASSERT(args.length() == 2); |
+ |
+ CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0); |
+ Handle<String> source(String::cast(args[1])); |
+ |
+ RUNTIME_ASSERT(script_wrapper->value()->IsScript()); |
+ Handle<Script> script(Script::cast(script_wrapper->value())); |
+ |
+ int compilation_state = Smi::cast(script->compilation_state())->value(); |
+ if (compilation_state == Script::COMPILATION_STATE_INITIAL) |
+ script->set_source(*source); |
Yang
2012/03/14 14:14:20
Not sure if silent failure is the best thing to do
|
+ |
+ return isolate->heap()->undefined_value(); |
+} |
+ |
+ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_SystemBreak) { |
ASSERT(args.length() == 0); |
CPU::DebugBreak(); |