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