31 #include <sys/types.h> 
   46 using namespace v8::internal;
 
   59   Address current_address = original_address;
 
   66     Address value = s.Pop()->address();
 
   71   CHECK_EQ(original_address, current_address);
 
  127   FLAG_incremental_marking = 
false;
 
  141   MaybeObject* maybe_array;
 
  144   } 
while (maybe_array->ToObject(&array));
 
  151   MaybeObject* maybe_mapp;
 
  154   } 
while (maybe_mapp->ToObject(&mapp));
 
  167                              heap->undefined_value())->ToObjectChecked());
 
  171   function->set_initial_map(initial_map);
 
  184   CHECK(func_value->IsJSFunction());
 
  203         GetProperty(obj_name)->ToObjectChecked()->IsJSObject());
 
  220   FLAG_max_map_space_pages = 16;
 
  232       map->set_prototype(*root);
 
  234     } 
while (
CcTest::heap()->map_space()->MapPointersEncodable());
 
  247 static int NumberOfWeakCalls = 0;
 
  248 static void WeakPointerCallback(
 
  250   std::pair<v8::Persistent<v8::Value>*, 
int>* p =
 
  251       reinterpret_cast<std::pair<v8::Persistent<v8::Value>*, 
int>*>(
 
  260   FLAG_incremental_marking = 
false;
 
  264   NumberOfWeakCalls = 0;
 
  273   std::pair<Handle<Object>*, 
int> g1s1_and_id(&g1s1, 1234);
 
  275                           reinterpret_cast<void*
>(&g1s1_and_id),
 
  276                           &WeakPointerCallback);
 
  277   std::pair<Handle<Object>*, 
int> g1s2_and_id(&g1s2, 1234);
 
  279                           reinterpret_cast<void*
>(&g1s2_and_id),
 
  280                           &WeakPointerCallback);
 
  281   std::pair<Handle<Object>*, 
int> g1c1_and_id(&g1c1, 1234);
 
  283                           reinterpret_cast<void*
>(&g1c1_and_id),
 
  284                           &WeakPointerCallback);
 
  292   std::pair<Handle<Object>*, 
int> g2s1_and_id(&g2s1, 1234);
 
  294                           reinterpret_cast<void*
>(&g2s1_and_id),
 
  295                           &WeakPointerCallback);
 
  296   std::pair<Handle<Object>*, 
int> g2s2_and_id(&g2s2, 1234);
 
  298                           reinterpret_cast<void*
>(&g2s2_and_id),
 
  299                           &WeakPointerCallback);
 
  300   std::pair<Handle<Object>*, 
int> g2c1_and_id(&g2c1, 1234);
 
  302                           reinterpret_cast<void*
>(&g2c1_and_id),
 
  303                           &WeakPointerCallback);
 
  312     Object** g1_objects[] = { g1s1.location(), g1s2.location() };
 
  313     Object** g1_children[] = { g1c1.location() };
 
  314     Object** g2_objects[] = { g2s1.location(), g2s2.location() };
 
  315     Object** g2_children[] = { g2c1.location() };
 
  330   std::pair<Handle<Object>*, 
int> root_and_id(&root, 1234);
 
  332                           reinterpret_cast<void*
>(&root_and_id),
 
  333                           &WeakPointerCallback);
 
  341     Object** g1_objects[] = { g1s1.location(), g1s2.location() };
 
  342     Object** g1_children[] = { g1c1.location() };
 
  343     Object** g2_objects[] = { g2s1.location(), g2s2.location() };
 
  344     Object** g2_children[] = { g2c1.location() };
 
  360                           reinterpret_cast<void*
>(&g1c1_and_id),
 
  361                           &WeakPointerCallback);
 
  363                           reinterpret_cast<void*
>(&g2c1_and_id),
 
  364                           &WeakPointerCallback);
 
  378     ASSERT(!has_been_disposed_);
 
  379     has_been_disposed_ = 
true;
 
  383     return other == 
this;
 
  388   virtual const char* 
GetLabel() { 
return "whatever"; }
 
  391   bool has_been_disposed_;
 
  402       CcTest::heap()->AllocateFixedArray(1)->ToObjectChecked());
 
  404   TestRetainedObjectInfo 
info;
 
  406   ASSERT(info.has_been_disposed());
 
  413 #if defined(__has_feature) 
  414 #if __has_feature(address_sanitizer) 
  415 #define V8_WITH_ASAN 1 
  423 #if defined(__linux__) && !defined(USE_SIMULATOR) && !defined(V8_WITH_ASAN) 
  426 static uintptr_t ReadLong(
char* buffer, intptr_t* position, 
int base) {
 
  427   char* end_address = buffer + *position;
 
  428   uintptr_t result = strtoul(buffer + *position, &end_address, base);
 
  429   CHECK(result != ULONG_MAX || errno != ERANGE);
 
  430   CHECK(end_address > buffer + *position);
 
  431   *position = end_address - buffer;
 
  440 static intptr_t MemoryInUse() {
 
  441   intptr_t memory_use = 0;
 
  443   int fd = open(
"/proc/self/maps", O_RDONLY);
 
  444   if (fd < 0) 
return -1;
 
  446   const int kBufSize = 10000;
 
  447   char buffer[kBufSize];
 
  448   int length = read(fd, buffer, kBufSize);
 
  449   intptr_t line_start = 0;
 
  452   while (line_start < length) {
 
  453     if (buffer[line_start] == 
'\n') {
 
  457     intptr_t position = line_start;
 
  458     uintptr_t start = ReadLong(buffer, &position, 16);
 
  460     uintptr_t end = ReadLong(buffer, &position, 16);
 
  462     CHECK(buffer[position] == 
'-' || buffer[position] == 
'r');
 
  463     bool read_permission = (buffer[position++] == 
'r');
 
  464     CHECK(buffer[position] == 
'-' || buffer[position] == 
'w');
 
  465     bool write_permission = (buffer[position++] == 
'w');
 
  466     CHECK(buffer[position] == 
'-' || buffer[position] == 
'x');
 
  467     bool execute_permission = (buffer[position++] == 
'x');
 
  468     CHECK(buffer[position] == 
'-' || buffer[position] == 
'p');
 
  469     bool private_mapping = (buffer[position++] == 
'p');
 
  471     uintptr_t offset = ReadLong(buffer, &position, 16);
 
  474     uintptr_t major = ReadLong(buffer, &position, 16);
 
  477     uintptr_t minor = ReadLong(buffer, &position, 16);
 
  480     uintptr_t inode = ReadLong(buffer, &position, 10);
 
  481     while (position < length && buffer[position] != 
'\n') position++;
 
  482     if ((read_permission || write_permission || execute_permission) &&
 
  483         private_mapping && inode == 0) {
 
  484       memory_use += (end - start);
 
  487     line_start = position;
 
  494 TEST(BootUpMemoryUse) {
 
  495   intptr_t initial_memory = MemoryInUse();
 
  497   FLAG_crankshaft = 
false;
 
  498   FLAG_concurrent_osr = 
false;
 
  499   FLAG_concurrent_recompilation = 
false;
 
  503   if (initial_memory >= 0) {
 
  505     intptr_t delta = MemoryInUse() - initial_memory;
 
  507     if (
sizeof(initial_memory) == 8) {  
 
  524 intptr_t ShortLivingIsolate() {
 
  533   return MemoryInUse();
 
  537 TEST(RegressJoinThreadsOnIsolateDeinit) {
 
  538   intptr_t size_limit = ShortLivingIsolate() * 2;
 
  539   for (
int i = 0; i < 10; i++) {
 
  540     CHECK_GT(size_limit, ShortLivingIsolate());
 
  544 #endif  // __linux__ and !USE_SIMULATOR 
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
#define CHECK_EQ(expected, value)
void CollectAllGarbage(int flags, const char *gc_reason=NULL, const GCCallbackFlags gc_callback_flags=kNoGCCallbackFlags)
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 map
static String * cast(Object *obj)
static Smi * FromInt(int value)
static Handle< T > cast(Handle< S > that)
void AddImplicitReferences(HeapObject **parent, Object ***children, size_t length)
static Map * cast(Object *obj)
#define ASSERT(condition)
bool InSpace(Address addr, AllocationSpace space)
static SharedFunctionInfo * cast(Object *obj)
Handle< Object > GetProperty(Handle< JSReceiver > obj, const char *name)
void AddObjectGroup(Object ***handles, size_t length, v8::RetainedObjectInfo *info)
virtual bool IsEquivalent(v8::RetainedObjectInfo *other)
MUST_USE_RESULT MaybeObject * AllocateJSObject(JSFunction *constructor, PretenureFlag pretenure=NOT_TENURED, AllocationSite *allocation_site=NULL)
GlobalObject * global_object()
Handle< JSObject > NewJSObjectFromMap(Handle< Map > map, PretenureFlag pretenure=NOT_TENURED, bool allocate_properties=true, Handle< AllocationSite > allocation_site=Handle< AllocationSite >::null())
Handle< Object > Create(Object *value)
void Initialize(Address low, Address high)
GlobalHandles * global_handles()
static const int kMaxRegularHeapObjectSize
static void * ClearWeakness(Object **location)
OldSpace * old_pointer_space()
bool ConfigureHeap(int max_semispace_size, intptr_t max_old_gen_size, intptr_t max_executable_size)
static i::Isolate * i_isolate()
bool CollectGarbage(AllocationSpace space, const char *gc_reason=NULL, const GCCallbackFlags gc_callback_flags=kNoGCCallbackFlags)
V8_INLINE P * GetParameter() const 
virtual intptr_t GetHash()
static const int kHeaderSize
static Local< Context > New(Isolate *isolate, ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
static void InitializeVM()
static Handle< Object > SetProperty(Handle< JSReceiver > object, Handle< Name > key, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
Handle< T > handle(T *t, Isolate *isolate)
V8_INLINE bool IsEmpty() const 
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 void MakeWeak(Object **location, void *parameter, WeakCallback weak_callback)
virtual const char * GetLabel()
#define ASSERT_EQ(v1, v2)
static HeapObject * FromAddress(Address address)
MUST_USE_RESULT MaybeObject * AllocateFixedArray(int length, PretenureFlag pretenure=NOT_TENURED)
static FixedArray * cast(Object *obj)
MUST_USE_RESULT MaybeObject * InternalizeUtf8String(const char *str)
static const int kHeaderSize
MUST_USE_RESULT MaybeObject * AllocateSharedFunctionInfo(Object *name)
void DeleteArray(T *array)
Handle< Map > NewMap(InstanceType type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND)
MUST_USE_RESULT MaybeObject * AllocateMap(InstanceType instance_type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND)
static JSObject * cast(Object *obj)
MUST_USE_RESULT MaybeObject * AllocateFunction(Map *function_map, SharedFunctionInfo *shared, Object *prototype, PretenureFlag pretenure=TENURED)
static v8::Isolate * isolate()
static bool HasLocalProperty(Handle< JSReceiver >, Handle< Name > name)
static JSFunction * cast(Object *obj)