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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 // - PropertyCell | 136 // - PropertyCell |
137 // - Code | 137 // - Code |
138 // - AbstractCode, a wrapper around Code or BytecodeArray | 138 // - AbstractCode, a wrapper around Code or BytecodeArray |
139 // - Map | 139 // - Map |
140 // - Oddball | 140 // - Oddball |
141 // - Foreign | 141 // - Foreign |
142 // - SharedFunctionInfo | 142 // - SharedFunctionInfo |
143 // - Struct | 143 // - Struct |
144 // - Box | 144 // - Box |
145 // - AccessorInfo | 145 // - AccessorInfo |
146 // - PromiseContainer | |
147 // - PromiseHandleInfo | |
146 // - AccessorPair | 148 // - AccessorPair |
147 // - AccessCheckInfo | 149 // - AccessCheckInfo |
148 // - InterceptorInfo | 150 // - InterceptorInfo |
149 // - CallHandlerInfo | 151 // - CallHandlerInfo |
150 // - TemplateInfo | 152 // - TemplateInfo |
151 // - FunctionTemplateInfo | 153 // - FunctionTemplateInfo |
152 // - ObjectTemplateInfo | 154 // - ObjectTemplateInfo |
153 // - Script | 155 // - Script |
154 // - DebugInfo | 156 // - DebugInfo |
155 // - BreakPointInfo | 157 // - BreakPointInfo |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 V(OBJECT_TEMPLATE_INFO_TYPE) \ | 394 V(OBJECT_TEMPLATE_INFO_TYPE) \ |
393 V(SIGNATURE_INFO_TYPE) \ | 395 V(SIGNATURE_INFO_TYPE) \ |
394 V(TYPE_SWITCH_INFO_TYPE) \ | 396 V(TYPE_SWITCH_INFO_TYPE) \ |
395 V(ALLOCATION_MEMENTO_TYPE) \ | 397 V(ALLOCATION_MEMENTO_TYPE) \ |
396 V(ALLOCATION_SITE_TYPE) \ | 398 V(ALLOCATION_SITE_TYPE) \ |
397 V(SCRIPT_TYPE) \ | 399 V(SCRIPT_TYPE) \ |
398 V(TYPE_FEEDBACK_INFO_TYPE) \ | 400 V(TYPE_FEEDBACK_INFO_TYPE) \ |
399 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 401 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
400 V(BOX_TYPE) \ | 402 V(BOX_TYPE) \ |
401 V(PROMISE_CONTAINER_TYPE) \ | 403 V(PROMISE_CONTAINER_TYPE) \ |
404 V(PROMISE_HANDLE_INFO_TYPE) \ | |
402 V(PROTOTYPE_INFO_TYPE) \ | 405 V(PROTOTYPE_INFO_TYPE) \ |
403 V(CONTEXT_EXTENSION_TYPE) \ | 406 V(CONTEXT_EXTENSION_TYPE) \ |
404 V(MODULE_TYPE) \ | 407 V(MODULE_TYPE) \ |
405 \ | 408 \ |
406 V(FIXED_ARRAY_TYPE) \ | 409 V(FIXED_ARRAY_TYPE) \ |
407 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 410 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
408 V(SHARED_FUNCTION_INFO_TYPE) \ | 411 V(SHARED_FUNCTION_INFO_TYPE) \ |
409 V(WEAK_CELL_TYPE) \ | 412 V(WEAK_CELL_TYPE) \ |
410 V(TRANSITION_ARRAY_TYPE) \ | 413 V(TRANSITION_ARRAY_TYPE) \ |
411 \ | 414 \ |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 // code for the class including allocation and garbage collection routines, | 502 // code for the class including allocation and garbage collection routines, |
500 // casts and predicates. All you need to define is the class, methods and | 503 // casts and predicates. All you need to define is the class, methods and |
501 // object verification routines. Easy, no? | 504 // object verification routines. Easy, no? |
502 // | 505 // |
503 // Note that for subtle reasons related to the ordering or numerical values of | 506 // Note that for subtle reasons related to the ordering or numerical values of |
504 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST | 507 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST |
505 // manually. | 508 // manually. |
506 #define STRUCT_LIST(V) \ | 509 #define STRUCT_LIST(V) \ |
507 V(BOX, Box, box) \ | 510 V(BOX, Box, box) \ |
508 V(PROMISE_CONTAINER, PromiseContainer, promise_container) \ | 511 V(PROMISE_CONTAINER, PromiseContainer, promise_container) \ |
512 V(PROMISE_HANDLE_INFO, PromiseHandleInfo, promise_handle_info) \ | |
509 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ | 513 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ |
510 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ | 514 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ |
511 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 515 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
512 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 516 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
513 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 517 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
514 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 518 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
515 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 519 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
516 V(SCRIPT, Script, script) \ | 520 V(SCRIPT, Script, script) \ |
517 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ | 521 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
518 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ | 522 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
681 OBJECT_TEMPLATE_INFO_TYPE, | 685 OBJECT_TEMPLATE_INFO_TYPE, |
682 SIGNATURE_INFO_TYPE, | 686 SIGNATURE_INFO_TYPE, |
683 TYPE_SWITCH_INFO_TYPE, | 687 TYPE_SWITCH_INFO_TYPE, |
684 ALLOCATION_SITE_TYPE, | 688 ALLOCATION_SITE_TYPE, |
685 ALLOCATION_MEMENTO_TYPE, | 689 ALLOCATION_MEMENTO_TYPE, |
686 SCRIPT_TYPE, | 690 SCRIPT_TYPE, |
687 TYPE_FEEDBACK_INFO_TYPE, | 691 TYPE_FEEDBACK_INFO_TYPE, |
688 ALIASED_ARGUMENTS_ENTRY_TYPE, | 692 ALIASED_ARGUMENTS_ENTRY_TYPE, |
689 BOX_TYPE, | 693 BOX_TYPE, |
690 PROMISE_CONTAINER_TYPE, | 694 PROMISE_CONTAINER_TYPE, |
695 PROMISE_HANDLE_INFO_TYPE, | |
691 DEBUG_INFO_TYPE, | 696 DEBUG_INFO_TYPE, |
692 BREAK_POINT_INFO_TYPE, | 697 BREAK_POINT_INFO_TYPE, |
693 FIXED_ARRAY_TYPE, | 698 FIXED_ARRAY_TYPE, |
694 SHARED_FUNCTION_INFO_TYPE, | 699 SHARED_FUNCTION_INFO_TYPE, |
695 CELL_TYPE, | 700 CELL_TYPE, |
696 WEAK_CELL_TYPE, | 701 WEAK_CELL_TYPE, |
697 TRANSITION_ARRAY_TYPE, | 702 TRANSITION_ARRAY_TYPE, |
698 PROPERTY_CELL_TYPE, | 703 PROPERTY_CELL_TYPE, |
699 PROTOTYPE_INFO_TYPE, | 704 PROTOTYPE_INFO_TYPE, |
700 CONTEXT_EXTENSION_TYPE, | 705 CONTEXT_EXTENSION_TYPE, |
(...skipping 5970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6671 // An abstract superclass, a marker class really, for simple structure classes. | 6676 // An abstract superclass, a marker class really, for simple structure classes. |
6672 // It doesn't carry much functionality but allows struct classes to be | 6677 // It doesn't carry much functionality but allows struct classes to be |
6673 // identified in the type system. | 6678 // identified in the type system. |
6674 class Struct: public HeapObject { | 6679 class Struct: public HeapObject { |
6675 public: | 6680 public: |
6676 inline void InitializeBody(int object_size); | 6681 inline void InitializeBody(int object_size); |
6677 DECLARE_CAST(Struct) | 6682 DECLARE_CAST(Struct) |
6678 }; | 6683 }; |
6679 | 6684 |
6680 // A container struct to hold state required for | 6685 // A container struct to hold state required for |
6681 // PromiseResolveThenableJob. {before, after}_debug_event could | 6686 // PromiseResolveThenableJob. |
6682 // potentially be undefined if the debugger is turned off. | |
6683 class PromiseContainer : public Struct { | 6687 class PromiseContainer : public Struct { |
adamk
2016/10/11 23:14:30
This name now sounds too generic. Maybe add a TODO
gsathya
2016/10/12 02:00:44
Done.
| |
6684 public: | 6688 public: |
6685 DECL_ACCESSORS(thenable, JSReceiver) | 6689 DECL_ACCESSORS(thenable, JSReceiver) |
6686 DECL_ACCESSORS(then, JSReceiver) | 6690 DECL_ACCESSORS(then, JSReceiver) |
6687 DECL_ACCESSORS(resolve, JSFunction) | 6691 DECL_ACCESSORS(resolve, JSFunction) |
6688 DECL_ACCESSORS(reject, JSFunction) | 6692 DECL_ACCESSORS(reject, JSFunction) |
6689 DECL_ACCESSORS(before_debug_event, Object) | 6693 DECL_ACCESSORS(before_debug_event, Object) |
6690 DECL_ACCESSORS(after_debug_event, Object) | 6694 DECL_ACCESSORS(after_debug_event, Object) |
6691 | 6695 |
6692 static const int kThenableOffset = Struct::kHeaderSize; | 6696 static const int kThenableOffset = Struct::kHeaderSize; |
6693 static const int kThenOffset = kThenableOffset + kPointerSize; | 6697 static const int kThenOffset = kThenableOffset + kPointerSize; |
6694 static const int kResolveOffset = kThenOffset + kPointerSize; | 6698 static const int kResolveOffset = kThenOffset + kPointerSize; |
6695 static const int kRejectOffset = kResolveOffset + kPointerSize; | 6699 static const int kRejectOffset = kResolveOffset + kPointerSize; |
6696 static const int kBeforeDebugEventOffset = kRejectOffset + kPointerSize; | 6700 static const int kBeforeDebugEventOffset = kRejectOffset + kPointerSize; |
6697 static const int kAfterDebugEventOffset = | 6701 static const int kAfterDebugEventOffset = |
6698 kBeforeDebugEventOffset + kPointerSize; | 6702 kBeforeDebugEventOffset + kPointerSize; |
6699 static const int kSize = kAfterDebugEventOffset + kPointerSize; | 6703 static const int kSize = kAfterDebugEventOffset + kPointerSize; |
6700 | 6704 |
6701 DECLARE_CAST(PromiseContainer) | 6705 DECLARE_CAST(PromiseContainer) |
6702 DECLARE_PRINTER(PromiseContainer) | 6706 DECLARE_PRINTER(PromiseContainer) |
6703 DECLARE_VERIFIER(PromiseContainer) | 6707 DECLARE_VERIFIER(PromiseContainer) |
6704 | 6708 |
6705 private: | 6709 private: |
6706 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseContainer); | 6710 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseContainer); |
6707 }; | 6711 }; |
6708 | 6712 |
6713 // Struct to hold state required for PromiseReactionJob. | |
6714 class PromiseHandleInfo : public Struct { | |
adamk
2016/10/11 23:14:30
This name is a little funny; why not PromiseReacti
gsathya
2016/10/12 02:00:44
Done.
| |
6715 public: | |
6716 DECL_ACCESSORS(value, Object) | |
6717 DECL_ACCESSORS(tasks, Object) | |
6718 DECL_ACCESSORS(deferred, Object) | |
adamk
2016/10/11 23:14:30
Isn't this guaranteed to be a JSObject?
gsathya
2016/10/12 02:00:44
Nope this can be UNDEFINED when we have more than
| |
6719 DECL_ACCESSORS(before_debug_event, Object) | |
6720 DECL_ACCESSORS(after_debug_event, Object) | |
6721 DECL_ACCESSORS(reaction_context, Context) | |
adamk
2016/10/11 23:14:30
I think "context" would be a fine name for this.
gsathya
2016/10/12 02:00:44
Done.
| |
6722 | |
6723 static const int kValueOffset = Struct::kHeaderSize; | |
6724 static const int kTasksOffset = kValueOffset + kPointerSize; | |
6725 static const int kDeferredOffset = kTasksOffset + kPointerSize; | |
6726 static const int kBeforeDebugEventOffset = kDeferredOffset + kPointerSize; | |
6727 static const int kAfterDebugEventOffset = | |
6728 kBeforeDebugEventOffset + kPointerSize; | |
6729 static const int kReactionContext = kAfterDebugEventOffset + kPointerSize; | |
6730 static const int kSize = kReactionContext + kPointerSize; | |
6731 | |
6732 DECLARE_CAST(PromiseHandleInfo) | |
6733 DECLARE_PRINTER(PromiseHandleInfo) | |
6734 DECLARE_VERIFIER(PromiseHandleInfo) | |
6735 | |
6736 private: | |
6737 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseHandleInfo); | |
6738 }; | |
6739 | |
6709 // A simple one-element struct, useful where smis need to be boxed. | 6740 // A simple one-element struct, useful where smis need to be boxed. |
6710 class Box : public Struct { | 6741 class Box : public Struct { |
6711 public: | 6742 public: |
6712 // [value]: the boxed contents. | 6743 // [value]: the boxed contents. |
6713 DECL_ACCESSORS(value, Object) | 6744 DECL_ACCESSORS(value, Object) |
6714 | 6745 |
6715 DECLARE_CAST(Box) | 6746 DECLARE_CAST(Box) |
6716 | 6747 |
6717 // Dispatched behavior. | 6748 // Dispatched behavior. |
6718 DECLARE_PRINTER(Box) | 6749 DECLARE_PRINTER(Box) |
(...skipping 4731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11450 } | 11481 } |
11451 return value; | 11482 return value; |
11452 } | 11483 } |
11453 }; | 11484 }; |
11454 | 11485 |
11455 | 11486 |
11456 } // NOLINT, false-positive due to second-order macros. | 11487 } // NOLINT, false-positive due to second-order macros. |
11457 } // NOLINT, false-positive due to second-order macros. | 11488 } // NOLINT, false-positive due to second-order macros. |
11458 | 11489 |
11459 #endif // V8_OBJECTS_H_ | 11490 #endif // V8_OBJECTS_H_ |
OLD | NEW |