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

Side by Side Diff: src/objects.h

Issue 2788413004: [inspector] cache stack frame for call sites (Closed)
Patch Set: rebased Created 3 years, 8 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
« src/api.cc ('K') | « src/isolate.cc ('k') | src/objects.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 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // - StackTraceInfo 148 // - StackTraceInfo
149 // - SourcePositionTableWithFrameCache
149 // - CodeCache 150 // - CodeCache
150 // - PrototypeInfo 151 // - PrototypeInfo
151 // - Module 152 // - Module
152 // - ModuleInfoEntry 153 // - ModuleInfoEntry
153 // - WeakCell 154 // - WeakCell
154 // 155 //
155 // Formats of Object*: 156 // Formats of Object*:
156 // Smi: [31 bit signed int] 0 157 // Smi: [31 bit signed int] 0
157 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 158 // HeapObject: [32 bit direct pointer] (4 byte aligned) | 01
158 159
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 V(ALLOCATION_MEMENTO_TYPE) \ 355 V(ALLOCATION_MEMENTO_TYPE) \
355 V(SCRIPT_TYPE) \ 356 V(SCRIPT_TYPE) \
356 V(TYPE_FEEDBACK_INFO_TYPE) \ 357 V(TYPE_FEEDBACK_INFO_TYPE) \
357 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ 358 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \
358 V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \ 359 V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \
359 V(PROMISE_REACTION_JOB_INFO_TYPE) \ 360 V(PROMISE_REACTION_JOB_INFO_TYPE) \
360 V(DEBUG_INFO_TYPE) \ 361 V(DEBUG_INFO_TYPE) \
361 V(BREAK_POINT_INFO_TYPE) \ 362 V(BREAK_POINT_INFO_TYPE) \
362 V(STACK_FRAME_INFO_TYPE) \ 363 V(STACK_FRAME_INFO_TYPE) \
363 V(STACK_TRACE_INFO_TYPE) \ 364 V(STACK_TRACE_INFO_TYPE) \
365 V(SOURCE_POSITION_TABLE_WITH_FRAME_CACHE_TYPE) \
364 V(PROTOTYPE_INFO_TYPE) \ 366 V(PROTOTYPE_INFO_TYPE) \
365 V(TUPLE2_TYPE) \ 367 V(TUPLE2_TYPE) \
366 V(TUPLE3_TYPE) \ 368 V(TUPLE3_TYPE) \
367 V(CONTEXT_EXTENSION_TYPE) \ 369 V(CONTEXT_EXTENSION_TYPE) \
368 V(CONSTANT_ELEMENTS_PAIR_TYPE) \ 370 V(CONSTANT_ELEMENTS_PAIR_TYPE) \
369 V(MODULE_TYPE) \ 371 V(MODULE_TYPE) \
370 V(MODULE_INFO_ENTRY_TYPE) \ 372 V(MODULE_INFO_ENTRY_TYPE) \
371 V(ASYNC_GENERATOR_REQUEST_TYPE) \ 373 V(ASYNC_GENERATOR_REQUEST_TYPE) \
372 V(FIXED_ARRAY_TYPE) \ 374 V(FIXED_ARRAY_TYPE) \
373 V(TRANSITION_ARRAY_TYPE) \ 375 V(TRANSITION_ARRAY_TYPE) \
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 508
507 // A struct is a simple object a set of object-valued fields. Including an 509 // A struct is a simple object a set of object-valued fields. Including an
508 // object type in this causes the compiler to generate most of the boilerplate 510 // object type in this causes the compiler to generate most of the boilerplate
509 // code for the class including allocation and garbage collection routines, 511 // code for the class including allocation and garbage collection routines,
510 // casts and predicates. All you need to define is the class, methods and 512 // casts and predicates. All you need to define is the class, methods and
511 // object verification routines. Easy, no? 513 // object verification routines. Easy, no?
512 // 514 //
513 // Note that for subtle reasons related to the ordering or numerical values of 515 // Note that for subtle reasons related to the ordering or numerical values of
514 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST 516 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST
515 // manually. 517 // manually.
516 #define STRUCT_LIST(V) \ 518 #define STRUCT_LIST(V) \
517 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ 519 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \
518 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ 520 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \
519 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ 521 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \
520 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ 522 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \
521 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ 523 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \
522 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ 524 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \
523 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ 525 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \
524 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ 526 V(ALLOCATION_SITE, AllocationSite, allocation_site) \
525 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ 527 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \
526 V(SCRIPT, Script, script) \ 528 V(SCRIPT, Script, script) \
527 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ 529 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \
528 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ 530 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \
529 V(PROMISE_RESOLVE_THENABLE_JOB_INFO, PromiseResolveThenableJobInfo, \ 531 V(PROMISE_RESOLVE_THENABLE_JOB_INFO, PromiseResolveThenableJobInfo, \
530 promise_resolve_thenable_job_info) \ 532 promise_resolve_thenable_job_info) \
531 V(PROMISE_REACTION_JOB_INFO, PromiseReactionJobInfo, \ 533 V(PROMISE_REACTION_JOB_INFO, PromiseReactionJobInfo, \
532 promise_reaction_job_info) \ 534 promise_reaction_job_info) \
533 V(DEBUG_INFO, DebugInfo, debug_info) \ 535 V(DEBUG_INFO, DebugInfo, debug_info) \
534 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ 536 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \
535 V(STACK_FRAME_INFO, StackFrameInfo, stack_frame_info) \ 537 V(STACK_FRAME_INFO, StackFrameInfo, stack_frame_info) \
536 V(STACK_TRACE_INFO, StackTraceInfo, stack_trace_info) \ 538 V(STACK_TRACE_INFO, StackTraceInfo, stack_trace_info) \
537 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ 539 V(SOURCE_POSITION_TABLE_WITH_FRAME_CACHE, SourcePositionTableWithFrameCache, \
538 V(TUPLE2, Tuple2, tuple2) \ 540 source_position_table_with_frame_cache) \
539 V(TUPLE3, Tuple3, tuple3) \ 541 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \
540 V(CONTEXT_EXTENSION, ContextExtension, context_extension) \ 542 V(TUPLE2, Tuple2, tuple2) \
541 V(CONSTANT_ELEMENTS_PAIR, ConstantElementsPair, constant_elements_pair) \ 543 V(TUPLE3, Tuple3, tuple3) \
542 V(MODULE, Module, module) \ 544 V(CONTEXT_EXTENSION, ContextExtension, context_extension) \
543 V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \ 545 V(CONSTANT_ELEMENTS_PAIR, ConstantElementsPair, constant_elements_pair) \
546 V(MODULE, Module, module) \
547 V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \
544 V(ASYNC_GENERATOR_REQUEST, AsyncGeneratorRequest, async_generator_request) 548 V(ASYNC_GENERATOR_REQUEST, AsyncGeneratorRequest, async_generator_request)
545 549
546 // We use the full 8 bits of the instance_type field to encode heap object 550 // We use the full 8 bits of the instance_type field to encode heap object
547 // instance types. The high-order bit (bit 7) is set if the object is not a 551 // instance types. The high-order bit (bit 7) is set if the object is not a
548 // string, and cleared if it is a string. 552 // string, and cleared if it is a string.
549 const uint32_t kIsNotStringMask = 0x80; 553 const uint32_t kIsNotStringMask = 0x80;
550 const uint32_t kStringTag = 0x0; 554 const uint32_t kStringTag = 0x0;
551 const uint32_t kNotStringTag = 0x80; 555 const uint32_t kNotStringTag = 0x80;
552 556
553 // Bit 6 indicates that the object is an internalized string (if set) or not. 557 // Bit 6 indicates that the object is an internalized string (if set) or not.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 ALLOCATION_MEMENTO_TYPE, 704 ALLOCATION_MEMENTO_TYPE,
701 SCRIPT_TYPE, 705 SCRIPT_TYPE,
702 TYPE_FEEDBACK_INFO_TYPE, 706 TYPE_FEEDBACK_INFO_TYPE,
703 ALIASED_ARGUMENTS_ENTRY_TYPE, 707 ALIASED_ARGUMENTS_ENTRY_TYPE,
704 PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE, 708 PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE,
705 PROMISE_REACTION_JOB_INFO_TYPE, 709 PROMISE_REACTION_JOB_INFO_TYPE,
706 DEBUG_INFO_TYPE, 710 DEBUG_INFO_TYPE,
707 BREAK_POINT_INFO_TYPE, 711 BREAK_POINT_INFO_TYPE,
708 STACK_FRAME_INFO_TYPE, 712 STACK_FRAME_INFO_TYPE,
709 STACK_TRACE_INFO_TYPE, 713 STACK_TRACE_INFO_TYPE,
714 SOURCE_POSITION_TABLE_WITH_FRAME_CACHE_TYPE,
710 PROTOTYPE_INFO_TYPE, 715 PROTOTYPE_INFO_TYPE,
711 TUPLE2_TYPE, 716 TUPLE2_TYPE,
712 TUPLE3_TYPE, 717 TUPLE3_TYPE,
713 CONTEXT_EXTENSION_TYPE, 718 CONTEXT_EXTENSION_TYPE,
714 CONSTANT_ELEMENTS_PAIR_TYPE, 719 CONSTANT_ELEMENTS_PAIR_TYPE,
715 MODULE_TYPE, 720 MODULE_TYPE,
716 MODULE_INFO_ENTRY_TYPE, 721 MODULE_INFO_ENTRY_TYPE,
717 ASYNC_GENERATOR_REQUEST_TYPE, 722 ASYNC_GENERATOR_REQUEST_TYPE,
718 FIXED_ARRAY_TYPE, 723 FIXED_ARRAY_TYPE,
719 TRANSITION_ARRAY_TYPE, 724 TRANSITION_ARRAY_TYPE,
(...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after
3291 inline Age bytecode_age() const; 3296 inline Age bytecode_age() const;
3292 inline void set_bytecode_age(Age age); 3297 inline void set_bytecode_age(Age age);
3293 3298
3294 // Accessors for the constant pool. 3299 // Accessors for the constant pool.
3295 DECL_ACCESSORS(constant_pool, FixedArray) 3300 DECL_ACCESSORS(constant_pool, FixedArray)
3296 3301
3297 // Accessors for handler table containing offsets of exception handlers. 3302 // Accessors for handler table containing offsets of exception handlers.
3298 DECL_ACCESSORS(handler_table, FixedArray) 3303 DECL_ACCESSORS(handler_table, FixedArray)
3299 3304
3300 // Accessors for source position table containing mappings between byte code 3305 // Accessors for source position table containing mappings between byte code
3301 // offset and source position. 3306 // offset and source position or SourcePositionTableWithFrameCache.
3302 DECL_ACCESSORS(source_position_table, ByteArray) 3307 DECL_ACCESSORS(source_position_table, Object)
3308
3309 inline ByteArray* SourcePositionTable();
3303 3310
3304 DECLARE_CAST(BytecodeArray) 3311 DECLARE_CAST(BytecodeArray)
3305 3312
3306 // Dispatched behavior. 3313 // Dispatched behavior.
3307 inline int BytecodeArraySize(); 3314 inline int BytecodeArraySize();
3308 3315
3309 inline int instruction_size(); 3316 inline int instruction_size();
3310 3317
3311 // Returns the size of bytecode and its metadata. This includes the size of 3318 // Returns the size of bytecode and its metadata. This includes the size of
3312 // bytecode, constant pool, source position table, and handler table. 3319 // bytecode, constant pool, source position table, and handler table.
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
3704 DECL_ACCESSORS(relocation_info, ByteArray) 3711 DECL_ACCESSORS(relocation_info, ByteArray)
3705 void InvalidateRelocation(); 3712 void InvalidateRelocation();
3706 void InvalidateEmbeddedObjects(); 3713 void InvalidateEmbeddedObjects();
3707 3714
3708 // [handler_table]: Fixed array containing offsets of exception handlers. 3715 // [handler_table]: Fixed array containing offsets of exception handlers.
3709 DECL_ACCESSORS(handler_table, FixedArray) 3716 DECL_ACCESSORS(handler_table, FixedArray)
3710 3717
3711 // [deoptimization_data]: Array containing data for deopt. 3718 // [deoptimization_data]: Array containing data for deopt.
3712 DECL_ACCESSORS(deoptimization_data, FixedArray) 3719 DECL_ACCESSORS(deoptimization_data, FixedArray)
3713 3720
3714 // [source_position_table]: ByteArray for the source positions table. 3721 // [source_position_table]: ByteArray for the source positions table or
3715 DECL_ACCESSORS(source_position_table, ByteArray) 3722 // SourcePositionTableWithFrameCache.
3723 DECL_ACCESSORS(source_position_table, Object)
3724
3725 inline ByteArray* SourcePositionTable();
3716 3726
3717 // [trap_handler_index]: An index into the trap handler's master list of code 3727 // [trap_handler_index]: An index into the trap handler's master list of code
3718 // objects. 3728 // objects.
3719 DECL_ACCESSORS(trap_handler_index, Smi) 3729 DECL_ACCESSORS(trap_handler_index, Smi)
3720 3730
3721 // [raw_type_feedback_info]: This field stores various things, depending on 3731 // [raw_type_feedback_info]: This field stores various things, depending on
3722 // the kind of the code object. 3732 // the kind of the code object.
3723 // FUNCTION => type feedback information. 3733 // FUNCTION => type feedback information.
3724 // STUB and ICs => major/minor key as Smi. 3734 // STUB and ICs => major/minor key as Smi.
3725 DECL_ACCESSORS(raw_type_feedback_info, Object) 3735 DECL_ACCESSORS(raw_type_feedback_info, Object)
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
4237 4247
4238 // Returns the size of the code instructions. 4248 // Returns the size of the code instructions.
4239 inline int instruction_size(); 4249 inline int instruction_size();
4240 4250
4241 // Return the source position table. 4251 // Return the source position table.
4242 inline ByteArray* source_position_table(); 4252 inline ByteArray* source_position_table();
4243 4253
4244 // Set the source position table. 4254 // Set the source position table.
4245 inline void set_source_position_table(ByteArray* source_position_table); 4255 inline void set_source_position_table(ByteArray* source_position_table);
4246 4256
4257 inline Object* stack_frame_cache();
4258 static void SetStackFrameCache(Handle<AbstractCode> abstract_code,
4259 Handle<UnseededNumberDictionary> cache);
4260 void DropStackFrameCache();
4261
4247 // Returns the size of instructions and the metadata. 4262 // Returns the size of instructions and the metadata.
4248 inline int SizeIncludingMetadata(); 4263 inline int SizeIncludingMetadata();
4249 4264
4250 // Returns true if pc is inside this object's instructions. 4265 // Returns true if pc is inside this object's instructions.
4251 inline bool contains(byte* pc); 4266 inline bool contains(byte* pc);
4252 4267
4253 // Returns the AbstractCode::Kind of the code. 4268 // Returns the AbstractCode::Kind of the code.
4254 inline Kind kind(); 4269 inline Kind kind();
4255 4270
4256 // Calculate the size of the code object to report for log events. This takes 4271 // Calculate the size of the code object to report for log events. This takes
(...skipping 5897 matching lines...) Expand 10 before | Expand all | Expand 10 after
10154 DECLARE_VERIFIER(StackTraceInfo) 10169 DECLARE_VERIFIER(StackTraceInfo)
10155 10170
10156 static const int kFramesIndex = Struct::kHeaderSize; 10171 static const int kFramesIndex = Struct::kHeaderSize;
10157 static const int kOptionsIndex = kFramesIndex + kPointerSize; 10172 static const int kOptionsIndex = kFramesIndex + kPointerSize;
10158 static const int kSize = kOptionsIndex + kPointerSize; 10173 static const int kSize = kOptionsIndex + kPointerSize;
10159 10174
10160 private: 10175 private:
10161 DISALLOW_IMPLICIT_CONSTRUCTORS(StackTraceInfo); 10176 DISALLOW_IMPLICIT_CONSTRUCTORS(StackTraceInfo);
10162 }; 10177 };
10163 10178
10179 class SourcePositionTableWithFrameCache : public Struct {
10180 public:
10181 DECL_ACCESSORS(source_position_table, ByteArray)
10182 DECL_ACCESSORS(stack_frame_cache, UnseededNumberDictionary)
10183
10184 DECLARE_CAST(SourcePositionTableWithFrameCache)
10185
10186 // Dispatched behavior.
10187 DECLARE_PRINTER(SourcePositionTableWithFrameCache)
10188 DECLARE_VERIFIER(SourcePositionTableWithFrameCache)
10189
10190 static const int kSourcePositionTableIndex = Struct::kHeaderSize;
10191 static const int kStackFrameCacheIndex =
10192 kSourcePositionTableIndex + kPointerSize;
10193 static const int kSize = kStackFrameCacheIndex + kPointerSize;
10194
10195 private:
10196 DISALLOW_IMPLICIT_CONSTRUCTORS(SourcePositionTableWithFrameCache);
10197 };
10198
10164 #define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \ 10199 #define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \
10165 V(kStringTable, "string_table", "(Internalized strings)") \ 10200 V(kStringTable, "string_table", "(Internalized strings)") \
10166 V(kExternalStringsTable, "external_strings_table", "(External strings)") \ 10201 V(kExternalStringsTable, "external_strings_table", "(External strings)") \
10167 V(kStrongRootList, "strong_root_list", "(Strong roots)") \ 10202 V(kStrongRootList, "strong_root_list", "(Strong roots)") \
10168 V(kSmiRootList, "smi_root_list", "(Smi roots)") \ 10203 V(kSmiRootList, "smi_root_list", "(Smi roots)") \
10169 V(kBootstrapper, "bootstrapper", "(Bootstrapper)") \ 10204 V(kBootstrapper, "bootstrapper", "(Bootstrapper)") \
10170 V(kTop, "top", "(Isolate)") \ 10205 V(kTop, "top", "(Isolate)") \
10171 V(kRelocatable, "relocatable", "(Relocatable)") \ 10206 V(kRelocatable, "relocatable", "(Relocatable)") \
10172 V(kDebug, "debug", "(Debugger)") \ 10207 V(kDebug, "debug", "(Debugger)") \
10173 V(kCompilationCache, "compilationcache", "(Compilation cache)") \ 10208 V(kCompilationCache, "compilationcache", "(Compilation cache)") \
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
10267 } 10302 }
10268 }; 10303 };
10269 10304
10270 10305
10271 } // NOLINT, false-positive due to second-order macros. 10306 } // NOLINT, false-positive due to second-order macros.
10272 } // NOLINT, false-positive due to second-order macros. 10307 } // NOLINT, false-positive due to second-order macros.
10273 10308
10274 #include "src/objects/object-macros-undef.h" 10309 #include "src/objects/object-macros-undef.h"
10275 10310
10276 #endif // V8_OBJECTS_H_ 10311 #endif // V8_OBJECTS_H_
OLDNEW
« src/api.cc ('K') | « src/isolate.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698