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

Side by Side Diff: src/liveedit.cc

Issue 11421100: Issue 2429, core implementation and the protocol change (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: follow codereview Created 8 years 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/isolate.cc ('k') | src/liveedit-debugger.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 18 matching lines...) Expand all
29 #include "v8.h" 29 #include "v8.h"
30 30
31 #include "liveedit.h" 31 #include "liveedit.h"
32 32
33 #include "code-stubs.h" 33 #include "code-stubs.h"
34 #include "compilation-cache.h" 34 #include "compilation-cache.h"
35 #include "compiler.h" 35 #include "compiler.h"
36 #include "debug.h" 36 #include "debug.h"
37 #include "deoptimizer.h" 37 #include "deoptimizer.h"
38 #include "global-handles.h" 38 #include "global-handles.h"
39 #include "messages.h"
39 #include "parser.h" 40 #include "parser.h"
40 #include "scopeinfo.h" 41 #include "scopeinfo.h"
41 #include "scopes.h" 42 #include "scopes.h"
42 #include "v8memory.h" 43 #include "v8memory.h"
43 44
44 namespace v8 { 45 namespace v8 {
45 namespace internal { 46 namespace internal {
46 47
47 48
48 #ifdef ENABLE_DEBUGGER_SUPPORT 49 #ifdef ENABLE_DEBUGGER_SUPPORT
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 919
919 920
920 JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script, 921 JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
921 Handle<String> source) { 922 Handle<String> source) {
922 Isolate* isolate = Isolate::Current(); 923 Isolate* isolate = Isolate::Current();
923 924
924 FunctionInfoListener listener; 925 FunctionInfoListener listener;
925 Handle<Object> original_source = Handle<Object>(script->source()); 926 Handle<Object> original_source = Handle<Object>(script->source());
926 script->set_source(*source); 927 script->set_source(*source);
927 isolate->set_active_function_info_listener(&listener); 928 isolate->set_active_function_info_listener(&listener);
928 CompileScriptForTracker(isolate, script); 929
930 {
931 // Creating verbose TryCatch from public API is currently the only way to
932 // force code save location. We do not use this the object directly.
933 v8::TryCatch try_catch;
934 try_catch.SetVerbose(true);
935
936 // A logical 'try' section.
937 CompileScriptForTracker(isolate, script);
938 }
939
940 // A logical 'catch' section.
941 Handle<Object> rethrow_exception;
942 if (isolate->has_pending_exception()) {
943 Handle<Object> exception(isolate->pending_exception()->ToObjectChecked());
944 MessageLocation message_location = isolate->GetMessageLocation();
945
946 isolate->clear_pending_message();
947 isolate->clear_pending_exception();
948
949 // If possible, copy positions from message object to exception object.
950 if (exception->IsJSObject() && !message_location.script().is_null()) {
951 Handle<JSObject> exception_struct = Handle<JSObject>::cast(exception);
952
953 Factory* factory = isolate->factory();
954 JSReceiver::SetProperty(exception_struct,
955 factory->LookupAsciiSymbol("startPosition"),
Michael Starzinger 2012/12/04 09:51:05 This pattern is not GC safe. Other handles might h
956 Handle<Smi>(Smi::FromInt(message_location.start_pos())),
957 NONE, kNonStrictMode);
958 JSReceiver::SetProperty(exception_struct,
959 factory->LookupAsciiSymbol("endPosition"),
Michael Starzinger 2012/12/04 09:51:05 Likewise.
960 Handle<Smi>(Smi::FromInt(message_location.end_pos())),
961 NONE, kNonStrictMode);
962 JSReceiver::SetProperty(exception_struct,
963 factory->LookupAsciiSymbol("scriptObject"),
Michael Starzinger 2012/12/04 09:51:05 Likewise.
964 GetScriptWrapper(message_location.script()),
965 NONE, kNonStrictMode);
966 }
967
968 rethrow_exception = exception;
969 }
970
971 // A logical 'finally' section.
929 isolate->set_active_function_info_listener(NULL); 972 isolate->set_active_function_info_listener(NULL);
930 script->set_source(*original_source); 973 script->set_source(*original_source);
931 974
932 return *(listener.GetResult()); 975 if (rethrow_exception.is_null()) {
976 return *(listener.GetResult());
977 } else {
978 isolate->Throw(*rethrow_exception);
979 return 0;
980 }
933 } 981 }
934 982
935 983
936 void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) { 984 void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) {
937 HandleScope scope; 985 HandleScope scope;
938 int len = GetArrayLength(array); 986 int len = GetArrayLength(array);
939 for (int i = 0; i < len; i++) { 987 for (int i = 0; i < len; i++) {
940 Handle<SharedFunctionInfo> info( 988 Handle<SharedFunctionInfo> info(
941 SharedFunctionInfo::cast(array->GetElementNoExceptionThrown(i))); 989 SharedFunctionInfo::cast(array->GetElementNoExceptionThrown(i)));
942 SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(); 990 SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create();
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 2104
2057 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2105 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2058 return false; 2106 return false;
2059 } 2107 }
2060 2108
2061 #endif // ENABLE_DEBUGGER_SUPPORT 2109 #endif // ENABLE_DEBUGGER_SUPPORT
2062 2110
2063 2111
2064 2112
2065 } } // namespace v8::internal 2113 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/liveedit-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698