| OLD | NEW |
| 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 Loading... |
| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 175 |
| 175 { 'name': 'sharedfunctioninfo_start_position_mask', | 176 { 'name': 'sharedfunctioninfo_start_position_mask', |
| 176 'value': 'SharedFunctionInfo::kStartPositionMask' }, | 177 'value': 'SharedFunctionInfo::kStartPositionMask' }, |
| 177 { 'name': 'sharedfunctioninfo_start_position_shift', | 178 { 'name': 'sharedfunctioninfo_start_position_shift', |
| 178 'value': 'SharedFunctionInfo::kStartPositionShift' }, | 179 'value': 'SharedFunctionInfo::kStartPositionShift' }, |
| 179 | 180 |
| 180 { 'name': 'jsarray_buffer_was_neutered_mask', | 181 { 'name': 'jsarray_buffer_was_neutered_mask', |
| 181 'value': 'JSArrayBuffer::WasNeutered::kMask' }, | 182 'value': 'JSArrayBuffer::WasNeutered::kMask' }, |
| 182 { 'name': 'jsarray_buffer_was_neutered_shift', | 183 { 'name': 'jsarray_buffer_was_neutered_shift', |
| 183 'value': 'JSArrayBuffer::WasNeutered::kShift' }, | 184 'value': 'JSArrayBuffer::WasNeutered::kShift' }, |
| 185 |
| 186 { 'name': 'context_idx_closure', |
| 187 'value': 'Context::CLOSURE_INDEX' }, |
| 188 { 'name': 'context_idx_native', |
| 189 'value': 'Context::NATIVE_CONTEXT_INDEX' }, |
| 190 { 'name': 'context_idx_prev', |
| 191 'value': 'Context::PREVIOUS_INDEX' }, |
| 192 { 'name': 'context_idx_ext', |
| 193 'value': 'Context::EXTENSION_INDEX' }, |
| 194 { 'name': 'context_min_slots', |
| 195 'value': 'Context::MIN_CONTEXT_SLOTS' }, |
| 196 |
| 197 { 'name': 'namedictionaryshape_prefix_size', |
| 198 'value': 'NameDictionaryShape::kPrefixSize' }, |
| 199 { 'name': 'namedictionaryshape_entry_size', |
| 200 'value': 'NameDictionaryShape::kEntrySize' }, |
| 201 |
| 202 { 'name': 'namedictionary_prefix_start_index', |
| 203 'value': 'NameDictionary::kPrefixStartIndex' }, |
| 204 |
| 205 { 'name': 'seedednumberdictionaryshape_prefix_size', |
| 206 'value': 'SeededNumberDictionaryShape::kPrefixSize' }, |
| 207 |
| 208 { 'name': 'unseedednumberdictionaryshape_prefix_size', |
| 209 'value': 'UnseededNumberDictionaryShape::kPrefixSize' }, |
| 210 |
| 211 { 'name': 'numberdictionaryshape_entry_size', |
| 212 'value': 'NumberDictionaryShape::kEntrySize' } |
| 184 ]; | 213 ]; |
| 185 | 214 |
| 186 # | 215 # |
| 187 # The following useful fields are missing accessors, so we define fake ones. | 216 # The following useful fields are missing accessors, so we define fake ones. |
| 217 # Please note that extra accessors should _only_ be added to expose offsets that |
| 218 # can be used to access actual V8 objects' properties. They should not be added |
| 219 # for exposing other values. For instance, enumeration values or class' |
| 220 # constants should be exposed by adding an entry in the "consts_misc" table, not |
| 221 # in this "extras_accessors" table. |
| 188 # | 222 # |
| 189 extras_accessors = [ | 223 extras_accessors = [ |
| 190 'JSFunction, context, Context, kContextOffset', | 224 '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', | 225 'HeapObject, map, Map, kMapOffset', |
| 196 'JSObject, elements, Object, kElementsOffset', | 226 'JSObject, elements, Object, kElementsOffset', |
| 197 'FixedArray, data, uintptr_t, kHeaderSize', | 227 'FixedArray, data, uintptr_t, kHeaderSize', |
| 198 'JSArrayBuffer, backing_store, Object, kBackingStoreOffset', | 228 'JSArrayBuffer, backing_store, Object, kBackingStoreOffset', |
| 199 'JSArrayBufferView, byte_offset, Object, kByteOffsetOffset', | 229 'JSArrayBufferView, byte_offset, Object, kByteOffsetOffset', |
| 200 'JSTypedArray, length, Object, kLengthOffset', | 230 'JSTypedArray, length, Object, kLengthOffset', |
| 201 'Map, instance_attributes, int, kInstanceAttributesOffset', | 231 'Map, instance_attributes, int, kInstanceAttributesOffset', |
| 202 'Map, inobject_properties_or_constructor_function_index, int, kInObjectPrope
rtiesOrConstructorFunctionIndexOffset', | 232 'Map, inobject_properties_or_constructor_function_index, int, kInObjectPrope
rtiesOrConstructorFunctionIndexOffset', |
| 203 'Map, instance_size, int, kInstanceSizeOffset', | 233 'Map, instance_size, int, kInstanceSizeOffset', |
| 204 'Map, bit_field, char, kBitFieldOffset', | 234 'Map, bit_field, char, kBitFieldOffset', |
| 205 'Map, bit_field2, char, kBitField2Offset', | 235 'Map, bit_field2, char, kBitField2Offset', |
| 206 'Map, bit_field3, int, kBitField3Offset', | 236 'Map, bit_field3, int, kBitField3Offset', |
| 207 'Map, prototype, Object, kPrototypeOffset', | 237 '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', | 238 'Oddball, kind_offset, int, kKindOffset', |
| 215 'HeapNumber, value, double, kValueOffset', | 239 'HeapNumber, value, double, kValueOffset', |
| 216 'ConsString, first, String, kFirstOffset', | 240 'ConsString, first, String, kFirstOffset', |
| 217 'ConsString, second, String, kSecondOffset', | 241 'ConsString, second, String, kSecondOffset', |
| 218 'ExternalString, resource, Object, kResourceOffset', | 242 'ExternalString, resource, Object, kResourceOffset', |
| 219 'SeqOneByteString, chars, char, kHeaderSize', | 243 'SeqOneByteString, chars, char, kHeaderSize', |
| 220 'SeqTwoByteString, chars, char, kHeaderSize', | 244 'SeqTwoByteString, chars, char, kHeaderSize', |
| 221 'SharedFunctionInfo, code, Code, kCodeOffset', | 245 'SharedFunctionInfo, code, Code, kCodeOffset', |
| 222 'SharedFunctionInfo, scope_info, ScopeInfo, kScopeInfoOffset', | 246 'SharedFunctionInfo, scope_info, ScopeInfo, kScopeInfoOffset', |
| 223 'SlicedString, parent, String, kParentOffset', | 247 'SlicedString, parent, String, kParentOffset', |
| (...skipping 23 matching lines...) Expand all Loading... |
| 247 fields = []; # field declarations | 271 fields = []; # field declarations |
| 248 | 272 |
| 249 header = ''' | 273 header = ''' |
| 250 /* | 274 /* |
| 251 * This file is generated by %s. Do not edit directly. | 275 * This file is generated by %s. Do not edit directly. |
| 252 */ | 276 */ |
| 253 | 277 |
| 254 #include "src/v8.h" | 278 #include "src/v8.h" |
| 255 #include "src/frames.h" | 279 #include "src/frames.h" |
| 256 #include "src/frames-inl.h" /* for architecture-specific frame constants */ | 280 #include "src/frames-inl.h" /* for architecture-specific frame constants */ |
| 281 #include "src/contexts.h" |
| 257 | 282 |
| 258 using namespace v8::internal; | 283 using namespace v8::internal; |
| 259 | 284 |
| 260 extern "C" { | 285 extern "C" { |
| 261 | 286 |
| 262 /* stack frame constants */ | 287 /* stack frame constants */ |
| 263 #define FRAME_CONST(value, klass) \ | 288 #define FRAME_CONST(value, klass) \ |
| 264 int v8dbg_frametype_##klass = StackFrame::value; | 289 int v8dbg_frametype_##klass = StackFrame::value; |
| 265 | 290 |
| 266 STACK_FRAME_TYPE_LIST(FRAME_CONST) | 291 STACK_FRAME_TYPE_LIST(FRAME_CONST) |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 | 626 |
| 602 out.write(footer); | 627 out.write(footer); |
| 603 | 628 |
| 604 if (len(sys.argv) < 4): | 629 if (len(sys.argv) < 4): |
| 605 print('usage: %s output.cc objects.h objects-inl.h' % sys.argv[0]); | 630 print('usage: %s output.cc objects.h objects-inl.h' % sys.argv[0]); |
| 606 sys.exit(2); | 631 sys.exit(2); |
| 607 | 632 |
| 608 load_objects(); | 633 load_objects(); |
| 609 load_fields(); | 634 load_fields(); |
| 610 emit_config(); | 635 emit_config(); |
| OLD | NEW |