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

Side by Side Diff: tools/gen-postmortem-metadata.py

Issue 2051563003: Move post-mortem constants from accessors table to constants table (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Created 4 years, 6 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # 3 #
4 # Copyright 2012 the V8 project authors. All rights reserved. 4 # Copyright 2012 the V8 project authors. All rights reserved.
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 # v8dbg_NAME = VALUE Miscellaneous values 43 # v8dbg_NAME = VALUE Miscellaneous values
44 # 44 #
45 # These constants are declared as global integers so that they'll be present in 45 # These constants are declared as global integers so that they'll be present in
46 # the generated libv8 binary. 46 # the generated libv8 binary.
47 # 47 #
48 48
49 import re 49 import re
50 import sys 50 import sys
51 51
52 # 52 #
53 # Miscellaneous constants, tags, and masks used for object identification. 53 # Miscellaneous constants such as tags and masks used for object identification,
54 # enumeration values used as indexes in internal tables, etc..
54 # 55 #
55 consts_misc = [ 56 consts_misc = [
56 { 'name': 'FirstNonstringType', 'value': 'FIRST_NONSTRING_TYPE' }, 57 { 'name': 'FirstNonstringType', 'value': 'FIRST_NONSTRING_TYPE' },
57 58
58 { 'name': 'IsNotStringMask', 'value': 'kIsNotStringMask' }, 59 { 'name': 'IsNotStringMask', 'value': 'kIsNotStringMask' },
59 { 'name': 'StringTag', 'value': 'kStringTag' }, 60 { 'name': 'StringTag', 'value': 'kStringTag' },
60 { 'name': 'NotStringTag', 'value': 'kNotStringTag' }, 61 { 'name': 'NotStringTag', 'value': 'kNotStringTag' },
61 62
62 { 'name': 'StringEncodingMask', 'value': 'kStringEncodingMask' }, 63 { 'name': 'StringEncodingMask', 'value': 'kStringEncodingMask' },
63 { 'name': 'TwoByteStringTag', 'value': 'kTwoByteStringTag' }, 64 { 'name': 'TwoByteStringTag', 'value': 'kTwoByteStringTag' },
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 'value': 'Map::DictionaryMap::kShift' }, 150 'value': 'Map::DictionaryMap::kShift' },
150 { 'name': 'bit_field3_number_of_own_descriptors_mask', 151 { 'name': 'bit_field3_number_of_own_descriptors_mask',
151 'value': 'Map::NumberOfOwnDescriptorsBits::kMask' }, 152 'value': 'Map::NumberOfOwnDescriptorsBits::kMask' },
152 { 'name': 'bit_field3_number_of_own_descriptors_shift', 153 { 'name': 'bit_field3_number_of_own_descriptors_shift',
153 'value': 'Map::NumberOfOwnDescriptorsBits::kShift' }, 154 'value': 'Map::NumberOfOwnDescriptorsBits::kShift' },
154 155
155 { 'name': 'off_fp_context', 156 { 'name': 'off_fp_context',
156 'value': 'StandardFrameConstants::kContextOffset' }, 157 'value': 'StandardFrameConstants::kContextOffset' },
157 { 'name': 'off_fp_constant_pool', 158 { 'name': 'off_fp_constant_pool',
158 'value': 'StandardFrameConstants::kConstantPoolOffset' }, 159 'value': 'StandardFrameConstants::kConstantPoolOffset' },
160 { 'name': 'off_fp_marker',
julien.gilli 2016/06/09 18:19:15 This change was not supposed to be submitted, I'll
161 'value': 'StandardFrameConstants::kMarkerOffset' },
159 { 'name': 'off_fp_function', 162 { 'name': 'off_fp_function',
160 'value': 'JavaScriptFrameConstants::kFunctionOffset' }, 163 'value': 'JavaScriptFrameConstants::kFunctionOffset' },
161 { 'name': 'off_fp_args', 164 { 'name': 'off_fp_args',
162 'value': 'JavaScriptFrameConstants::kLastParameterOffset' }, 165 'value': 'JavaScriptFrameConstants::kLastParameterOffset' },
163 166
164 { 'name': 'scopeinfo_idx_nparams', 167 { 'name': 'scopeinfo_idx_nparams',
165 'value': 'ScopeInfo::kParameterCount' }, 168 'value': 'ScopeInfo::kParameterCount' },
166 { 'name': 'scopeinfo_idx_nstacklocals', 169 { 'name': 'scopeinfo_idx_nstacklocals',
167 'value': 'ScopeInfo::kStackLocalCount' }, 170 'value': 'ScopeInfo::kStackLocalCount' },
168 { 'name': 'scopeinfo_idx_ncontextlocals', 171 { 'name': 'scopeinfo_idx_ncontextlocals',
169 'value': 'ScopeInfo::kContextLocalCount' }, 172 'value': 'ScopeInfo::kContextLocalCount' },
170 { 'name': 'scopeinfo_idx_ncontextglobals', 173 { 'name': 'scopeinfo_idx_ncontextglobals',
171 'value': 'ScopeInfo::kContextGlobalCount' }, 174 'value': 'ScopeInfo::kContextGlobalCount' },
172 { 'name': 'scopeinfo_idx_first_vars', 175 { 'name': 'scopeinfo_idx_first_vars',
173 'value': 'ScopeInfo::kVariablePartIndex' }, 176 'value': 'ScopeInfo::kVariablePartIndex' },
174 177
175 { 'name': 'sharedfunctioninfo_start_position_mask', 178 { 'name': 'sharedfunctioninfo_start_position_mask',
176 'value': 'SharedFunctionInfo::kStartPositionMask' }, 179 'value': 'SharedFunctionInfo::kStartPositionMask' },
177 { 'name': 'sharedfunctioninfo_start_position_shift', 180 { 'name': 'sharedfunctioninfo_start_position_shift',
178 'value': 'SharedFunctionInfo::kStartPositionShift' }, 181 'value': 'SharedFunctionInfo::kStartPositionShift' },
179 182
180 { 'name': 'jsarray_buffer_was_neutered_mask', 183 { 'name': 'jsarray_buffer_was_neutered_mask',
181 'value': 'JSArrayBuffer::WasNeutered::kMask' }, 184 'value': 'JSArrayBuffer::WasNeutered::kMask' },
182 { 'name': 'jsarray_buffer_was_neutered_shift', 185 { 'name': 'jsarray_buffer_was_neutered_shift',
183 'value': 'JSArrayBuffer::WasNeutered::kShift' }, 186 'value': 'JSArrayBuffer::WasNeutered::kShift' },
187
188 { 'name': 'context_idx_closure',
189 'value': 'Context::CLOSURE_INDEX' },
190 { 'name': 'context_idx_native',
191 'value': 'Context::NATIVE_CONTEXT_INDEX' },
192 { 'name': 'context_idx_prev',
193 'value': 'Context::PREVIOUS_INDEX' },
194 { 'name': 'context_idx_ext',
195 'value': 'Context::EXTENSION_INDEX' },
196 { 'name': 'context_min_slots',
197 'value': 'Context::MIN_CONTEXT_SLOTS' },
198
199 { 'name': 'namedictionaryshape_prefix_size',
200 'value': 'NameDictionaryShape::kPrefixSize' },
201 { 'name': 'namedictionaryshape_entry_size',
202 'value': 'NameDictionaryShape::kEntrySize' },
203
204 { 'name': 'namedictionary_prefix_start_index',
205 'value': 'NameDictionary::kPrefixStartIndex' },
206
207 { 'name': 'seedednumberdictionaryshape_prefix_size',
208 'value': 'SeededNumberDictionaryShape::kPrefixSize' },
209
210 { 'name': 'unseedednumberdictionaryshape_prefix_size',
211 'value': 'UnseededNumberDictionaryShape::kPrefixSize' },
212
213 { 'name': 'numberdictionaryshape_entry_size',
214 'value': 'NumberDictionaryShape::kEntrySize' }
184 ]; 215 ];
185 216
186 # 217 #
187 # The following useful fields are missing accessors, so we define fake ones. 218 # The following useful fields are missing accessors, so we define fake ones.
219 # Please note that extra accessors should _only_ be added to expose offsets that
220 # can be used to access actual V8 objects' properties. They should not be added
221 # for exposing other values. For instance, enumeration values or class'
222 # constants should be exposed by adding an entry in the "consts_misc" table, not
223 # in this "extras_accessors" table.
188 # 224 #
189 extras_accessors = [ 225 extras_accessors = [
190 'JSFunction, context, Context, kContextOffset', 226 'JSFunction, context, Context, kContextOffset',
191 'Context, closure_index, int, CLOSURE_INDEX',
192 'Context, native_context_index, int, NATIVE_CONTEXT_INDEX',
193 'Context, previous_index, int, PREVIOUS_INDEX',
194 'Context, min_context_slots, int, MIN_CONTEXT_SLOTS',
195 'HeapObject, map, Map, kMapOffset', 227 'HeapObject, map, Map, kMapOffset',
196 'JSObject, elements, Object, kElementsOffset', 228 'JSObject, elements, Object, kElementsOffset',
197 'FixedArray, data, uintptr_t, kHeaderSize', 229 'FixedArray, data, uintptr_t, kHeaderSize',
198 'JSArrayBuffer, backing_store, Object, kBackingStoreOffset', 230 'JSArrayBuffer, backing_store, Object, kBackingStoreOffset',
199 'JSArrayBufferView, byte_offset, Object, kByteOffsetOffset', 231 'JSArrayBufferView, byte_offset, Object, kByteOffsetOffset',
200 'JSTypedArray, length, Object, kLengthOffset', 232 'JSTypedArray, length, Object, kLengthOffset',
201 'Map, instance_attributes, int, kInstanceAttributesOffset', 233 'Map, instance_attributes, int, kInstanceAttributesOffset',
202 'Map, inobject_properties_or_constructor_function_index, int, kInObjectPrope rtiesOrConstructorFunctionIndexOffset', 234 'Map, inobject_properties_or_constructor_function_index, int, kInObjectPrope rtiesOrConstructorFunctionIndexOffset',
203 'Map, instance_size, int, kInstanceSizeOffset', 235 'Map, instance_size, int, kInstanceSizeOffset',
204 'Map, bit_field, char, kBitFieldOffset', 236 'Map, bit_field, char, kBitFieldOffset',
205 'Map, bit_field2, char, kBitField2Offset', 237 'Map, bit_field2, char, kBitField2Offset',
206 'Map, bit_field3, int, kBitField3Offset', 238 'Map, bit_field3, int, kBitField3Offset',
207 'Map, prototype, Object, kPrototypeOffset', 239 'Map, prototype, Object, kPrototypeOffset',
208 'NameDictionaryShape, prefix_size, int, kPrefixSize',
209 'NameDictionaryShape, entry_size, int, kEntrySize',
210 'NameDictionary, prefix_start_index, int, kPrefixStartIndex',
211 'SeededNumberDictionaryShape, prefix_size, int, kPrefixSize',
212 'UnseededNumberDictionaryShape, prefix_size, int, kPrefixSize',
213 'NumberDictionaryShape, entry_size, int, kEntrySize',
214 'Oddball, kind_offset, int, kKindOffset', 240 'Oddball, kind_offset, int, kKindOffset',
215 'HeapNumber, value, double, kValueOffset', 241 'HeapNumber, value, double, kValueOffset',
216 'ConsString, first, String, kFirstOffset', 242 'ConsString, first, String, kFirstOffset',
217 'ConsString, second, String, kSecondOffset', 243 'ConsString, second, String, kSecondOffset',
218 'ExternalString, resource, Object, kResourceOffset', 244 'ExternalString, resource, Object, kResourceOffset',
219 'SeqOneByteString, chars, char, kHeaderSize', 245 'SeqOneByteString, chars, char, kHeaderSize',
220 'SeqTwoByteString, chars, char, kHeaderSize', 246 'SeqTwoByteString, chars, char, kHeaderSize',
221 'SharedFunctionInfo, code, Code, kCodeOffset', 247 'SharedFunctionInfo, code, Code, kCodeOffset',
222 'SharedFunctionInfo, scope_info, ScopeInfo, kScopeInfoOffset', 248 'SharedFunctionInfo, scope_info, ScopeInfo, kScopeInfoOffset',
223 'SlicedString, parent, String, kParentOffset', 249 'SlicedString, parent, String, kParentOffset',
(...skipping 23 matching lines...) Expand all
247 fields = []; # field declarations 273 fields = []; # field declarations
248 274
249 header = ''' 275 header = '''
250 /* 276 /*
251 * This file is generated by %s. Do not edit directly. 277 * This file is generated by %s. Do not edit directly.
252 */ 278 */
253 279
254 #include "src/v8.h" 280 #include "src/v8.h"
255 #include "src/frames.h" 281 #include "src/frames.h"
256 #include "src/frames-inl.h" /* for architecture-specific frame constants */ 282 #include "src/frames-inl.h" /* for architecture-specific frame constants */
283 #include "src/contexts.h"
257 284
258 using namespace v8::internal; 285 using namespace v8::internal;
259 286
260 extern "C" { 287 extern "C" {
261 288
262 /* stack frame constants */ 289 /* stack frame constants */
263 #define FRAME_CONST(value, klass) \ 290 #define FRAME_CONST(value, klass) \
264 int v8dbg_frametype_##klass = StackFrame::value; 291 int v8dbg_frametype_##klass = StackFrame::value;
265 292
266 STACK_FRAME_TYPE_LIST(FRAME_CONST) 293 STACK_FRAME_TYPE_LIST(FRAME_CONST)
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 628
602 out.write(footer); 629 out.write(footer);
603 630
604 if (len(sys.argv) < 4): 631 if (len(sys.argv) < 4):
605 print('usage: %s output.cc objects.h objects-inl.h' % sys.argv[0]); 632 print('usage: %s output.cc objects.h objects-inl.h' % sys.argv[0]);
606 sys.exit(2); 633 sys.exit(2);
607 634
608 load_objects(); 635 load_objects();
609 load_fields(); 636 load_fields();
610 emit_config(); 637 emit_config();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698