V8 Project
v8::internal::LiteralFixer Class Reference
+ Collaboration diagram for v8::internal::LiteralFixer:

Classes

class  ClearValuesVisitor
 
class  CollectVisitor
 
class  CountVisitor
 

Static Public Member Functions

static void PatchLiterals (FunctionInfoWrapper *compile_info_wrapper, Handle< SharedFunctionInfo > shared_info, Isolate *isolate)
 

Static Private Member Functions

template<typename Visitor >
static void IterateJSFunctions (Handle< SharedFunctionInfo > shared_info, Visitor *visitor)
 
static Handle< FixedArrayCollectJSFunctions (Handle< SharedFunctionInfo > shared_info, Isolate *isolate)
 

Detailed Description

Definition at line 1001 of file liveedit.cc.

Member Function Documentation

◆ CollectJSFunctions()

static Handle<FixedArray> v8::internal::LiteralFixer::CollectJSFunctions ( Handle< SharedFunctionInfo shared_info,
Isolate isolate 
)
inlinestaticprivate

Definition at line 1067 of file liveedit.cc.

1068  {
1069  CountVisitor count_visitor;
1070  count_visitor.count = 0;
1071  IterateJSFunctions(shared_info, &count_visitor);
1072  int size = count_visitor.count;
1073 
1074  Handle<FixedArray> result = isolate->factory()->NewFixedArray(size);
1075  if (size > 0) {
1076  CollectVisitor collect_visitor(result);
1077  IterateJSFunctions(shared_info, &collect_visitor);
1078  }
1079  return result;
1080  }
static void IterateJSFunctions(Handle< SharedFunctionInfo > shared_info, Visitor *visitor)
Definition: liveedit.cc:1051
enable harmony numeric enable harmony object literal extensions Optimize object size

References v8::internal::LiteralFixer::CountVisitor::count, v8::internal::Isolate::factory(), IterateJSFunctions(), and size.

Referenced by PatchLiterals().

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

◆ IterateJSFunctions()

template<typename Visitor >
static void v8::internal::LiteralFixer::IterateJSFunctions ( Handle< SharedFunctionInfo shared_info,
Visitor *  visitor 
)
inlinestaticprivate

Definition at line 1051 of file liveedit.cc.

1052  {
1053  HeapIterator iterator(shared_info->GetHeap());
1054  for (HeapObject* obj = iterator.next(); obj != NULL;
1055  obj = iterator.next()) {
1056  if (obj->IsJSFunction()) {
1057  JSFunction* function = JSFunction::cast(obj);
1058  if (function->shared() == *shared_info) {
1059  visitor->visit(function);
1060  }
1061  }
1062  }
1063  }
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

References NULL.

Referenced by CollectJSFunctions(), and PatchLiterals().

+ Here is the caller graph for this function:

◆ PatchLiterals()

static void v8::internal::LiteralFixer::PatchLiterals ( FunctionInfoWrapper compile_info_wrapper,
Handle< SharedFunctionInfo shared_info,
Isolate isolate 
)
inlinestatic

Definition at line 1003 of file liveedit.cc.

1005  {
1006  int new_literal_count = compile_info_wrapper->GetLiteralCount();
1007  if (new_literal_count > 0) {
1008  new_literal_count += JSFunction::kLiteralsPrefixSize;
1009  }
1010  int old_literal_count = shared_info->num_literals();
1011 
1012  if (old_literal_count == new_literal_count) {
1013  // If literal count didn't change, simply go over all functions
1014  // and clear literal arrays.
1015  ClearValuesVisitor visitor;
1016  IterateJSFunctions(shared_info, &visitor);
1017  } else {
1018  // When literal count changes, we have to create new array instances.
1019  // Since we cannot create instances when iterating heap, we should first
1020  // collect all functions and fix their literal arrays.
1021  Handle<FixedArray> function_instances =
1022  CollectJSFunctions(shared_info, isolate);
1023  for (int i = 0; i < function_instances->length(); i++) {
1024  Handle<JSFunction> fun(JSFunction::cast(function_instances->get(i)));
1025  Handle<FixedArray> old_literals(fun->literals());
1026  Handle<FixedArray> new_literals =
1027  isolate->factory()->NewFixedArray(new_literal_count);
1028  if (new_literal_count > 0) {
1029  Handle<Context> native_context;
1030  if (old_literals->length() >
1032  native_context = Handle<Context>(
1033  JSFunction::NativeContextFromLiterals(fun->literals()));
1034  } else {
1035  native_context = Handle<Context>(fun->context()->native_context());
1036  }
1037  new_literals->set(JSFunction::kLiteralNativeContextIndex,
1038  *native_context);
1039  }
1040  fun->set_literals(*new_literals);
1041  }
1042 
1043  shared_info->set_num_literals(new_literal_count);
1044  }
1045  }
static const int kLiteralNativeContextIndex
Definition: objects.h:7389
static const int kLiteralsPrefixSize
Definition: objects.h:7388
static Context * NativeContextFromLiterals(FixedArray *literals)
Definition: objects.cc:9554
static Handle< FixedArray > CollectJSFunctions(Handle< SharedFunctionInfo > shared_info, Isolate *isolate)
Definition: liveedit.cc:1067

References CollectJSFunctions(), v8::internal::Isolate::factory(), v8::internal::FunctionInfoWrapper::GetLiteralCount(), IterateJSFunctions(), v8::internal::JSFunction::kLiteralNativeContextIndex, v8::internal::JSFunction::kLiteralsPrefixSize, and v8::internal::JSFunction::NativeContextFromLiterals().

Referenced by v8::internal::LiveEdit::ReplaceFunctionCode().

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

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