Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: src/isolate.h

Issue 6628036: [Isolates] Add debugging code to ensure consistent Isolate class layout. (Closed)
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 662
663 char* ArchiveThread(char* to); 663 char* ArchiveThread(char* to);
664 char* RestoreThread(char* from); 664 char* RestoreThread(char* from);
665 665
666 static const char* const kStackOverflowMessage; 666 static const char* const kStackOverflowMessage;
667 667
668 static const int kUC16AlphabetSize = 256; // See StringSearchBase. 668 static const int kUC16AlphabetSize = 256; // See StringSearchBase.
669 static const int kBMMaxShift = 250; // See StringSearchBase. 669 static const int kBMMaxShift = 250; // See StringSearchBase.
670 670
671 // Accessors. 671 // Accessors.
672 #define GLOBAL_ACCESSOR(type, name, initialvalue) \ 672 #define GLOBAL_ACCESSOR(type, name, initialvalue) \
673 type name() const { return name##_; } \ 673 inline type name() const { \
674 void set_##name(type value) { name##_ = value; } 674 ASSERT(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \
675 return name##_; \
676 } \
677 inline void set_##name(type value) { \
678 ASSERT(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \
679 name##_ = value; \
680 }
675 ISOLATE_INIT_LIST(GLOBAL_ACCESSOR) 681 ISOLATE_INIT_LIST(GLOBAL_ACCESSOR)
676 #undef GLOBAL_ACCESSOR 682 #undef GLOBAL_ACCESSOR
677 683
678 #define GLOBAL_ARRAY_ACCESSOR(type, name, length) \ 684 #define GLOBAL_ARRAY_ACCESSOR(type, name, length) \
679 type* name() { return &(name##_[0]); } 685 inline type* name() { \
686 ASSERT(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \
687 return &(name##_)[0]; \
688 }
680 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_ACCESSOR) 689 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_ACCESSOR)
681 #undef GLOBAL_ARRAY_ACCESSOR 690 #undef GLOBAL_ARRAY_ACCESSOR
682 691
683 #define GLOBAL_CONTEXT_FIELD_ACCESSOR(index, type, name) \ 692 #define GLOBAL_CONTEXT_FIELD_ACCESSOR(index, type, name) \
684 Handle<type> name() { \ 693 Handle<type> name() { \
685 return Handle<type>(context()->global_context()->name()); \ 694 return Handle<type>(context()->global_context()->name()); \
686 } 695 }
687 GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSOR) 696 GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSOR)
688 #undef GLOBAL_CONTEXT_FIELD_ACCESSOR 697 #undef GLOBAL_CONTEXT_FIELD_ACCESSOR
689 698
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 #define GLOBAL_BACKING_STORE(type, name, initialvalue) \ 1092 #define GLOBAL_BACKING_STORE(type, name, initialvalue) \
1084 type name##_; 1093 type name##_;
1085 ISOLATE_INIT_LIST(GLOBAL_BACKING_STORE) 1094 ISOLATE_INIT_LIST(GLOBAL_BACKING_STORE)
1086 #undef GLOBAL_BACKING_STORE 1095 #undef GLOBAL_BACKING_STORE
1087 1096
1088 #define GLOBAL_ARRAY_BACKING_STORE(type, name, length) \ 1097 #define GLOBAL_ARRAY_BACKING_STORE(type, name, length) \
1089 type name##_[length]; 1098 type name##_[length];
1090 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_BACKING_STORE) 1099 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_BACKING_STORE)
1091 #undef GLOBAL_ARRAY_BACKING_STORE 1100 #undef GLOBAL_ARRAY_BACKING_STORE
1092 1101
1102 #ifdef DEBUG
1103 // This class is huge and has a number of fields controlled by
1104 // preprocessor defines. Make sure the offsets of these fields agree
1105 // between compilation units.
1106 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
1107 static const intptr_t name##_debug_offset_;
1108 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
1109 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
1110 #undef ISOLATE_FIELD_OFFSET
1111 #endif
1112
1093 friend class ExecutionAccess; 1113 friend class ExecutionAccess;
1094 friend class IsolateInitializer; 1114 friend class IsolateInitializer;
1095 friend class v8::Isolate; 1115 friend class v8::Isolate;
1096 friend class v8::Locker; 1116 friend class v8::Locker;
1097 1117
1098 DISALLOW_COPY_AND_ASSIGN(Isolate); 1118 DISALLOW_COPY_AND_ASSIGN(Isolate);
1099 }; 1119 };
1100 1120
1101 1121
1102 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the 1122 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 1286
1267 } } // namespace v8::internal 1287 } } // namespace v8::internal
1268 1288
1269 // TODO(isolates): Get rid of these -inl.h includes and place them only where 1289 // TODO(isolates): Get rid of these -inl.h includes and place them only where
1270 // they're needed. 1290 // they're needed.
1271 #include "allocation-inl.h" 1291 #include "allocation-inl.h"
1272 #include "zone-inl.h" 1292 #include "zone-inl.h"
1273 #include "frames-inl.h" 1293 #include "frames-inl.h"
1274 1294
1275 #endif // V8_ISOLATE_H_ 1295 #endif // V8_ISOLATE_H_
OLDNEW
« no previous file with comments | « no previous file | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698