OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // - AccessCheckInfo | 138 // - AccessCheckInfo |
139 // - InterceptorInfo | 139 // - InterceptorInfo |
140 // - CallHandlerInfo | 140 // - CallHandlerInfo |
141 // - TemplateInfo | 141 // - TemplateInfo |
142 // - FunctionTemplateInfo | 142 // - FunctionTemplateInfo |
143 // - ObjectTemplateInfo | 143 // - ObjectTemplateInfo |
144 // - Script | 144 // - Script |
145 // - DebugInfo | 145 // - DebugInfo |
146 // - BreakPointInfo | 146 // - BreakPointInfo |
147 // - StackFrameInfo | 147 // - StackFrameInfo |
| 148 // - SourcePositionTableWithFrameCache |
148 // - CodeCache | 149 // - CodeCache |
149 // - PrototypeInfo | 150 // - PrototypeInfo |
150 // - Module | 151 // - Module |
151 // - ModuleInfoEntry | 152 // - ModuleInfoEntry |
152 // - WeakCell | 153 // - WeakCell |
153 // | 154 // |
154 // Formats of Object*: | 155 // Formats of Object*: |
155 // Smi: [31 bit signed int] 0 | 156 // Smi: [31 bit signed int] 0 |
156 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 | 157 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 |
157 | 158 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 V(ALLOCATION_SITE_TYPE) \ | 353 V(ALLOCATION_SITE_TYPE) \ |
353 V(ALLOCATION_MEMENTO_TYPE) \ | 354 V(ALLOCATION_MEMENTO_TYPE) \ |
354 V(SCRIPT_TYPE) \ | 355 V(SCRIPT_TYPE) \ |
355 V(TYPE_FEEDBACK_INFO_TYPE) \ | 356 V(TYPE_FEEDBACK_INFO_TYPE) \ |
356 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 357 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
357 V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \ | 358 V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \ |
358 V(PROMISE_REACTION_JOB_INFO_TYPE) \ | 359 V(PROMISE_REACTION_JOB_INFO_TYPE) \ |
359 V(DEBUG_INFO_TYPE) \ | 360 V(DEBUG_INFO_TYPE) \ |
360 V(BREAK_POINT_INFO_TYPE) \ | 361 V(BREAK_POINT_INFO_TYPE) \ |
361 V(STACK_FRAME_INFO_TYPE) \ | 362 V(STACK_FRAME_INFO_TYPE) \ |
| 363 V(SOURCE_POSITION_TABLE_WITH_FRAME_CACHE_TYPE) \ |
362 V(PROTOTYPE_INFO_TYPE) \ | 364 V(PROTOTYPE_INFO_TYPE) \ |
363 V(TUPLE2_TYPE) \ | 365 V(TUPLE2_TYPE) \ |
364 V(TUPLE3_TYPE) \ | 366 V(TUPLE3_TYPE) \ |
365 V(CONTEXT_EXTENSION_TYPE) \ | 367 V(CONTEXT_EXTENSION_TYPE) \ |
366 V(CONSTANT_ELEMENTS_PAIR_TYPE) \ | 368 V(CONSTANT_ELEMENTS_PAIR_TYPE) \ |
367 V(MODULE_TYPE) \ | 369 V(MODULE_TYPE) \ |
368 V(MODULE_INFO_ENTRY_TYPE) \ | 370 V(MODULE_INFO_ENTRY_TYPE) \ |
369 V(ASYNC_GENERATOR_REQUEST_TYPE) \ | 371 V(ASYNC_GENERATOR_REQUEST_TYPE) \ |
370 V(FIXED_ARRAY_TYPE) \ | 372 V(FIXED_ARRAY_TYPE) \ |
371 V(TRANSITION_ARRAY_TYPE) \ | 373 V(TRANSITION_ARRAY_TYPE) \ |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 | 506 |
505 // A struct is a simple object a set of object-valued fields. Including an | 507 // A struct is a simple object a set of object-valued fields. Including an |
506 // object type in this causes the compiler to generate most of the boilerplate | 508 // object type in this causes the compiler to generate most of the boilerplate |
507 // code for the class including allocation and garbage collection routines, | 509 // code for the class including allocation and garbage collection routines, |
508 // casts and predicates. All you need to define is the class, methods and | 510 // casts and predicates. All you need to define is the class, methods and |
509 // object verification routines. Easy, no? | 511 // object verification routines. Easy, no? |
510 // | 512 // |
511 // Note that for subtle reasons related to the ordering or numerical values of | 513 // Note that for subtle reasons related to the ordering or numerical values of |
512 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST | 514 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST |
513 // manually. | 515 // manually. |
514 #define STRUCT_LIST(V) \ | 516 #define STRUCT_LIST(V) \ |
515 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ | 517 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ |
516 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ | 518 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ |
517 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 519 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
518 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 520 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
519 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 521 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
520 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 522 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
521 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 523 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
522 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ | 524 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
523 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ | 525 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
524 V(SCRIPT, Script, script) \ | 526 V(SCRIPT, Script, script) \ |
525 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ | 527 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
526 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ | 528 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ |
527 V(PROMISE_RESOLVE_THENABLE_JOB_INFO, PromiseResolveThenableJobInfo, \ | 529 V(PROMISE_RESOLVE_THENABLE_JOB_INFO, PromiseResolveThenableJobInfo, \ |
528 promise_resolve_thenable_job_info) \ | 530 promise_resolve_thenable_job_info) \ |
529 V(PROMISE_REACTION_JOB_INFO, PromiseReactionJobInfo, \ | 531 V(PROMISE_REACTION_JOB_INFO, PromiseReactionJobInfo, \ |
530 promise_reaction_job_info) \ | 532 promise_reaction_job_info) \ |
531 V(DEBUG_INFO, DebugInfo, debug_info) \ | 533 V(DEBUG_INFO, DebugInfo, debug_info) \ |
532 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ | 534 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ |
533 V(STACK_FRAME_INFO, StackFrameInfo, stack_frame_info) \ | 535 V(STACK_FRAME_INFO, StackFrameInfo, stack_frame_info) \ |
534 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ | 536 V(SOURCE_POSITION_TABLE_WITH_FRAME_CACHE, SourcePositionTableWithFrameCache, \ |
535 V(TUPLE2, Tuple2, tuple2) \ | 537 source_position_table_with_frame_cache) \ |
536 V(TUPLE3, Tuple3, tuple3) \ | 538 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ |
537 V(CONTEXT_EXTENSION, ContextExtension, context_extension) \ | 539 V(TUPLE2, Tuple2, tuple2) \ |
538 V(CONSTANT_ELEMENTS_PAIR, ConstantElementsPair, constant_elements_pair) \ | 540 V(TUPLE3, Tuple3, tuple3) \ |
539 V(MODULE, Module, module) \ | 541 V(CONTEXT_EXTENSION, ContextExtension, context_extension) \ |
540 V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \ | 542 V(CONSTANT_ELEMENTS_PAIR, ConstantElementsPair, constant_elements_pair) \ |
| 543 V(MODULE, Module, module) \ |
| 544 V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \ |
541 V(ASYNC_GENERATOR_REQUEST, AsyncGeneratorRequest, async_generator_request) | 545 V(ASYNC_GENERATOR_REQUEST, AsyncGeneratorRequest, async_generator_request) |
542 | 546 |
543 // We use the full 8 bits of the instance_type field to encode heap object | 547 // We use the full 8 bits of the instance_type field to encode heap object |
544 // instance types. The high-order bit (bit 7) is set if the object is not a | 548 // instance types. The high-order bit (bit 7) is set if the object is not a |
545 // string, and cleared if it is a string. | 549 // string, and cleared if it is a string. |
546 const uint32_t kIsNotStringMask = 0x80; | 550 const uint32_t kIsNotStringMask = 0x80; |
547 const uint32_t kStringTag = 0x0; | 551 const uint32_t kStringTag = 0x0; |
548 const uint32_t kNotStringTag = 0x80; | 552 const uint32_t kNotStringTag = 0x80; |
549 | 553 |
550 // Bit 6 indicates that the object is an internalized string (if set) or not. | 554 // Bit 6 indicates that the object is an internalized string (if set) or not. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 ALLOCATION_SITE_TYPE, | 700 ALLOCATION_SITE_TYPE, |
697 ALLOCATION_MEMENTO_TYPE, | 701 ALLOCATION_MEMENTO_TYPE, |
698 SCRIPT_TYPE, | 702 SCRIPT_TYPE, |
699 TYPE_FEEDBACK_INFO_TYPE, | 703 TYPE_FEEDBACK_INFO_TYPE, |
700 ALIASED_ARGUMENTS_ENTRY_TYPE, | 704 ALIASED_ARGUMENTS_ENTRY_TYPE, |
701 PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE, | 705 PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE, |
702 PROMISE_REACTION_JOB_INFO_TYPE, | 706 PROMISE_REACTION_JOB_INFO_TYPE, |
703 DEBUG_INFO_TYPE, | 707 DEBUG_INFO_TYPE, |
704 BREAK_POINT_INFO_TYPE, | 708 BREAK_POINT_INFO_TYPE, |
705 STACK_FRAME_INFO_TYPE, | 709 STACK_FRAME_INFO_TYPE, |
| 710 SOURCE_POSITION_TABLE_WITH_FRAME_CACHE_TYPE, |
706 PROTOTYPE_INFO_TYPE, | 711 PROTOTYPE_INFO_TYPE, |
707 TUPLE2_TYPE, | 712 TUPLE2_TYPE, |
708 TUPLE3_TYPE, | 713 TUPLE3_TYPE, |
709 CONTEXT_EXTENSION_TYPE, | 714 CONTEXT_EXTENSION_TYPE, |
710 CONSTANT_ELEMENTS_PAIR_TYPE, | 715 CONSTANT_ELEMENTS_PAIR_TYPE, |
711 MODULE_TYPE, | 716 MODULE_TYPE, |
712 MODULE_INFO_ENTRY_TYPE, | 717 MODULE_INFO_ENTRY_TYPE, |
713 ASYNC_GENERATOR_REQUEST_TYPE, | 718 ASYNC_GENERATOR_REQUEST_TYPE, |
714 FIXED_ARRAY_TYPE, | 719 FIXED_ARRAY_TYPE, |
715 TRANSITION_ARRAY_TYPE, | 720 TRANSITION_ARRAY_TYPE, |
(...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3287 inline Age bytecode_age() const; | 3292 inline Age bytecode_age() const; |
3288 inline void set_bytecode_age(Age age); | 3293 inline void set_bytecode_age(Age age); |
3289 | 3294 |
3290 // Accessors for the constant pool. | 3295 // Accessors for the constant pool. |
3291 DECL_ACCESSORS(constant_pool, FixedArray) | 3296 DECL_ACCESSORS(constant_pool, FixedArray) |
3292 | 3297 |
3293 // Accessors for handler table containing offsets of exception handlers. | 3298 // Accessors for handler table containing offsets of exception handlers. |
3294 DECL_ACCESSORS(handler_table, FixedArray) | 3299 DECL_ACCESSORS(handler_table, FixedArray) |
3295 | 3300 |
3296 // Accessors for source position table containing mappings between byte code | 3301 // Accessors for source position table containing mappings between byte code |
3297 // offset and source position. | 3302 // offset and source position or SourcePositionTableWithFrameCache. |
3298 DECL_ACCESSORS(source_position_table, ByteArray) | 3303 DECL_ACCESSORS(source_position_table, Object) |
| 3304 |
| 3305 inline ByteArray* SourcePositionTable(); |
3299 | 3306 |
3300 DECLARE_CAST(BytecodeArray) | 3307 DECLARE_CAST(BytecodeArray) |
3301 | 3308 |
3302 // Dispatched behavior. | 3309 // Dispatched behavior. |
3303 inline int BytecodeArraySize(); | 3310 inline int BytecodeArraySize(); |
3304 | 3311 |
3305 inline int instruction_size(); | 3312 inline int instruction_size(); |
3306 | 3313 |
3307 // Returns the size of bytecode and its metadata. This includes the size of | 3314 // Returns the size of bytecode and its metadata. This includes the size of |
3308 // bytecode, constant pool, source position table, and handler table. | 3315 // bytecode, constant pool, source position table, and handler table. |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3700 DECL_ACCESSORS(relocation_info, ByteArray) | 3707 DECL_ACCESSORS(relocation_info, ByteArray) |
3701 void InvalidateRelocation(); | 3708 void InvalidateRelocation(); |
3702 void InvalidateEmbeddedObjects(); | 3709 void InvalidateEmbeddedObjects(); |
3703 | 3710 |
3704 // [handler_table]: Fixed array containing offsets of exception handlers. | 3711 // [handler_table]: Fixed array containing offsets of exception handlers. |
3705 DECL_ACCESSORS(handler_table, FixedArray) | 3712 DECL_ACCESSORS(handler_table, FixedArray) |
3706 | 3713 |
3707 // [deoptimization_data]: Array containing data for deopt. | 3714 // [deoptimization_data]: Array containing data for deopt. |
3708 DECL_ACCESSORS(deoptimization_data, FixedArray) | 3715 DECL_ACCESSORS(deoptimization_data, FixedArray) |
3709 | 3716 |
3710 // [source_position_table]: ByteArray for the source positions table. | 3717 // [source_position_table]: ByteArray for the source positions table or |
3711 DECL_ACCESSORS(source_position_table, ByteArray) | 3718 // SourcePositionTableWithFrameCache. |
| 3719 DECL_ACCESSORS(source_position_table, Object) |
| 3720 |
| 3721 inline ByteArray* SourcePositionTable(); |
3712 | 3722 |
3713 // [trap_handler_index]: An index into the trap handler's master list of code | 3723 // [trap_handler_index]: An index into the trap handler's master list of code |
3714 // objects. | 3724 // objects. |
3715 DECL_ACCESSORS(trap_handler_index, Smi) | 3725 DECL_ACCESSORS(trap_handler_index, Smi) |
3716 | 3726 |
3717 // [raw_type_feedback_info]: This field stores various things, depending on | 3727 // [raw_type_feedback_info]: This field stores various things, depending on |
3718 // the kind of the code object. | 3728 // the kind of the code object. |
3719 // FUNCTION => type feedback information. | 3729 // FUNCTION => type feedback information. |
3720 // STUB and ICs => major/minor key as Smi. | 3730 // STUB and ICs => major/minor key as Smi. |
3721 DECL_ACCESSORS(raw_type_feedback_info, Object) | 3731 DECL_ACCESSORS(raw_type_feedback_info, Object) |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4233 | 4243 |
4234 // Returns the size of the code instructions. | 4244 // Returns the size of the code instructions. |
4235 inline int instruction_size(); | 4245 inline int instruction_size(); |
4236 | 4246 |
4237 // Return the source position table. | 4247 // Return the source position table. |
4238 inline ByteArray* source_position_table(); | 4248 inline ByteArray* source_position_table(); |
4239 | 4249 |
4240 // Set the source position table. | 4250 // Set the source position table. |
4241 inline void set_source_position_table(ByteArray* source_position_table); | 4251 inline void set_source_position_table(ByteArray* source_position_table); |
4242 | 4252 |
| 4253 inline Object* stack_frame_cache(); |
| 4254 static void SetStackFrameCache(Handle<AbstractCode> abstract_code, |
| 4255 Handle<UnseededNumberDictionary> cache); |
| 4256 void DropStackFrameCache(); |
| 4257 |
4243 // Returns the size of instructions and the metadata. | 4258 // Returns the size of instructions and the metadata. |
4244 inline int SizeIncludingMetadata(); | 4259 inline int SizeIncludingMetadata(); |
4245 | 4260 |
4246 // Returns true if pc is inside this object's instructions. | 4261 // Returns true if pc is inside this object's instructions. |
4247 inline bool contains(byte* pc); | 4262 inline bool contains(byte* pc); |
4248 | 4263 |
4249 // Returns the AbstractCode::Kind of the code. | 4264 // Returns the AbstractCode::Kind of the code. |
4250 inline Kind kind(); | 4265 inline Kind kind(); |
4251 | 4266 |
4252 // Calculate the size of the code object to report for log events. This takes | 4267 // Calculate the size of the code object to report for log events. This takes |
(...skipping 5883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10136 | 10151 |
10137 private: | 10152 private: |
10138 // Bit position in the flag, from least significant bit position. | 10153 // Bit position in the flag, from least significant bit position. |
10139 static const int kIsEvalBit = 0; | 10154 static const int kIsEvalBit = 0; |
10140 static const int kIsConstructorBit = 1; | 10155 static const int kIsConstructorBit = 1; |
10141 static const int kIsWasmBit = 2; | 10156 static const int kIsWasmBit = 2; |
10142 | 10157 |
10143 DISALLOW_IMPLICIT_CONSTRUCTORS(StackFrameInfo); | 10158 DISALLOW_IMPLICIT_CONSTRUCTORS(StackFrameInfo); |
10144 }; | 10159 }; |
10145 | 10160 |
| 10161 class SourcePositionTableWithFrameCache : public Struct { |
| 10162 public: |
| 10163 DECL_ACCESSORS(source_position_table, ByteArray) |
| 10164 DECL_ACCESSORS(stack_frame_cache, UnseededNumberDictionary) |
| 10165 |
| 10166 DECLARE_CAST(SourcePositionTableWithFrameCache) |
| 10167 |
| 10168 // Dispatched behavior. |
| 10169 DECLARE_PRINTER(SourcePositionTableWithFrameCache) |
| 10170 DECLARE_VERIFIER(SourcePositionTableWithFrameCache) |
| 10171 |
| 10172 static const int kSourcePositionTableIndex = Struct::kHeaderSize; |
| 10173 static const int kStackFrameCacheIndex = |
| 10174 kSourcePositionTableIndex + kPointerSize; |
| 10175 static const int kSize = kStackFrameCacheIndex + kPointerSize; |
| 10176 |
| 10177 private: |
| 10178 DISALLOW_IMPLICIT_CONSTRUCTORS(SourcePositionTableWithFrameCache); |
| 10179 }; |
| 10180 |
10146 #define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \ | 10181 #define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \ |
10147 V(kStringTable, "string_table", "(Internalized strings)") \ | 10182 V(kStringTable, "string_table", "(Internalized strings)") \ |
10148 V(kExternalStringsTable, "external_strings_table", "(External strings)") \ | 10183 V(kExternalStringsTable, "external_strings_table", "(External strings)") \ |
10149 V(kStrongRootList, "strong_root_list", "(Strong roots)") \ | 10184 V(kStrongRootList, "strong_root_list", "(Strong roots)") \ |
10150 V(kSmiRootList, "smi_root_list", "(Smi roots)") \ | 10185 V(kSmiRootList, "smi_root_list", "(Smi roots)") \ |
10151 V(kBootstrapper, "bootstrapper", "(Bootstrapper)") \ | 10186 V(kBootstrapper, "bootstrapper", "(Bootstrapper)") \ |
10152 V(kTop, "top", "(Isolate)") \ | 10187 V(kTop, "top", "(Isolate)") \ |
10153 V(kRelocatable, "relocatable", "(Relocatable)") \ | 10188 V(kRelocatable, "relocatable", "(Relocatable)") \ |
10154 V(kDebug, "debug", "(Debugger)") \ | 10189 V(kDebug, "debug", "(Debugger)") \ |
10155 V(kCompilationCache, "compilationcache", "(Compilation cache)") \ | 10190 V(kCompilationCache, "compilationcache", "(Compilation cache)") \ |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10249 } | 10284 } |
10250 }; | 10285 }; |
10251 | 10286 |
10252 | 10287 |
10253 } // NOLINT, false-positive due to second-order macros. | 10288 } // NOLINT, false-positive due to second-order macros. |
10254 } // NOLINT, false-positive due to second-order macros. | 10289 } // NOLINT, false-positive due to second-order macros. |
10255 | 10290 |
10256 #include "src/objects/object-macros-undef.h" | 10291 #include "src/objects/object-macros-undef.h" |
10257 | 10292 |
10258 #endif // V8_OBJECTS_H_ | 10293 #endif // V8_OBJECTS_H_ |
OLD | NEW |