V8 Project
v8::ExecArgs Class Reference
+ Collaboration diagram for v8::ExecArgs:

Public Member Functions

 ExecArgs ()
 
bool Init (Isolate *isolate, Handle< Value > arg0, Handle< Array > command_args)
 
 ~ExecArgs ()
 
char *const * arg_array () const
 
const char * arg0 () const
 

Static Public Attributes

static const unsigned kMaxArgs = 1000
 

Private Attributes

char * exec_args_ [kMaxArgs+1]
 

Detailed Description

Definition at line 167 of file d8-posix.cc.

Constructor & Destructor Documentation

◆ ExecArgs()

v8::ExecArgs::ExecArgs ( )
inline

Definition at line 169 of file d8-posix.cc.

169  {
170  exec_args_[0] = NULL;
171  }
char * exec_args_[kMaxArgs+1]
Definition: d8-posix.cc:217
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 exec_args_, and NULL.

◆ ~ExecArgs()

v8::ExecArgs::~ExecArgs ( )
inline

Definition at line 203 of file d8-posix.cc.

203  {
204  for (unsigned i = 0; i < kMaxArgs; i++) {
205  if (exec_args_[i] == NULL) {
206  return;
207  }
208  delete [] exec_args_[i];
209  exec_args_[i] = 0;
210  }
211  }
static const unsigned kMaxArgs
Definition: d8-posix.cc:212

References exec_args_, kMaxArgs, and NULL.

Member Function Documentation

◆ arg0()

const char* v8::ExecArgs::arg0 ( ) const
inline

Definition at line 214 of file d8-posix.cc.

214 { return exec_args_[0]; }

References exec_args_.

Referenced by v8::ExecSubprocess(), and Init().

+ Here is the caller graph for this function:

◆ arg_array()

char* const* v8::ExecArgs::arg_array ( ) const
inline

Definition at line 213 of file d8-posix.cc.

213 { return exec_args_; }

References exec_args_.

Referenced by v8::ExecSubprocess().

+ Here is the caller graph for this function:

◆ Init()

bool v8::ExecArgs::Init ( Isolate isolate,
Handle< Value arg0,
Handle< Array command_args 
)
inline

Definition at line 172 of file d8-posix.cc.

172  {
173  String::Utf8Value prog(arg0);
174  if (*prog == NULL) {
175  const char* message =
176  "os.system(): String conversion of program name failed";
177  isolate->ThrowException(String::NewFromUtf8(isolate, message));
178  return false;
179  }
180  int len = prog.length() + 3;
181  char* c_arg = new char[len];
182  snprintf(c_arg, len, "%s", *prog);
183  exec_args_[0] = c_arg;
184  int i = 1;
185  for (unsigned j = 0; j < command_args->Length(); i++, j++) {
186  Handle<Value> arg(command_args->Get(Integer::New(isolate, j)));
187  String::Utf8Value utf8_arg(arg);
188  if (*utf8_arg == NULL) {
189  exec_args_[i] = NULL; // Consistent state for destructor.
190  const char* message =
191  "os.system(): String conversion of argument failed.";
192  isolate->ThrowException(String::NewFromUtf8(isolate, message));
193  return false;
194  }
195  int len = utf8_arg.length() + 1;
196  char* c_arg = new char[len];
197  snprintf(c_arg, len, "%s", *utf8_arg);
198  exec_args_[i] = c_arg;
199  }
200  exec_args_[i] = NULL;
201  return true;
202  }
const char * arg0() const
Definition: d8-posix.cc:214
static Local< Integer > New(Isolate *isolate, int32_t value)
Definition: api.cc:6281
static Local< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=kNormalString, int length=-1)
Allocates a new string from UTF-8 data.
Definition: api.cc:5447

References arg0(), exec_args_, v8::String::Utf8Value::length(), v8::Integer::New(), v8::String::NewFromUtf8(), NULL, and v8::Isolate::ThrowException().

Referenced by v8::Shell::System().

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

Member Data Documentation

◆ exec_args_

char* v8::ExecArgs::exec_args_[kMaxArgs+1]
private

Definition at line 217 of file d8-posix.cc.

Referenced by arg0(), arg_array(), ExecArgs(), Init(), and ~ExecArgs().

◆ kMaxArgs

const unsigned v8::ExecArgs::kMaxArgs = 1000
static

Definition at line 212 of file d8-posix.cc.

Referenced by v8::Shell::System(), and ~ExecArgs().


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