| OLD | NEW | 
|     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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   595   TokenizingLineArrayCompareOutput output(line_ends1, line_ends2, s1, s2); |   595   TokenizingLineArrayCompareOutput output(line_ends1, line_ends2, s1, s2); | 
|   596  |   596  | 
|   597   NarrowDownInput(&input, &output); |   597   NarrowDownInput(&input, &output); | 
|   598  |   598  | 
|   599   Comparator::CalculateDifference(&input, &output); |   599   Comparator::CalculateDifference(&input, &output); | 
|   600  |   600  | 
|   601   return output.GetResult(); |   601   return output.GetResult(); | 
|   602 } |   602 } | 
|   603  |   603  | 
|   604  |   604  | 
|   605 static void CompileScriptForTracker(Isolate* isolate, Handle<Script> script) { |  | 
|   606   // TODO(635): support extensions. |  | 
|   607   PostponeInterruptsScope postpone(isolate); |  | 
|   608  |  | 
|   609   // Build AST. |  | 
|   610   CompilationInfoWithZone info(script); |  | 
|   611   info.MarkAsGlobal(); |  | 
|   612   // Parse and don't allow skipping lazy functions. |  | 
|   613   if (Parser::Parse(&info)) { |  | 
|   614     // Compile the code. |  | 
|   615     LiveEditFunctionTracker tracker(info.isolate(), info.function()); |  | 
|   616     if (Compiler::MakeCodeForLiveEdit(&info)) { |  | 
|   617       ASSERT(!info.code().is_null()); |  | 
|   618       tracker.RecordRootFunctionInfo(info.code()); |  | 
|   619     } else { |  | 
|   620       info.isolate()->StackOverflow(); |  | 
|   621     } |  | 
|   622   } |  | 
|   623 } |  | 
|   624  |  | 
|   625  |  | 
|   626 // Unwraps JSValue object, returning its field "value" |   605 // Unwraps JSValue object, returning its field "value" | 
|   627 static Handle<Object> UnwrapJSValue(Handle<JSValue> jsValue) { |   606 static Handle<Object> UnwrapJSValue(Handle<JSValue> jsValue) { | 
|   628   return Handle<Object>(jsValue->value(), jsValue->GetIsolate()); |   607   return Handle<Object>(jsValue->value(), jsValue->GetIsolate()); | 
|   629 } |   608 } | 
|   630  |   609  | 
|   631  |   610  | 
|   632 // Wraps any object into a OpaqueReference, that will hide the object |   611 // Wraps any object into a OpaqueReference, that will hide the object | 
|   633 // from JavaScript. |   612 // from JavaScript. | 
|   634 static Handle<JSValue> WrapInJSValue(Handle<HeapObject> object) { |   613 static Handle<JSValue> WrapInJSValue(Handle<HeapObject> object) { | 
|   635   Isolate* isolate = object->GetIsolate(); |   614   Isolate* isolate = object->GetIsolate(); | 
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   944   script->set_source(*source); |   923   script->set_source(*source); | 
|   945   isolate->set_active_function_info_listener(&listener); |   924   isolate->set_active_function_info_listener(&listener); | 
|   946  |   925  | 
|   947   { |   926   { | 
|   948     // Creating verbose TryCatch from public API is currently the only way to |   927     // Creating verbose TryCatch from public API is currently the only way to | 
|   949     // force code save location. We do not use this the object directly. |   928     // force code save location. We do not use this the object directly. | 
|   950     v8::TryCatch try_catch; |   929     v8::TryCatch try_catch; | 
|   951     try_catch.SetVerbose(true); |   930     try_catch.SetVerbose(true); | 
|   952  |   931  | 
|   953     // A logical 'try' section. |   932     // A logical 'try' section. | 
|   954     CompileScriptForTracker(isolate, script); |   933     Compiler::CompileForLiveEdit(script); | 
|   955   } |   934   } | 
|   956  |   935  | 
|   957   // A logical 'catch' section. |   936   // A logical 'catch' section. | 
|   958   Handle<JSObject> rethrow_exception; |   937   Handle<JSObject> rethrow_exception; | 
|   959   if (isolate->has_pending_exception()) { |   938   if (isolate->has_pending_exception()) { | 
|   960     Handle<Object> exception(isolate->pending_exception()->ToObjectChecked(), |   939     Handle<Object> exception(isolate->pending_exception()->ToObjectChecked(), | 
|   961                              isolate); |   940                              isolate); | 
|   962     MessageLocation message_location = isolate->GetMessageLocation(); |   941     MessageLocation message_location = isolate->GetMessageLocation(); | 
|   963  |   942  | 
|   964     isolate->clear_pending_message(); |   943     isolate->clear_pending_message(); | 
| (...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2152  |  2131  | 
|  2153 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |  2132 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 
|  2154   return false; |  2133   return false; | 
|  2155 } |  2134 } | 
|  2156  |  2135  | 
|  2157 #endif  // ENABLE_DEBUGGER_SUPPORT |  2136 #endif  // ENABLE_DEBUGGER_SUPPORT | 
|  2158  |  2137  | 
|  2159  |  2138  | 
|  2160  |  2139  | 
|  2161 } }  // namespace v8::internal |  2140 } }  // namespace v8::internal | 
| OLD | NEW |