33 #include "../include/v8-testing.h"
95 : value_(v8::internal::
Handle<v8::internal::JSObject>::cast(obj)) { }
99 : value_(v8::internal::
Handle<v8::internal::JSObject>(
100 v8::internal::JSObject::cast(obj))) { }
114 ASSERT(value_->HasFastObjectElements());
121 return reinterpret_cast<T>(
122 reinterpret_cast<intptr_t
>(
127 template <
typename T>
131 reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj)));
162 #define OPEN_HANDLE_LIST(V) \
163 V(Template, TemplateInfo) \
164 V(FunctionTemplate, FunctionTemplateInfo) \
165 V(ObjectTemplate, ObjectTemplateInfo) \
166 V(Signature, SignatureInfo) \
167 V(AccessorSignature, FunctionTemplateInfo) \
168 V(TypeSwitch, TypeSwitchInfo) \
170 V(RegExp, JSRegExp) \
171 V(Object, JSObject) \
175 V(Function, JSFunction) \
176 V(Message, JSObject) \
177 V(Context, Context) \
178 V(External, Foreign) \
179 V(StackTrace, JSArray) \
180 V(StackFrame, JSObject)
229 #define DECLARE_OPEN_HANDLE(From, To) \
230 static inline v8::internal::Handle<v8::internal::To> \
231 OpenHandle(const From* that, bool allow_empty_handle = false);
235 #undef DECLARE_OPEN_HANDLE
241 return reinterpret_cast<T*
>(obj.
location());
258 #define MAKE_TO_LOCAL(Name, From, To) \
259 Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \
260 ASSERT(obj.is_null() || !obj->IsTheHole()); \
261 return Local<To>(reinterpret_cast<To*>(obj.location())); \
272 MAKE_TO_LOCAL(ToLocal, FunctionTemplateInfo, FunctionTemplate)
275 MAKE_TO_LOCAL(AccessorSignatureToLocal, FunctionTemplateInfo, AccessorSignature)
289 #define MAKE_OPEN_HANDLE(From, To) \
290 v8::internal::Handle<v8::internal::To> Utils::OpenHandle( \
291 const v8::From* that, bool allow_empty_handle) { \
292 EXTRA_CHECK(allow_empty_handle || that != NULL); \
293 return v8::internal::Handle<v8::internal::To>( \
294 reinterpret_cast<v8::internal::To**>(const_cast<v8::From*>(that))); \
299 #undef MAKE_OPEN_HANDLE
300 #undef OPEN_HANDLE_LIST
318 if (IsFreshString(address, top)) {
319 IncrementUseCount(top);
329 return IsFreshString(address, top) && IsUseCountLow(top);
336 return top - kFreshnessLimit <=
string &&
string <= top;
339 inline bool IsUseCountLow(
Address top) {
340 if (last_top_ != top)
return true;
341 return use_count_ < kUseLimit;
344 inline void IncrementUseCount(
Address top) {
345 if (last_top_ != top) {
361 static const int kFreshnessLimit = 1024;
364 static const int kUseLimit = 32;
380 first_block_limit_(first_block_limit),
385 void Iterate(ObjectVisitor* v);
390 Object** first_block_limit_;
412 entered_contexts_(0),
416 last_handle_before_deferred_block_(
NULL) { }
429 void Iterate(v8::internal::ObjectVisitor* v);
430 static char*
Iterate(v8::internal::ObjectVisitor* v,
char* data);
461 void ResetAfterArchive() {
462 blocks_.Initialize(0);
463 entered_contexts_.Initialize(0);
464 saved_contexts_.Initialize(0);
466 last_handle_before_deferred_block_ =
NULL;
471 ASSERT(blocks_.length() == 0);
472 ASSERT(entered_contexts_.length() == 0);
473 ASSERT(saved_contexts_.length() == 0);
475 entered_contexts_.Free();
476 saved_contexts_.Free();
477 if (spare_ !=
NULL) {
484 void BeginDeferredScope();
488 List<internal::Object**> blocks_;
490 List<Handle<Object> > entered_contexts_;
492 List<Context*> saved_contexts_;
495 Object** last_handle_before_deferred_block_;
499 void IterateThis(ObjectVisitor* v);
500 char* RestoreThreadHelper(
char* from);
501 char* ArchiveThreadHelper(
char* to);
514 saved_contexts_.Add(context);
519 return saved_contexts_.RemoveLast();
524 return !saved_contexts_.is_empty();
529 entered_contexts_.Add(context);
534 if (entered_contexts_.is_empty())
return false;
535 entered_contexts_.RemoveLast();
542 return entered_contexts_.last();
557 while (!blocks_.is_empty()) {
562 if (block_start <= prev_limit && prev_limit <= block_limit)
break;
564 if (prev_limit == block_limit)
break;
567 blocks_.RemoveLast();
569 v8::ImplementationUtilities::ZapHandleRange(block_start, block_limit);
571 if (spare_ !=
NULL) {
574 spare_ = block_start;
576 ASSERT((blocks_.is_empty() && prev_limit ==
NULL) ||
577 (!blocks_.is_empty() && prev_limit !=
NULL));
void SaveContext(Context *context)
static void set_stress_type(v8::Testing::StressType stress_type)
RegisteredExtension * next()
internal::Object ** GetSpareOrNewBlock()
HandleScopeImplementer(Isolate *isolate)
void RecordWrite(Handle< String > string)
v8::internal::Handle< v8::internal::JSObject > value()
void set(int index, v8::internal::Object *value)
static Local< Number > NumberToLocal(v8::internal::Handle< v8::internal::Object > obj)
char * ArchiveThread(char *to)
static Local< AccessorSignature > AccessorSignatureToLocal(v8::internal::Handle< v8::internal::FunctionTemplateInfo > obj)
char * RestoreThread(char *from)
#define DECLARE_OPEN_HANDLE(From, To)
v8::HandleScope::Data HandleScopeData
static Foreign * cast(Object *obj)
void DeleteExtensions(internal::Object **prev_limit)
T ToCData(v8::internal::Object *obj)
#define ASSERT(condition)
void EnterContext(Handle< Object > context)
void LinkDeferredHandles(DeferredHandles *deferred_handles)
Handle< Object > LastEnteredContext()
v8::internal::Address address()
v8::internal::Handle< v8::internal::JSObject > value()
#define MAKE_OPEN_HANDLE(From, To)
static Local< StackFrame > StackFrameToLocal(v8::internal::Handle< v8::internal::JSObject > 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)
static int ArchiveSpacePerThread()
void IncrementCallDepth()
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit 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 SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available 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 MIPS FPU instructions if expose natives in global object expose gc extension number of stack frames to capture disable builtin natives files print a stack trace if an assertion failure occurs use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations prepare for turning on always opt minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions automatically set the debug break flag when debugger commands are in the queue always cause a debug break before aborting 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 more details following each garbage collection print amount of external allocated memory after each time it is adjusted flush code that we expect not to use again before full gc do incremental marking steps track object counts and memory usage use caching Perform compaction on every full GC Never perform compaction on full GC testing only Compact code space on full incremental collections Default seed for initializing random allows verbose printing trace parsing and preparsing Check icache flushes in ARM and MIPS simulator Stack alingment in bytes in print stack trace when throwing exceptions randomize hashes to avoid predictable hash Fixed seed to use to hash property activate a timer that switches between V8 threads testing_bool_flag float flag Seed used for threading test randomness A filename with extra code to be included in the Print usage message
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
static Local< Integer > IntegerToLocal(v8::internal::Handle< v8::internal::Object > obj)
static void UnregisterAll()
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
#define T(name, string, precedence)
void ReturnBlock(Object **block)
RegisteredExtension(Extension *extension)
List< internal::Object ** > * blocks()
bool IsFreshUnusedString(Handle< String > string)
~HandleScopeImplementer()
void add(v8::internal::Handle< v8::internal::Object > value)
static RegisteredExtension * first_extension()
void FreeThreadResources()
v8::internal::Handle< v8::internal::Object > FromCData(T obj)
void Iterate(v8::internal::ObjectVisitor *v)
Handle< T > EscapeFrom(v8::HandleScope *scope)
RegisteredExtension * next_auto()
const int kHandleBlockSize
void set(int index, v8::internal::Object *value)
static void Register(RegisteredExtension *that)
Context * RestoreContext()
Isolate * isolate() const
Local< T > Close(Handle< T > value)
static FixedArray * cast(Object *obj)
static bool ReportApiFailure(const char *location, const char *message)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit 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 SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available 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 MIPS FPU instructions if NULL
static Local< FunctionTemplate > ToFunctionTemplate(NeanderObject obj)
Address foreign_address()
#define STATIC_ASSERT(test)
void DeleteArray(T *array)
void DecrementCallDepth()
#define OPEN_HANDLE_LIST(V)
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()