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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 V(FUNCTION_TEMPLATE_INFO_TYPE) \ | 387 V(FUNCTION_TEMPLATE_INFO_TYPE) \ |
388 V(OBJECT_TEMPLATE_INFO_TYPE) \ | 388 V(OBJECT_TEMPLATE_INFO_TYPE) \ |
389 V(SIGNATURE_INFO_TYPE) \ | 389 V(SIGNATURE_INFO_TYPE) \ |
390 V(TYPE_SWITCH_INFO_TYPE) \ | 390 V(TYPE_SWITCH_INFO_TYPE) \ |
391 V(ALLOCATION_MEMENTO_TYPE) \ | 391 V(ALLOCATION_MEMENTO_TYPE) \ |
392 V(ALLOCATION_SITE_TYPE) \ | 392 V(ALLOCATION_SITE_TYPE) \ |
393 V(SCRIPT_TYPE) \ | 393 V(SCRIPT_TYPE) \ |
394 V(TYPE_FEEDBACK_INFO_TYPE) \ | 394 V(TYPE_FEEDBACK_INFO_TYPE) \ |
395 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 395 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
396 V(BOX_TYPE) \ | 396 V(BOX_TYPE) \ |
397 V(PROMISE_CONTAINER_TYPE) \ | |
397 V(PROTOTYPE_INFO_TYPE) \ | 398 V(PROTOTYPE_INFO_TYPE) \ |
398 V(SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE) \ | 399 V(SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE) \ |
399 \ | 400 \ |
400 V(FIXED_ARRAY_TYPE) \ | 401 V(FIXED_ARRAY_TYPE) \ |
401 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 402 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
402 V(SHARED_FUNCTION_INFO_TYPE) \ | 403 V(SHARED_FUNCTION_INFO_TYPE) \ |
403 V(WEAK_CELL_TYPE) \ | 404 V(WEAK_CELL_TYPE) \ |
404 V(TRANSITION_ARRAY_TYPE) \ | 405 V(TRANSITION_ARRAY_TYPE) \ |
405 \ | 406 \ |
406 V(JS_MESSAGE_OBJECT_TYPE) \ | 407 V(JS_MESSAGE_OBJECT_TYPE) \ |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 // object type in this causes the compiler to generate most of the boilerplate | 492 // object type in this causes the compiler to generate most of the boilerplate |
492 // code for the class including allocation and garbage collection routines, | 493 // code for the class including allocation and garbage collection routines, |
493 // casts and predicates. All you need to define is the class, methods and | 494 // casts and predicates. All you need to define is the class, methods and |
494 // object verification routines. Easy, no? | 495 // object verification routines. Easy, no? |
495 // | 496 // |
496 // Note that for subtle reasons related to the ordering or numerical values of | 497 // Note that for subtle reasons related to the ordering or numerical values of |
497 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST | 498 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST |
498 // manually. | 499 // manually. |
499 #define STRUCT_LIST(V) \ | 500 #define STRUCT_LIST(V) \ |
500 V(BOX, Box, box) \ | 501 V(BOX, Box, box) \ |
502 V(PROMISE_CONTAINER, PromiseContainer, promise_container) \ | |
501 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ | 503 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ |
502 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ | 504 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ |
503 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 505 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
504 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 506 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
505 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 507 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
506 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 508 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
507 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 509 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
508 V(SCRIPT, Script, script) \ | 510 V(SCRIPT, Script, script) \ |
509 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ | 511 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
510 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ | 512 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 FUNCTION_TEMPLATE_INFO_TYPE, | 675 FUNCTION_TEMPLATE_INFO_TYPE, |
674 OBJECT_TEMPLATE_INFO_TYPE, | 676 OBJECT_TEMPLATE_INFO_TYPE, |
675 SIGNATURE_INFO_TYPE, | 677 SIGNATURE_INFO_TYPE, |
676 TYPE_SWITCH_INFO_TYPE, | 678 TYPE_SWITCH_INFO_TYPE, |
677 ALLOCATION_SITE_TYPE, | 679 ALLOCATION_SITE_TYPE, |
678 ALLOCATION_MEMENTO_TYPE, | 680 ALLOCATION_MEMENTO_TYPE, |
679 SCRIPT_TYPE, | 681 SCRIPT_TYPE, |
680 TYPE_FEEDBACK_INFO_TYPE, | 682 TYPE_FEEDBACK_INFO_TYPE, |
681 ALIASED_ARGUMENTS_ENTRY_TYPE, | 683 ALIASED_ARGUMENTS_ENTRY_TYPE, |
682 BOX_TYPE, | 684 BOX_TYPE, |
685 PROMISE_CONTAINER_TYPE, | |
683 DEBUG_INFO_TYPE, | 686 DEBUG_INFO_TYPE, |
684 BREAK_POINT_INFO_TYPE, | 687 BREAK_POINT_INFO_TYPE, |
685 FIXED_ARRAY_TYPE, | 688 FIXED_ARRAY_TYPE, |
686 SHARED_FUNCTION_INFO_TYPE, | 689 SHARED_FUNCTION_INFO_TYPE, |
687 CELL_TYPE, | 690 CELL_TYPE, |
688 WEAK_CELL_TYPE, | 691 WEAK_CELL_TYPE, |
689 TRANSITION_ARRAY_TYPE, | 692 TRANSITION_ARRAY_TYPE, |
690 PROPERTY_CELL_TYPE, | 693 PROPERTY_CELL_TYPE, |
691 PROTOTYPE_INFO_TYPE, | 694 PROTOTYPE_INFO_TYPE, |
692 SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE, | 695 SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE, |
(...skipping 5876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6569 | 6572 |
6570 // An abstract superclass, a marker class really, for simple structure classes. | 6573 // An abstract superclass, a marker class really, for simple structure classes. |
6571 // It doesn't carry much functionality but allows struct classes to be | 6574 // It doesn't carry much functionality but allows struct classes to be |
6572 // identified in the type system. | 6575 // identified in the type system. |
6573 class Struct: public HeapObject { | 6576 class Struct: public HeapObject { |
6574 public: | 6577 public: |
6575 inline void InitializeBody(int object_size); | 6578 inline void InitializeBody(int object_size); |
6576 DECLARE_CAST(Struct) | 6579 DECLARE_CAST(Struct) |
6577 }; | 6580 }; |
6578 | 6581 |
6582 class PromiseContainer : public Struct { | |
adamk
2016/09/06 21:04:57
Please add a class comment explaining what this is
gsathya
2016/09/07 04:45:30
Done.
| |
6583 public: | |
6584 DECL_ACCESSORS(promise, Object) | |
adamk
2016/09/06 21:04:57
Do we not have any more specific type for promise?
gsathya
2016/09/07 04:45:30
Nope, we only have an instance type of JS_PROMISE_
| |
6585 DECL_ACCESSORS(thenable, Object) | |
6586 DECL_ACCESSORS(then, JSFunction) | |
6587 DECL_ACCESSORS(resolve, JSFunction) | |
6588 DECL_ACCESSORS(reject, JSFunction) | |
6589 | |
6590 static const int kPromiseOffset = Struct::kHeaderSize; | |
6591 static const int kThenableOffset = kPromiseOffset + kPointerSize; | |
6592 static const int kThenOffset = kThenableOffset + kPointerSize; | |
6593 static const int kResolveOffset = kThenOffset + kPointerSize; | |
6594 static const int kRejectOffset = kResolveOffset + kPointerSize; | |
6595 static const int kSize = kRejectOffset + kPointerSize; | |
6596 | |
6597 DECLARE_CAST(PromiseContainer) | |
6598 DECLARE_PRINTER(PromiseContainer) | |
6599 DECLARE_VERIFIER(PromiseContainer) | |
6600 | |
6601 private: | |
6602 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseContainer); | |
6603 }; | |
6579 | 6604 |
6580 // A simple one-element struct, useful where smis need to be boxed. | 6605 // A simple one-element struct, useful where smis need to be boxed. |
6581 class Box : public Struct { | 6606 class Box : public Struct { |
6582 public: | 6607 public: |
6583 // [value]: the boxed contents. | 6608 // [value]: the boxed contents. |
6584 DECL_ACCESSORS(value, Object) | 6609 DECL_ACCESSORS(value, Object) |
6585 | 6610 |
6586 DECLARE_CAST(Box) | 6611 DECLARE_CAST(Box) |
6587 | 6612 |
6588 // Dispatched behavior. | 6613 // Dispatched behavior. |
(...skipping 4612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11201 } | 11226 } |
11202 return value; | 11227 return value; |
11203 } | 11228 } |
11204 }; | 11229 }; |
11205 | 11230 |
11206 | 11231 |
11207 } // NOLINT, false-positive due to second-order macros. | 11232 } // NOLINT, false-positive due to second-order macros. |
11208 } // NOLINT, false-positive due to second-order macros. | 11233 } // NOLINT, false-positive due to second-order macros. |
11209 | 11234 |
11210 #endif // V8_OBJECTS_H_ | 11235 #endif // V8_OBJECTS_H_ |
OLD | NEW |