33 #include "../include/v8-testing.h" 
   94     : value_(v8::internal::
Handle<v8::internal::JSObject>::cast(obj)) { }
 
   98     : value_(v8::internal::
Handle<v8::internal::JSObject>(
 
   99         v8::internal::JSObject::cast(obj))) { }
 
  113   ASSERT(value_->HasFastObjectElements());
 
  120   return reinterpret_cast<T>(
 
  121       reinterpret_cast<intptr_t
>(
 
  126 template <
typename T>
 
  131       reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj)));
 
  160 #define OPEN_HANDLE_LIST(V)                    \ 
  161   V(Template, TemplateInfo)                    \ 
  162   V(FunctionTemplate, FunctionTemplateInfo)    \ 
  163   V(ObjectTemplate, ObjectTemplateInfo)        \ 
  164   V(Signature, SignatureInfo)                  \ 
  165   V(AccessorSignature, FunctionTemplateInfo)   \ 
  166   V(TypeSwitch, TypeSwitchInfo)                \ 
  168   V(RegExp, JSRegExp)                          \ 
  169   V(Object, JSObject)                          \ 
  171   V(ArrayBuffer, JSArrayBuffer)                \ 
  172   V(ArrayBufferView, JSArrayBufferView)        \ 
  173   V(TypedArray, JSTypedArray)                  \ 
  174   V(Uint8Array, JSTypedArray)                  \ 
  175   V(Uint8ClampedArray, JSTypedArray)           \ 
  176   V(Int8Array, JSTypedArray)                   \ 
  177   V(Uint16Array, JSTypedArray)                 \ 
  178   V(Int16Array, JSTypedArray)                  \ 
  179   V(Uint32Array, JSTypedArray)                 \ 
  180   V(Int32Array, JSTypedArray)                  \ 
  181   V(Float32Array, JSTypedArray)                \ 
  182   V(Float64Array, JSTypedArray)                \ 
  183   V(DataView, JSDataView)                      \ 
  186   V(Script, JSFunction)                        \ 
  187   V(UnboundScript, SharedFunctionInfo)         \ 
  188   V(Function, JSFunction)                      \ 
  189   V(Message, JSObject)                         \ 
  190   V(Context, Context)                          \ 
  191   V(External, Foreign)                         \ 
  192   V(StackTrace, JSArray)                       \ 
  193   V(StackFrame, JSObject)                      \ 
  194   V(DeclaredAccessorDescriptor, DeclaredAccessorDescriptor) 
  200                               const char* location,
 
  202     if (!condition) Utils::ReportApiFailure(location, message);
 
  280 #define DECLARE_OPEN_HANDLE(From, To) \ 
  281   static inline v8::internal::Handle<v8::internal::To> \ 
  282       OpenHandle(const From* that, bool allow_empty_handle = false); 
  286 #undef DECLARE_OPEN_HANDLE 
  288   template<
class From, 
class To>
 
  291     return Local<To>(
reinterpret_cast<To*
>(obj.location()));
 
  307   template <
class From, 
class To>
 
  313   static void ReportApiFailure(
const char* location, 
const char* 
message);
 
  330   return reinterpret_cast<T*
>(obj.location());
 
  336   return Utils::Convert<v8::internal::Object, T>(
obj);
 
  342 #define MAKE_TO_LOCAL(Name, From, To)                                       \ 
  343   Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ 
  344     return Convert<v8::internal::From, v8::To>(obj);  \ 
  348 #define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype, size)        \ 
  349   Local<v8::Type##Array> Utils::ToLocal##Type##Array(                       \ 
  350       v8::internal::Handle<v8::internal::JSTypedArray> obj) {               \ 
  351     ASSERT(obj->type() == kExternal##Type##Array);                          \ 
  352     return Convert<v8::internal::JSTypedArray, v8::Type##Array>(obj);       \ 
  371 MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate)
 
  374 MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature)
 
  383 MAKE_TO_LOCAL(ToLocal, DeclaredAccessorDescriptor, DeclaredAccessorDescriptor)
 
  385 #undef MAKE_TO_LOCAL_TYPED_ARRAY 
  391 #define MAKE_OPEN_HANDLE(From, To)                                          \ 
  392   v8::internal::Handle<v8::internal::To> Utils::OpenHandle(                 \ 
  393     const v8::From* that, bool allow_empty_handle) {                        \ 
  394     EXTRA_CHECK(allow_empty_handle || that != NULL);                        \ 
  395     EXTRA_CHECK(that == NULL ||                                             \ 
  396         !(*reinterpret_cast<v8::internal::To**>(                            \ 
  397             const_cast<v8::From*>(that)))->IsFailure());                    \ 
  398     return v8::internal::Handle<v8::internal::To>(                          \ 
  399         reinterpret_cast<v8::internal::To**>(const_cast<v8::From*>(that))); \ 
  404 #undef MAKE_OPEN_HANDLE 
  405 #undef OPEN_HANDLE_LIST 
  423     if (IsFreshString(address, top)) {
 
  424       IncrementUseCount(top);
 
  434     return IsFreshString(address, top) && IsUseCountLow(top);
 
  441     return top - kFreshnessLimit <= 
string && 
string <= top;
 
  444   inline bool IsUseCountLow(
Address top) {
 
  445     if (last_top_ != top) 
return true;
 
  446     return use_count_ < kUseLimit;
 
  449   inline void IncrementUseCount(
Address top) {
 
  450     if (last_top_ != top) {
 
  466   static const int kFreshnessLimit = 1024;
 
  469   static const int kUseLimit = 32;
 
  485         first_block_limit_(first_block_limit),
 
  490   void Iterate(ObjectVisitor* v);
 
  495   Object** first_block_limit_;
 
  517         entered_contexts_(0),
 
  521         last_handle_before_deferred_block_(
NULL) { }
 
  534   void Iterate(v8::internal::ObjectVisitor* v);
 
  535   static char* 
Iterate(v8::internal::ObjectVisitor* v, 
char* data);
 
  567   void ResetAfterArchive() {
 
  568     blocks_.Initialize(0);
 
  569     entered_contexts_.Initialize(0);
 
  570     saved_contexts_.Initialize(0);
 
  572     last_handle_before_deferred_block_ = 
NULL;
 
  577     ASSERT(blocks_.length() == 0);
 
  578     ASSERT(entered_contexts_.length() == 0);
 
  579     ASSERT(saved_contexts_.length() == 0);
 
  581     entered_contexts_.Free();
 
  582     saved_contexts_.Free();
 
  583     if (spare_ != 
NULL) {
 
  590   void BeginDeferredScope();
 
  594   List<internal::Object**> blocks_;
 
  596   List<Context*> entered_contexts_;
 
  598   List<Context*> saved_contexts_;
 
  601   Object** last_handle_before_deferred_block_;
 
  603   HandleScopeData handle_scope_data_;
 
  605   void IterateThis(ObjectVisitor* v);
 
  606   char* RestoreThreadHelper(
char* from);
 
  607   char* ArchiveThreadHelper(
char* to);
 
  620   saved_contexts_.Add(context);
 
  625   return saved_contexts_.RemoveLast();
 
  630   return !saved_contexts_.is_empty();
 
  635   entered_contexts_.Add(*context);
 
  640   entered_contexts_.RemoveLast();
 
  645   return !entered_contexts_.is_empty() && entered_contexts_.last() == *context;
 
  666   while (!blocks_.is_empty()) {
 
  671     if (block_start <= prev_limit && prev_limit <= block_limit) {
 
  672 #ifdef ENABLE_HANDLE_ZAPPING 
  673       internal::HandleScope::ZapRange(prev_limit, block_limit);
 
  678     if (prev_limit == block_limit) 
break;
 
  681     blocks_.RemoveLast();
 
  682 #ifdef ENABLE_HANDLE_ZAPPING 
  683     internal::HandleScope::ZapRange(block_start, block_limit);
 
  685     if (spare_ != 
NULL) {
 
  688     spare_ = block_start;
 
  690   ASSERT((blocks_.is_empty() && prev_limit == 
NULL) ||
 
  691          (!blocks_.is_empty() && prev_limit != 
NULL));
 
void SaveContext(Context *context)
 
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
 
static void set_stress_type(v8::Testing::StressType stress_type)
 
Handle< Context > LastEnteredContext()
 
RegisteredExtension * next()
 
internal::Object ** GetSpareOrNewBlock()
 
static Local< Int8Array > ToLocalInt8Array(v8::internal::Handle< v8::internal::JSTypedArray > obj)
 
Handle< T > EscapeFrom(v8::EscapableHandleScope *scope)
 
HandleScopeImplementer(Isolate *isolate)
 
void RecordWrite(Handle< String > string)
 
v8::internal::Handle< v8::internal::JSObject > value()
 
void set(int index, v8::internal::Object *value)
 
void(* FunctionCallback)(const FunctionCallbackInfo< Value > &info)
 
static Local< Number > NumberToLocal(v8::internal::Handle< v8::internal::Object > obj)
 
char * ArchiveThread(char *to)
 
NeanderArray(v8::internal::Isolate *isolate)
 
static Local< AccessorSignature > AccessorSignatureToLocal(v8::internal::Handle< v8::internal::FunctionTemplateInfo > obj)
 
static Local< To > Convert(v8::internal::Handle< From > obj)
 
static v8::internal::Handle< v8::internal::Object > OpenPersistent(const v8::Persistent< T > &persistent)
 
static Local< Float64Array > ToLocalFloat64Array(v8::internal::Handle< v8::internal::JSTypedArray > obj)
 
char * RestoreThread(char *from)
 
static v8::internal::Handle< v8::internal::Object > OpenPersistent(v8::Persistent< T > *persistent)
 
kSerializedDataOffset Object
 
#define DECLARE_OPEN_HANDLE(From, To)
 
static Foreign * cast(Object *obj)
 
void DeleteExtensions(internal::Object **prev_limit)
 
V8_INLINE Local< T > Escape(Local< T > value)
 
T ToCData(v8::internal::Object *obj)
 
#define ASSERT(condition)
 
v8::Local< T > ToApiHandle(v8::internal::Handle< v8::internal::Object > obj)
 
NeanderObject(v8::internal::Isolate *isolate, int size)
 
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage message
 
static Local< Int32Array > ToLocalInt32Array(v8::internal::Handle< v8::internal::JSTypedArray > obj)
 
void LinkDeferredHandles(DeferredHandles *deferred_handles)
 
v8::internal::Address address()
 
v8::internal::Handle< v8::internal::JSObject > value()
 
#define MAKE_TO_LOCAL_TYPED_ARRAY(Type, typeName, TYPE, ctype, size)
 
#define MAKE_OPEN_HANDLE(From, To)
 
static Local< StackFrame > StackFrameToLocal(v8::internal::Handle< v8::internal::JSObject > obj)
 
void(* AccessorGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
 
static Local< Uint16Array > ToLocalUint16Array(v8::internal::Handle< v8::internal::JSTypedArray > obj)
 
HANDLE HANDLE LPSTACKFRAME64 StackFrame
 
static Local< StackTrace > StackTraceToLocal(v8::internal::Handle< v8::internal::JSArray > obj)
 
static Local< Message > MessageToLocal(v8::internal::Handle< v8::internal::Object > obj)
 
ApiFunction(v8::internal::Address addr)
 
static Local< Uint32 > Uint32ToLocal(v8::internal::Handle< v8::internal::Object > obj)
 
bool LastEnteredContextWas(Handle< Context > context)
 
static int ArchiveSpacePerThread()
 
void IncrementCallDepth()
 
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
 
static Local< Integer > IntegerToLocal(v8::internal::Handle< v8::internal::Object > obj)
 
static Local< Int16Array > ToLocalInt16Array(v8::internal::Handle< v8::internal::JSTypedArray > obj)
 
static void UnregisterAll()
 
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
 
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
 
#define T(name, string, precedence)
 
void ReturnBlock(Object **block)
 
RegisteredExtension(Extension *extension)
 
static Local< Float32Array > ToLocalFloat32Array(v8::internal::Handle< v8::internal::JSTypedArray > obj)
 
List< internal::Object ** > * blocks()
 
static Local< Uint8ClampedArray > ToLocalUint8ClampedArray(v8::internal::Handle< v8::internal::JSTypedArray > obj)
 
bool IsFreshUnusedString(Handle< String > string)
 
~HandleScopeImplementer()
 
void add(v8::internal::Handle< v8::internal::Object > value)
 
v8::internal::Handle< v8::internal::Object > FromCData(v8::internal::Isolate *isolate, T obj)
 
Handle< T > handle(T *t, Isolate *isolate)
 
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function info
 
static Local< Uint8Array > ToLocalUint8Array(v8::internal::Handle< v8::internal::JSTypedArray > obj)
 
static RegisteredExtension * first_extension()
 
void FreeThreadResources()
 
void Iterate(v8::internal::ObjectVisitor *v)
 
void InvokeAccessorGetterCallback(v8::Local< v8::String > property, const v8::PropertyCallbackInfo< v8::Value > &info, v8::AccessorGetterCallback getter)
 
Handle< Foreign > NewForeign(Address addr, PretenureFlag pretenure=NOT_TENURED)
 
const int kHandleBlockSize
 
void set(int index, v8::internal::Object *value)
 
static void Register(RegisteredExtension *that)
 
Context * RestoreContext()
 
Isolate * isolate() const 
 
IN DWORD64 OUT PDWORD64 OUT PIMAGEHLP_SYMBOL64 Symbol
 
static FixedArray * cast(Object *obj)
 
static bool ApiCheck(bool condition, const char *location, const char *message)
 
void EnterContext(Handle< Context > context)
 
static Local< FunctionTemplate > ToFunctionTemplate(NeanderObject obj)
 
Address foreign_address()
 
#define STATIC_ASSERT(test)
 
static Local< Uint32Array > ToLocalUint32Array(v8::internal::Handle< v8::internal::JSTypedArray > obj)
 
void DeleteArray(T *array)
 
void DecrementCallDepth()
 
#define OPEN_HANDLE_LIST(V)
 
void InvokeFunctionCallback(const v8::FunctionCallbackInfo< v8::Value > &info, v8::FunctionCallback callback)
 
static Local< External > ExternalToLocal(v8::internal::Handle< v8::internal::JSObject > obj)
 
static Local< ObjectTemplate > ToObjectTemplate(NeanderObject obj)
 
v8::internal::Object * get(int index)
 
#define MAKE_TO_LOCAL(Name, From, To)
 
T * ToApi(v8::internal::Handle< v8::internal::Object > obj)
 
friend class DeferredHandles
 
static v8::Testing::StressType stress_type()