V8 Project
v8::internal::LiveEdit Class Reference

#include <liveedit.h>

+ Inheritance diagram for v8::internal::LiveEdit:
+ Collaboration diagram for v8::internal::LiveEdit:

Public Types

enum  FrameDropMode {
  FRAMES_UNTOUCHED , FRAME_DROPPED_IN_IC_CALL , FRAME_DROPPED_IN_DEBUG_SLOT_CALL , FRAME_DROPPED_IN_DIRECT_CALL ,
  FRAME_DROPPED_IN_RETURN_CALL , CURRENTLY_SET_MODE
}
 
enum  FunctionPatchabilityStatus {
  FUNCTION_AVAILABLE_FOR_PATCH = 1 , FUNCTION_BLOCKED_ON_ACTIVE_STACK = 2 , FUNCTION_BLOCKED_ON_OTHER_STACK = 3 , FUNCTION_BLOCKED_UNDER_NATIVE_CODE = 4 ,
  FUNCTION_REPLACED_ON_ACTIVE_STACK = 5 , FUNCTION_BLOCKED_UNDER_GENERATOR = 6 , FUNCTION_BLOCKED_ACTIVE_GENERATOR = 7
}
 

Static Public Member Functions

static void InitializeThreadLocal (Debug *debug)
 
static bool SetAfterBreakTarget (Debug *debug)
 
static MUST_USE_RESULT MaybeHandle< JSArrayGatherCompileInfo (Handle< Script > script, Handle< String > source)
 
static void WrapSharedFunctionInfos (Handle< JSArray > array)
 
static void ReplaceFunctionCode (Handle< JSArray > new_compile_info_array, Handle< JSArray > shared_info_array)
 
static void FunctionSourceUpdated (Handle< JSArray > shared_info_array)
 
static void SetFunctionScript (Handle< JSValue > function_wrapper, Handle< Object > script_handle)
 
static void PatchFunctionPositions (Handle< JSArray > shared_info_array, Handle< JSArray > position_change_array)
 
static Handle< ObjectChangeScriptSource (Handle< Script > original_script, Handle< String > new_source, Handle< Object > old_script_name)
 
static void ReplaceRefToNestedFunction (Handle< JSValue > parent_function_shared, Handle< JSValue > orig_function_shared, Handle< JSValue > subst_function_shared)
 
static bool FindActiveGenerators (Handle< FixedArray > shared_info_array, Handle< FixedArray > result, int len)
 
static Handle< JSArrayCheckAndDropActivations (Handle< JSArray > shared_info_array, bool do_drop)
 
static const char * RestartFrame (JavaScriptFrame *frame)
 
static Handle< JSArrayCompareStrings (Handle< String > s1, Handle< String > s2)
 

Static Public Attributes

static const bool kFrameDropperSupported
 
static const int kFrameDropperFrameSize = 4
 Defines layout of a stack frame that supports padding. More...
 
static const int kFramePaddingInitialSize = 1
 
static const int kFramePaddingValue = kFramePaddingInitialSize + 1
 

Detailed Description

Definition at line 59 of file liveedit.h.

Member Enumeration Documentation

◆ FrameDropMode

Enumerator
FRAMES_UNTOUCHED 
FRAME_DROPPED_IN_IC_CALL 
FRAME_DROPPED_IN_DEBUG_SLOT_CALL 
FRAME_DROPPED_IN_DIRECT_CALL 
FRAME_DROPPED_IN_RETURN_CALL 
CURRENTLY_SET_MODE 

Definition at line 62 of file liveedit.h.

62  {
63  // No frame has been dropped.
65  // The top JS frame had been calling IC stub. IC stub mustn't be called now.
67  // The top JS frame had been calling debug break slot stub. Patch the
68  // address this stub jumps to in the end.
70  // The top JS frame had been calling some C++ function. The return address
71  // gets patched automatically.
75  };
@ FRAME_DROPPED_IN_DEBUG_SLOT_CALL
Definition: liveedit.h:69

◆ FunctionPatchabilityStatus

Enumerator
FUNCTION_AVAILABLE_FOR_PATCH 
FUNCTION_BLOCKED_ON_ACTIVE_STACK 
FUNCTION_BLOCKED_ON_OTHER_STACK 
FUNCTION_BLOCKED_UNDER_NATIVE_CODE 
FUNCTION_REPLACED_ON_ACTIVE_STACK 
FUNCTION_BLOCKED_UNDER_GENERATOR 
FUNCTION_BLOCKED_ACTIVE_GENERATOR 

Definition at line 130 of file liveedit.h.

Member Function Documentation

◆ ChangeScriptSource()

Handle< Object > v8::internal::LiveEdit::ChangeScriptSource ( Handle< Script original_script,
Handle< String new_source,
Handle< Object old_script_name 
)
static

Definition at line 1471 of file liveedit.cc.

1473  {
1474  Isolate* isolate = original_script->GetIsolate();
1475  Handle<Object> old_script_object;
1476  if (old_script_name->IsString()) {
1477  Handle<Script> old_script = CreateScriptCopy(original_script);
1478  old_script->set_name(String::cast(*old_script_name));
1479  old_script_object = old_script;
1480  isolate->debug()->OnAfterCompile(old_script);
1481  } else {
1482  old_script_object = isolate->factory()->null_value();
1483  }
1484 
1485  original_script->set_source(*new_source);
1486 
1487  // Drop line ends so that they will be recalculated.
1488  original_script->set_line_ends(isolate->heap()->undefined_value());
1489 
1490  return old_script_object;
1491 }
static Handle< Script > CreateScriptCopy(Handle< Script > original)
Definition: liveedit.cc:1448

References v8::internal::CreateScriptCopy(), v8::internal::Isolate::debug(), v8::internal::Isolate::factory(), v8::internal::Isolate::heap(), and v8::internal::Debug::OnAfterCompile().

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckAndDropActivations()

Handle< JSArray > v8::internal::LiveEdit::CheckAndDropActivations ( Handle< JSArray shared_info_array,
bool  do_drop 
)
static

Definition at line 1955 of file liveedit.cc.

1956  {
1957  Isolate* isolate = shared_info_array->GetIsolate();
1958  int len = GetArrayLength(shared_info_array);
1959 
1960  DCHECK(shared_info_array->HasFastElements());
1961  Handle<FixedArray> shared_info_array_elements(
1962  FixedArray::cast(shared_info_array->elements()));
1963 
1964  Handle<JSArray> result = isolate->factory()->NewJSArray(len);
1965  Handle<FixedArray> result_elements =
1967 
1968  // Fill the default values.
1969  for (int i = 0; i < len; i++) {
1971  result_elements->set(i, Smi::FromInt(status));
1972  }
1973 
1974  // Scan the heap for active generators -- those that are either currently
1975  // running (as we wouldn't want to restart them, because we don't know where
1976  // to restart them from) or suspended. Fail if any one corresponds to the set
1977  // of functions being edited.
1978  if (FindActiveGenerators(shared_info_array_elements, result_elements, len)) {
1979  return result;
1980  }
1981 
1982  // Check inactive threads. Fail if some functions are blocked there.
1983  InactiveThreadActivationsChecker inactive_threads_checker(shared_info_array,
1984  result);
1985  isolate->thread_manager()->IterateArchivedThreads(
1986  &inactive_threads_checker);
1987  if (inactive_threads_checker.HasBlockedFunctions()) {
1988  return result;
1989  }
1990 
1991  // Try to drop activations from the current stack.
1992  const char* error_message =
1993  DropActivationsInActiveThread(shared_info_array, result, do_drop);
1994  if (error_message != NULL) {
1995  // Add error message as an array extra element.
1996  Handle<String> str =
1997  isolate->factory()->NewStringFromAsciiChecked(error_message);
1998  SetElementSloppy(result, len, str);
1999  }
2000  return result;
2001 }
static Handle< FixedArray > EnsureWritableFastElements(Handle< JSObject > object)
Definition: objects.cc:383
static bool FindActiveGenerators(Handle< FixedArray > shared_info_array, Handle< FixedArray > result, int len)
Definition: liveedit.cc:1892
static Smi * FromInt(int value)
Definition: objects-inl.h:1321
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
Definition: logging.h:205
static const char * DropActivationsInActiveThread(Handle< JSArray > shared_info_array, Handle< JSArray > result, bool do_drop)
Definition: liveedit.cc:1865
static int GetArrayLength(Handle< JSArray > array)
Definition: liveedit.cc:601
void SetElementSloppy(Handle< JSObject > object, uint32_t index, Handle< Object > value)
Definition: liveedit.cc:25

References DCHECK, v8::internal::DropActivationsInActiveThread(), v8::internal::JSObject::EnsureWritableFastElements(), v8::internal::Isolate::factory(), FindActiveGenerators(), v8::internal::Smi::FromInt(), FUNCTION_AVAILABLE_FOR_PATCH, v8::internal::GetArrayLength(), v8::internal::InactiveThreadActivationsChecker::HasBlockedFunctions(), v8::internal::ThreadManager::IterateArchivedThreads(), NULL, v8::internal::SetElementSloppy(), and v8::internal::Isolate::thread_manager().

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompareStrings()

Handle< JSArray > v8::internal::LiveEdit::CompareStrings ( Handle< String s1,
Handle< String s2 
)
static

Definition at line 556 of file liveedit.cc.

557  {
558  s1 = String::Flatten(s1);
559  s2 = String::Flatten(s2);
560 
561  LineEndsWrapper line_ends1(s1);
562  LineEndsWrapper line_ends2(s2);
563 
564  LineArrayCompareInput input(s1, s2, line_ends1, line_ends2);
565  TokenizingLineArrayCompareOutput output(line_ends1, line_ends2, s1, s2);
566 
567  NarrowDownInput(&input, &output);
568 
569  Comparator::CalculateDifference(&input, &output);
570 
571  return output.GetResult();
572 }
static void CalculateDifference(Input *input, Output *result_writer)
Definition: liveedit.cc:235
static Handle< String > Flatten(Handle< String > string, PretenureFlag pretenure=NOT_TENURED)
Definition: objects-inl.h:3354
const SwVfpRegister s1
const SwVfpRegister s2
static void NarrowDownInput(SubrangableInput *input, SubrangableOutput *output)
Definition: liveedit.cc:280

References v8::internal::Comparator::CalculateDifference(), v8::internal::String::Flatten(), v8::internal::TokenizingLineArrayCompareOutput::GetResult(), v8::internal::NarrowDownInput(), v8::internal::s1, and v8::internal::s2.

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindActiveGenerators()

bool v8::internal::LiveEdit::FindActiveGenerators ( Handle< FixedArray shared_info_array,
Handle< FixedArray result,
int  len 
)
static

Definition at line 1892 of file liveedit.cc.

1894  {
1895  Isolate* isolate = shared_info_array->GetIsolate();
1896  bool found_suspended_activations = false;
1897 
1898  DCHECK_LE(len, result->length());
1899 
1901 
1902  Heap* heap = isolate->heap();
1903  HeapIterator iterator(heap);
1904  HeapObject* obj = NULL;
1905  while ((obj = iterator.next()) != NULL) {
1906  if (!obj->IsJSGeneratorObject()) continue;
1907 
1908  JSGeneratorObject* gen = JSGeneratorObject::cast(obj);
1909  if (gen->is_closed()) continue;
1910 
1911  HandleScope scope(isolate);
1912 
1913  for (int i = 0; i < len; i++) {
1914  Handle<JSValue> jsvalue =
1915  Handle<JSValue>::cast(FixedArray::get(shared_info_array, i));
1916  Handle<SharedFunctionInfo> shared =
1918 
1919  if (gen->function()->shared() == *shared) {
1920  result->set(i, Smi::FromInt(active));
1921  found_suspended_activations = true;
1922  }
1923  }
1924  }
1925 
1926  return found_suspended_activations;
1927 }
Object * get(int index)
Definition: objects-inl.h:2165
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
#define DCHECK_LE(v1, v2)
Definition: logging.h:210
static Handle< SharedFunctionInfo > UnwrapSharedFunctionInfoFromJSValue(Handle< JSValue > jsValue)
Definition: liveedit.cc:593

References v8::internal::Handle< T >::cast(), DCHECK_LE, v8::internal::Smi::FromInt(), FUNCTION_BLOCKED_ACTIVE_GENERATOR, v8::internal::FixedArray::get(), v8::internal::Isolate::heap(), v8::internal::JSGeneratorObject::is_closed(), NULL, and v8::internal::UnwrapSharedFunctionInfoFromJSValue().

Referenced by CheckAndDropActivations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FunctionSourceUpdated()

void v8::internal::LiveEdit::FunctionSourceUpdated ( Handle< JSArray shared_info_array)
static

Definition at line 1233 of file liveedit.cc.

1233  {
1234  SharedInfoWrapper shared_info_wrapper(shared_info_array);
1235  Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo();
1236 
1237  DeoptimizeDependentFunctions(*shared_info);
1238  shared_info_array->GetIsolate()->compilation_cache()->Remove(shared_info);
1239 }
static void DeoptimizeDependentFunctions(SharedFunctionInfo *function_info)
Definition: liveedit.cc:1174

References v8::internal::DeoptimizeDependentFunctions(), and v8::internal::SharedInfoWrapper::GetInfo().

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GatherCompileInfo()

MaybeHandle< JSArray > v8::internal::LiveEdit::GatherCompileInfo ( Handle< Script script,
Handle< String source 
)
static

Definition at line 843 of file liveedit.cc.

844  {
845  Isolate* isolate = script->GetIsolate();
846 
847  FunctionInfoListener listener(isolate);
848  Handle<Object> original_source =
849  Handle<Object>(script->source(), isolate);
850  script->set_source(*source);
851  isolate->set_active_function_info_listener(&listener);
852 
853  {
854  // Creating verbose TryCatch from public API is currently the only way to
855  // force code save location. We do not use this the object directly.
856  v8::TryCatch try_catch;
857  try_catch.SetVerbose(true);
858 
859  // A logical 'try' section.
861  }
862 
863  // A logical 'catch' section.
864  Handle<JSObject> rethrow_exception;
865  if (isolate->has_pending_exception()) {
866  Handle<Object> exception(isolate->pending_exception(), isolate);
867  MessageLocation message_location = isolate->GetMessageLocation();
868 
869  isolate->clear_pending_message();
870  isolate->clear_pending_exception();
871 
872  // If possible, copy positions from message object to exception object.
873  if (exception->IsJSObject() && !message_location.script().is_null()) {
874  rethrow_exception = Handle<JSObject>::cast(exception);
875 
876  Factory* factory = isolate->factory();
877  Handle<String> start_pos_key = factory->InternalizeOneByteString(
878  STATIC_CHAR_VECTOR("startPosition"));
879  Handle<String> end_pos_key =
880  factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("endPosition"));
881  Handle<String> script_obj_key =
882  factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("scriptObject"));
883  Handle<Smi> start_pos(
884  Smi::FromInt(message_location.start_pos()), isolate);
885  Handle<Smi> end_pos(Smi::FromInt(message_location.end_pos()), isolate);
886  Handle<JSObject> script_obj =
887  Script::GetWrapper(message_location.script());
888  Object::SetProperty(rethrow_exception, start_pos_key, start_pos, SLOPPY)
889  .Assert();
890  Object::SetProperty(rethrow_exception, end_pos_key, end_pos, SLOPPY)
891  .Assert();
892  Object::SetProperty(rethrow_exception, script_obj_key, script_obj, SLOPPY)
893  .Assert();
894  }
895  }
896 
897  // A logical 'finally' section.
898  isolate->set_active_function_info_listener(NULL);
899  script->set_source(*original_source);
900 
901  if (rethrow_exception.is_null()) {
902  return listener.GetResult();
903  } else {
904  return isolate->Throw<JSArray>(rethrow_exception);
905  }
906 }
An external exception handler.
Definition: v8.h:5271
void SetVerbose(bool value)
Set verbosity of the external exception handler.
Definition: api.cc:2046
static void CompileForLiveEdit(Handle< Script > script)
Definition: compiler.cc:964
static MUST_USE_RESULT MaybeHandle< Object > SetProperty(Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
Definition: objects.cc:2798
static Handle< JSObject > GetWrapper(Handle< Script > script)
Definition: objects.cc:9741
#define STATIC_CHAR_VECTOR(x)
Definition: vector.h:154

References v8::internal::Handle< T >::cast(), v8::internal::Isolate::clear_pending_exception(), v8::internal::Isolate::clear_pending_message(), v8::internal::Compiler::CompileForLiveEdit(), v8::internal::MessageLocation::end_pos(), v8::internal::Isolate::factory(), v8::internal::Smi::FromInt(), v8::internal::Isolate::GetMessageLocation(), v8::internal::FunctionInfoListener::GetResult(), v8::internal::Script::GetWrapper(), v8::internal::Isolate::has_pending_exception(), v8::internal::Handle< T >::is_null(), NULL, v8::internal::Isolate::pending_exception(), v8::internal::MessageLocation::script(), v8::internal::Object::SetProperty(), v8::TryCatch::SetVerbose(), v8::internal::SLOPPY, v8::internal::MessageLocation::start_pos(), STATIC_CHAR_VECTOR, and v8::internal::Isolate::Throw().

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InitializeThreadLocal()

void v8::internal::LiveEdit::InitializeThreadLocal ( Debug debug)
static

Definition at line 808 of file liveedit.cc.

808  {
809  debug->thread_local_.frame_drop_mode_ = LiveEdit::FRAMES_UNTOUCHED;
810 }

References v8::internal::Debug::ThreadLocal::frame_drop_mode_, FRAMES_UNTOUCHED, and v8::internal::Debug::thread_local_.

Referenced by v8::internal::Debug::Break().

+ Here is the caller graph for this function:

◆ PatchFunctionPositions()

void v8::internal::LiveEdit::PatchFunctionPositions ( Handle< JSArray shared_info_array,
Handle< JSArray position_change_array 
)
static

Definition at line 1415 of file liveedit.cc.

1416  {
1417  SharedInfoWrapper shared_info_wrapper(shared_info_array);
1418  Handle<SharedFunctionInfo> info = shared_info_wrapper.GetInfo();
1419 
1420  int old_function_start = info->start_position();
1421  int new_function_start = TranslatePosition(old_function_start,
1422  position_change_array);
1423  int new_function_end = TranslatePosition(info->end_position(),
1424  position_change_array);
1425  int new_function_token_pos =
1426  TranslatePosition(info->function_token_position(), position_change_array);
1427 
1428  info->set_start_position(new_function_start);
1429  info->set_end_position(new_function_end);
1430  info->set_function_token_position(new_function_token_pos);
1431 
1432  if (IsJSFunctionCode(info->code())) {
1433  // Patch relocation info section of the code.
1434  Handle<Code> patched_code = PatchPositionsInCode(Handle<Code>(info->code()),
1435  position_change_array);
1436  if (*patched_code != info->code()) {
1437  // Replace all references to the code across the heap. In particular,
1438  // some stubs may refer to this code and this code may be being executed
1439  // on stack (it is safe to substitute the code object on stack, because
1440  // we only change the structure of rinfo and leave instructions
1441  // untouched).
1442  ReplaceCodeObject(Handle<Code>(info->code()), patched_code);
1443  }
1444  }
1445 }
static int TranslatePosition(int original_position, Handle< JSArray > position_change_array)
Definition: liveedit.cc:1262
static bool IsJSFunctionCode(Code *code)
Definition: liveedit.cc:1119
static Handle< Code > PatchPositionsInCode(Handle< Code > code, Handle< JSArray > position_change_array)
Definition: liveedit.cc:1372
static void ReplaceCodeObject(Handle< Code > original, Handle< Code > substitution)
Definition: liveedit.cc:969

References v8::internal::SharedInfoWrapper::GetInfo(), v8::internal::IsJSFunctionCode(), v8::internal::PatchPositionsInCode(), v8::internal::ReplaceCodeObject(), and v8::internal::TranslatePosition().

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReplaceFunctionCode()

void v8::internal::LiveEdit::ReplaceFunctionCode ( Handle< JSArray new_compile_info_array,
Handle< JSArray shared_info_array 
)
static

Definition at line 1187 of file liveedit.cc.

1189  {
1190  Isolate* isolate = new_compile_info_array->GetIsolate();
1191 
1192  FunctionInfoWrapper compile_info_wrapper(new_compile_info_array);
1193  SharedInfoWrapper shared_info_wrapper(shared_info_array);
1194 
1195  Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo();
1196 
1197  if (IsJSFunctionCode(shared_info->code())) {
1198  Handle<Code> code = compile_info_wrapper.GetFunctionCode();
1199  ReplaceCodeObject(Handle<Code>(shared_info->code()), code);
1200  Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo();
1201  if (code_scope_info->IsFixedArray()) {
1202  shared_info->set_scope_info(ScopeInfo::cast(*code_scope_info));
1203  }
1204  shared_info->DisableOptimization(kLiveEdit);
1205  // Update the type feedback vector
1206  Handle<TypeFeedbackVector> feedback_vector =
1207  compile_info_wrapper.GetFeedbackVector();
1208  shared_info->set_feedback_vector(*feedback_vector);
1209  }
1210 
1211  if (shared_info->debug_info()->IsDebugInfo()) {
1212  Handle<DebugInfo> debug_info(DebugInfo::cast(shared_info->debug_info()));
1213  Handle<Code> new_original_code =
1214  isolate->factory()->CopyCode(compile_info_wrapper.GetFunctionCode());
1215  debug_info->set_original_code(*new_original_code);
1216  }
1217 
1218  int start_position = compile_info_wrapper.GetStartPosition();
1219  int end_position = compile_info_wrapper.GetEndPosition();
1220  shared_info->set_start_position(start_position);
1221  shared_info->set_end_position(end_position);
1222 
1223  LiteralFixer::PatchLiterals(&compile_info_wrapper, shared_info, isolate);
1224 
1225  shared_info->set_construct_stub(
1226  isolate->builtins()->builtin(Builtins::kJSConstructStubGeneric));
1227 
1228  DeoptimizeDependentFunctions(*shared_info);
1229  isolate->compilation_cache()->Remove(shared_info);
1230 }
static void PatchLiterals(FunctionInfoWrapper *compile_info_wrapper, Handle< SharedFunctionInfo > shared_info, Isolate *isolate)
Definition: liveedit.cc:1003

References v8::internal::Builtins::builtin(), v8::internal::Isolate::builtins(), v8::internal::Isolate::compilation_cache(), v8::internal::DeoptimizeDependentFunctions(), v8::internal::Isolate::factory(), v8::internal::feedback_vector, v8::internal::FunctionInfoWrapper::GetCodeScopeInfo(), v8::internal::FunctionInfoWrapper::GetEndPosition(), v8::internal::FunctionInfoWrapper::GetFeedbackVector(), v8::internal::FunctionInfoWrapper::GetFunctionCode(), v8::internal::SharedInfoWrapper::GetInfo(), v8::internal::FunctionInfoWrapper::GetStartPosition(), v8::internal::IsJSFunctionCode(), v8::internal::LiteralFixer::PatchLiterals(), v8::internal::CompilationCache::Remove(), and v8::internal::ReplaceCodeObject().

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReplaceRefToNestedFunction()

void v8::internal::LiveEdit::ReplaceRefToNestedFunction ( Handle< JSValue parent_function_shared,
Handle< JSValue orig_function_shared,
Handle< JSValue subst_function_shared 
)
static

Definition at line 1495 of file liveedit.cc.

1498  {
1499 
1500  Handle<SharedFunctionInfo> parent_shared =
1501  UnwrapSharedFunctionInfoFromJSValue(parent_function_wrapper);
1502  Handle<SharedFunctionInfo> orig_shared =
1503  UnwrapSharedFunctionInfoFromJSValue(orig_function_wrapper);
1504  Handle<SharedFunctionInfo> subst_shared =
1505  UnwrapSharedFunctionInfoFromJSValue(subst_function_wrapper);
1506 
1507  for (RelocIterator it(parent_shared->code()); !it.done(); it.next()) {
1508  if (it.rinfo()->rmode() == RelocInfo::EMBEDDED_OBJECT) {
1509  if (it.rinfo()->target_object() == *orig_shared) {
1510  it.rinfo()->set_target_object(*subst_shared);
1511  }
1512  }
1513  }
1514 }

References v8::internal::RelocIterator::done(), v8::internal::RelocInfo::EMBEDDED_OBJECT, and v8::internal::UnwrapSharedFunctionInfoFromJSValue().

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RestartFrame()

const char * v8::internal::LiveEdit::RestartFrame ( JavaScriptFrame frame)
static

Definition at line 2034 of file liveedit.cc.

2034  {
2035  SingleFrameTarget target(frame);
2036 
2037  const char* result = DropActivationsInActiveThreadImpl(
2038  frame->isolate(), target, true);
2039  if (result != NULL) {
2040  return result;
2041  }
2042  if (target.saved_status() == LiveEdit::FUNCTION_BLOCKED_UNDER_NATIVE_CODE) {
2043  return "Function is blocked under native code";
2044  }
2045  if (target.saved_status() == LiveEdit::FUNCTION_BLOCKED_UNDER_GENERATOR) {
2046  return "Function is blocked under a generator activation";
2047  }
2048  return NULL;
2049 }
static const char * DropActivationsInActiveThreadImpl(Isolate *isolate, TARGET &target, bool do_drop)
Definition: liveedit.cc:1759

References v8::internal::DropActivationsInActiveThreadImpl(), FUNCTION_BLOCKED_UNDER_GENERATOR, FUNCTION_BLOCKED_UNDER_NATIVE_CODE, NULL, and v8::internal::SingleFrameTarget::saved_status().

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAfterBreakTarget()

bool v8::internal::LiveEdit::SetAfterBreakTarget ( Debug debug)
static

Definition at line 813 of file liveedit.cc.

813  {
814  Code* code = NULL;
815  Isolate* isolate = debug->isolate_;
816  switch (debug->thread_local_.frame_drop_mode_) {
817  case FRAMES_UNTOUCHED:
818  return false;
820  // We must have been calling IC stub. Do not go there anymore.
821  code = isolate->builtins()->builtin(Builtins::kPlainReturn_LiveEdit);
822  break;
824  // Debug break slot stub does not return normally, instead it manually
825  // cleans the stack and jumps. We should patch the jump address.
826  code = isolate->builtins()->builtin(Builtins::kFrameDropper_LiveEdit);
827  break;
829  // Nothing to do, after_break_target is not used here.
830  return true;
832  code = isolate->builtins()->builtin(Builtins::kFrameDropper_LiveEdit);
833  break;
834  case CURRENTLY_SET_MODE:
835  UNREACHABLE();
836  break;
837  }
838  debug->after_break_target_ = code->entry();
839  return true;
840 }
#define UNREACHABLE()
Definition: logging.h:30

References v8::internal::Debug::after_break_target_, v8::internal::Builtins::builtin(), v8::internal::Isolate::builtins(), CURRENTLY_SET_MODE, v8::internal::Code::entry(), v8::internal::Debug::ThreadLocal::frame_drop_mode_, FRAME_DROPPED_IN_DEBUG_SLOT_CALL, FRAME_DROPPED_IN_DIRECT_CALL, FRAME_DROPPED_IN_IC_CALL, FRAME_DROPPED_IN_RETURN_CALL, FRAMES_UNTOUCHED, v8::internal::Debug::isolate_, NULL, v8::internal::Debug::thread_local_, and UNREACHABLE.

Referenced by v8::internal::Debug::SetAfterBreakTarget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetFunctionScript()

void v8::internal::LiveEdit::SetFunctionScript ( Handle< JSValue function_wrapper,
Handle< Object script_handle 
)
static

Definition at line 1242 of file liveedit.cc.

1243  {
1244  Handle<SharedFunctionInfo> shared_info =
1245  UnwrapSharedFunctionInfoFromJSValue(function_wrapper);
1246  CHECK(script_handle->IsScript() || script_handle->IsUndefined());
1247  shared_info->set_script(*script_handle);
1248 
1249  function_wrapper->GetIsolate()->compilation_cache()->Remove(shared_info);
1250 }
#define CHECK(condition)
Definition: logging.h:36

References CHECK, and v8::internal::UnwrapSharedFunctionInfoFromJSValue().

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ WrapSharedFunctionInfos()

void v8::internal::LiveEdit::WrapSharedFunctionInfos ( Handle< JSArray array)
static

Definition at line 909 of file liveedit.cc.

909  {
910  Isolate* isolate = array->GetIsolate();
911  HandleScope scope(isolate);
912  int len = GetArrayLength(array);
913  for (int i = 0; i < len; i++) {
914  Handle<SharedFunctionInfo> info(
915  SharedFunctionInfo::cast(
916  *Object::GetElement(isolate, array, i).ToHandleChecked()));
917  SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(isolate);
918  Handle<String> name_handle(String::cast(info->name()));
919  info_wrapper.SetProperties(name_handle, info->start_position(),
920  info->end_position(), info);
921  SetElementSloppy(array, i, info_wrapper.GetJSArray());
922  }
923 }
static SharedInfoWrapper Create(Isolate *isolate)
Definition: liveedit.h:227
static MUST_USE_RESULT MaybeHandle< Object > GetElement(Isolate *isolate, Handle< Object > object, uint32_t index)
Definition: objects-inl.h:1113

References v8::internal::JSArrayBasedStruct< SharedInfoWrapper >::Create(), v8::internal::GetArrayLength(), v8::internal::Object::GetElement(), v8::internal::JSArrayBasedStruct< S >::GetJSArray(), v8::internal::SetElementSloppy(), and v8::internal::SharedInfoWrapper::SetProperties().

Referenced by v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ kFrameDropperFrameSize

const int v8::internal::LiveEdit::kFrameDropperFrameSize = 4
static

Defines layout of a stack frame that supports padding.

This is a regular internal frame that has a flexible stack structure. LiveEdit can shift its lower part up the stack, taking up the 'padding' space when additional stack memory is required. Such frame is expected immediately above the topmost JavaScript frame.

Stack Layout: — Top

LiveEdit routine frames

C frames of debug handler

...

An internal frame that has n padding words:

  • any number of words as needed by code – upper part of frame
  • padding size: a Smi storing n – current size of padding
  • padding: n words filled with kPaddingValue in form of Smi
  • 3 context/type words of a regular InternalFrame

- fp

Topmost JavaScript frame

... — Bottom

Definition at line 178 of file liveedit.h.

Referenced by v8::internal::DropFrames().

◆ kFrameDropperSupported

const bool v8::internal::LiveEdit::kFrameDropperSupported
static

Definition at line 147 of file liveedit.h.

Referenced by v8::internal::DropFrames().

◆ kFramePaddingInitialSize

const int v8::internal::LiveEdit::kFramePaddingInitialSize = 1
static

Definition at line 181 of file liveedit.h.

◆ kFramePaddingValue

const int v8::internal::LiveEdit::kFramePaddingValue = kFramePaddingInitialSize + 1
static

Definition at line 184 of file liveedit.h.

Referenced by v8::internal::DropFrames().


The documentation for this class was generated from the following files: