OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_GLOBALS_H_ | 5 #ifndef V8_GLOBALS_H_ |
6 #define V8_GLOBALS_H_ | 6 #define V8_GLOBALS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 (((value) + kPointerAlignmentMask) & ~kPointerAlignmentMask) | 638 (((value) + kPointerAlignmentMask) & ~kPointerAlignmentMask) |
639 | 639 |
640 // CODE_POINTER_ALIGN returns the value aligned as a generated code segment. | 640 // CODE_POINTER_ALIGN returns the value aligned as a generated code segment. |
641 #define CODE_POINTER_ALIGN(value) \ | 641 #define CODE_POINTER_ALIGN(value) \ |
642 (((value) + kCodeAlignmentMask) & ~kCodeAlignmentMask) | 642 (((value) + kCodeAlignmentMask) & ~kCodeAlignmentMask) |
643 | 643 |
644 // DOUBLE_POINTER_ALIGN returns the value algined for double pointers. | 644 // DOUBLE_POINTER_ALIGN returns the value algined for double pointers. |
645 #define DOUBLE_POINTER_ALIGN(value) \ | 645 #define DOUBLE_POINTER_ALIGN(value) \ |
646 (((value) + kDoubleAlignmentMask) & ~kDoubleAlignmentMask) | 646 (((value) + kDoubleAlignmentMask) & ~kDoubleAlignmentMask) |
647 | 647 |
648 // Support for tracking C++ memory allocation. Insert TRACK_MEMORY("Fisk") | |
649 // inside a C++ class and new and delete will be overloaded so logging is | |
650 // performed. | |
651 // This file (globals.h) is included before log.h, so we use direct calls to | |
652 // the Logger rather than the LOG macro. | |
653 #ifdef DEBUG | |
654 #define TRACK_MEMORY(name) \ | |
655 void* operator new(size_t size) { \ | |
656 void* result = ::operator new(size); \ | |
657 Logger::NewEventStatic(name, result, size); \ | |
658 return result; \ | |
659 } \ | |
660 void operator delete(void* object) { \ | |
661 Logger::DeleteEventStatic(name, object); \ | |
662 ::operator delete(object); \ | |
663 } | |
664 #else | |
665 #define TRACK_MEMORY(name) | |
666 #endif | |
667 | |
668 | 648 |
669 // CPU feature flags. | 649 // CPU feature flags. |
670 enum CpuFeature { | 650 enum CpuFeature { |
671 // x86 | 651 // x86 |
672 SSE4_1, | 652 SSE4_1, |
673 SSE3, | 653 SSE3, |
674 SAHF, | 654 SAHF, |
675 AVX, | 655 AVX, |
676 FMA3, | 656 FMA3, |
677 BMI1, | 657 BMI1, |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { | 928 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { |
949 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); | 929 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); |
950 DCHECK(IsValidFunctionKind(kind)); | 930 DCHECK(IsValidFunctionKind(kind)); |
951 return kind; | 931 return kind; |
952 } | 932 } |
953 } } // namespace v8::internal | 933 } } // namespace v8::internal |
954 | 934 |
955 namespace i = v8::internal; | 935 namespace i = v8::internal; |
956 | 936 |
957 #endif // V8_GLOBALS_H_ | 937 #endif // V8_GLOBALS_H_ |
OLD | NEW |