38
38
#ifndef V8_H_
39
39
#define V8_H_
40
40
41
- #include < stdio.h >
41
+ #include " v8stdint.h "
42
42
43
43
#ifdef _WIN32
44
- // When compiling on MinGW stdint.h is available.
45
- #ifdef __MINGW32__
46
- #include < stdint.h>
47
- #else // __MINGW32__
48
- typedef signed char int8_t ;
49
- typedef unsigned char uint8_t ;
50
- typedef short int16_t ; // NOLINT
51
- typedef unsigned short uint16_t ; // NOLINT
52
- typedef int int32_t ;
53
- typedef unsigned int uint32_t ;
54
- typedef __int64 int64_t ;
55
- typedef unsigned __int64 uint64_t ;
56
- // intptr_t and friends are defined in crtdefs.h through stdio.h.
57
- #endif // __MINGW32__
58
44
59
45
// Setup for Windows DLL export/import. When building the V8 DLL the
60
46
// BUILDING_V8_SHARED needs to be defined. When building a program which uses
@@ -76,8 +62,6 @@ typedef unsigned __int64 uint64_t;
76
62
77
63
#else // _WIN32
78
64
79
- #include < stdint.h>
80
-
81
65
// Setup for Linux shared library export. There is no need to distinguish
82
66
// between building or using the V8 shared library, but we should not
83
67
// export symbols when we are building a static library.
@@ -127,7 +111,6 @@ class Arguments;
127
111
class Object ;
128
112
class Heap ;
129
113
class Top ;
130
-
131
114
}
132
115
133
116
@@ -476,10 +459,10 @@ class V8EXPORT HandleScope {
476
459
level = 0 ;
477
460
}
478
461
};
479
-
462
+
480
463
void Leave ();
481
464
482
-
465
+
483
466
internal::Object** prev_next_;
484
467
internal::Object** prev_limit_;
485
468
@@ -1055,7 +1038,7 @@ class String : public Primitive {
1055
1038
*/
1056
1039
V8EXPORT bool IsExternalAscii () const ;
1057
1040
1058
- class V8EXPORT ExternalStringResourceBase {
1041
+ class V8EXPORT ExternalStringResourceBase { // NOLINT
1059
1042
public:
1060
1043
virtual ~ExternalStringResourceBase () {}
1061
1044
@@ -2365,12 +2348,15 @@ class V8EXPORT ResourceConstraints {
2365
2348
void set_max_young_space_size (int value) { max_young_space_size_ = value; }
2366
2349
int max_old_space_size () const { return max_old_space_size_; }
2367
2350
void set_max_old_space_size (int value) { max_old_space_size_ = value; }
2351
+ int max_executable_size () { return max_executable_size_; }
2352
+ void set_max_executable_size (int value) { max_executable_size_ = value; }
2368
2353
uint32_t * stack_limit () const { return stack_limit_; }
2369
2354
// Sets an address beyond which the VM's stack may not grow.
2370
2355
void set_stack_limit (uint32_t * value) { stack_limit_ = value; }
2371
2356
private:
2372
2357
int max_young_space_size_;
2373
2358
int max_old_space_size_;
2359
+ int max_executable_size_;
2374
2360
uint32_t * stack_limit_;
2375
2361
};
2376
2362
@@ -2502,13 +2488,18 @@ class V8EXPORT HeapStatistics {
2502
2488
public:
2503
2489
HeapStatistics ();
2504
2490
size_t total_heap_size () { return total_heap_size_; }
2491
+ size_t total_heap_size_executable () { return total_heap_size_executable_; }
2505
2492
size_t used_heap_size () { return used_heap_size_; }
2506
2493
2507
2494
private:
2508
2495
void set_total_heap_size (size_t size) { total_heap_size_ = size; }
2496
+ void set_total_heap_size_executable (size_t size) {
2497
+ total_heap_size_executable_ = size;
2498
+ }
2509
2499
void set_used_heap_size (size_t size) { used_heap_size_ = size; }
2510
2500
2511
2501
size_t total_heap_size_;
2502
+ size_t total_heap_size_executable_;
2512
2503
size_t used_heap_size_;
2513
2504
2514
2505
friend class V8 ;
@@ -3260,8 +3251,8 @@ class V8EXPORT Locker {
3260
3251
/* *
3261
3252
* An interface for exporting data from V8, using "push" model.
3262
3253
*/
3263
- class V8EXPORT OutputStream {
3264
- public:
3254
+ class V8EXPORT OutputStream { // NOLINT
3255
+ public:
3265
3256
enum OutputEncoding {
3266
3257
kAscii = 0 // 7-bit ASCII.
3267
3258
};
@@ -3291,6 +3282,8 @@ class V8EXPORT OutputStream {
3291
3282
3292
3283
namespace internal {
3293
3284
3285
+ const int kPointerSize = sizeof (void *); // NOLINT
3286
+ const int kIntSize = sizeof (int ); // NOLINT
3294
3287
3295
3288
// Tag information for HeapObject.
3296
3289
const int kHeapObjectTag = 1 ;
@@ -3326,19 +3319,19 @@ template <> struct SmiConstants<8> {
3326
3319
}
3327
3320
};
3328
3321
3329
- const int kSmiShiftSize = SmiConstants<sizeof ( void *) >::kSmiShiftSize ;
3330
- const int kSmiValueSize = SmiConstants<sizeof ( void *) >::kSmiValueSize ;
3322
+ const int kSmiShiftSize = SmiConstants<kPointerSize >::kSmiShiftSize ;
3323
+ const int kSmiValueSize = SmiConstants<kPointerSize >::kSmiValueSize ;
3331
3324
3332
3325
template <size_t ptr_size> struct InternalConstants ;
3333
3326
3334
3327
// Internal constants for 32-bit systems.
3335
3328
template <> struct InternalConstants <4 > {
3336
- static const int kStringResourceOffset = 3 * sizeof ( void *) ;
3329
+ static const int kStringResourceOffset = 3 * kPointerSize ;
3337
3330
};
3338
3331
3339
3332
// Internal constants for 64-bit systems.
3340
3333
template <> struct InternalConstants <8 > {
3341
- static const int kStringResourceOffset = 3 * sizeof ( void *) ;
3334
+ static const int kStringResourceOffset = 3 * kPointerSize ;
3342
3335
};
3343
3336
3344
3337
/* *
@@ -3352,12 +3345,12 @@ class Internals {
3352
3345
// These values match non-compiler-dependent values defined within
3353
3346
// the implementation of v8.
3354
3347
static const int kHeapObjectMapOffset = 0 ;
3355
- static const int kMapInstanceTypeOffset = sizeof ( void *) + sizeof ( int ) ;
3348
+ static const int kMapInstanceTypeOffset = kPointerSize + kIntSize ;
3356
3349
static const int kStringResourceOffset =
3357
- InternalConstants<sizeof ( void *) >::kStringResourceOffset ;
3350
+ InternalConstants<kPointerSize >::kStringResourceOffset ;
3358
3351
3359
- static const int kProxyProxyOffset = sizeof ( void *) ;
3360
- static const int kJSObjectHeaderSize = 3 * sizeof ( void *) ;
3352
+ static const int kProxyProxyOffset = kPointerSize ;
3353
+ static const int kJSObjectHeaderSize = 3 * kPointerSize ;
3361
3354
static const int kFullStringRepresentationMask = 0x07 ;
3362
3355
static const int kExternalTwoByteRepresentationTag = 0x02 ;
3363
3356
@@ -3375,7 +3368,7 @@ class Internals {
3375
3368
}
3376
3369
3377
3370
static inline int SmiValue (internal::Object* value) {
3378
- return SmiConstants<sizeof ( void *) >::SmiToInt (value);
3371
+ return SmiConstants<kPointerSize >::SmiToInt (value);
3379
3372
}
3380
3373
3381
3374
static inline int GetInstanceType (internal::Object* obj) {
@@ -3404,10 +3397,9 @@ class Internals {
3404
3397
uint8_t * addr = reinterpret_cast <uint8_t *>(ptr) + offset - kHeapObjectTag ;
3405
3398
return *reinterpret_cast <T*>(addr);
3406
3399
}
3407
-
3408
3400
};
3409
3401
3410
- }
3402
+ } // namespace internal
3411
3403
3412
3404
3413
3405
template <class T >
@@ -3567,7 +3559,7 @@ Local<Value> Object::UncheckedGetInternalField(int index) {
3567
3559
// If the object is a plain JSObject, which is the common case,
3568
3560
// we know where to find the internal fields and can return the
3569
3561
// value directly.
3570
- int offset = I::kJSObjectHeaderSize + (sizeof ( void *) * index );
3562
+ int offset = I::kJSObjectHeaderSize + (internal:: kPointerSize * index );
3571
3563
O* value = I::ReadField<O*>(obj, offset);
3572
3564
O** result = HandleScope::CreateHandle (value);
3573
3565
return Local<Value>(reinterpret_cast <Value*>(result));
@@ -3603,7 +3595,7 @@ void* Object::GetPointerFromInternalField(int index) {
3603
3595
// If the object is a plain JSObject, which is the common case,
3604
3596
// we know where to find the internal fields and can return the
3605
3597
// value directly.
3606
- int offset = I::kJSObjectHeaderSize + (sizeof ( void *) * index );
3598
+ int offset = I::kJSObjectHeaderSize + (internal:: kPointerSize * index );
3607
3599
O* value = I::ReadField<O*>(obj, offset);
3608
3600
return I::GetExternalPointer (value);
3609
3601
}
0 commit comments