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

Side by Side Diff: src/objects.h

Issue 2581683003: Introduce {ConstantElementsPair} struct for type safety. (Closed)
Patch Set: Re-cemment bytecode tests. Created 4 years 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
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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 V(SCRIPT_TYPE) \ 385 V(SCRIPT_TYPE) \
386 V(TYPE_FEEDBACK_INFO_TYPE) \ 386 V(TYPE_FEEDBACK_INFO_TYPE) \
387 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ 387 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \
388 V(BOX_TYPE) \ 388 V(BOX_TYPE) \
389 V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \ 389 V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \
390 V(PROMISE_REACTION_JOB_INFO_TYPE) \ 390 V(PROMISE_REACTION_JOB_INFO_TYPE) \
391 V(PROTOTYPE_INFO_TYPE) \ 391 V(PROTOTYPE_INFO_TYPE) \
392 V(TUPLE2_TYPE) \ 392 V(TUPLE2_TYPE) \
393 V(TUPLE3_TYPE) \ 393 V(TUPLE3_TYPE) \
394 V(CONTEXT_EXTENSION_TYPE) \ 394 V(CONTEXT_EXTENSION_TYPE) \
395 V(CONSTANT_ELEMENTS_PAIR_TYPE) \
395 V(MODULE_TYPE) \ 396 V(MODULE_TYPE) \
396 V(MODULE_INFO_ENTRY_TYPE) \ 397 V(MODULE_INFO_ENTRY_TYPE) \
397 \ 398 \
398 V(FIXED_ARRAY_TYPE) \ 399 V(FIXED_ARRAY_TYPE) \
399 V(FIXED_DOUBLE_ARRAY_TYPE) \ 400 V(FIXED_DOUBLE_ARRAY_TYPE) \
400 V(SHARED_FUNCTION_INFO_TYPE) \ 401 V(SHARED_FUNCTION_INFO_TYPE) \
401 V(WEAK_CELL_TYPE) \ 402 V(WEAK_CELL_TYPE) \
402 V(TRANSITION_ARRAY_TYPE) \ 403 V(TRANSITION_ARRAY_TYPE) \
403 \ 404 \
404 V(JS_MESSAGE_OBJECT_TYPE) \ 405 V(JS_MESSAGE_OBJECT_TYPE) \
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ 555 V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \
555 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ 556 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \
556 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ 557 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \
557 V(DEBUG_INFO, DebugInfo, debug_info) \ 558 V(DEBUG_INFO, DebugInfo, debug_info) \
558 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ 559 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \
559 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \ 560 V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \
560 V(TUPLE2, Tuple2, tuple2) \ 561 V(TUPLE2, Tuple2, tuple2) \
561 V(TUPLE3, Tuple3, tuple3) \ 562 V(TUPLE3, Tuple3, tuple3) \
562 V(MODULE, Module, module) \ 563 V(MODULE, Module, module) \
563 V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \ 564 V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \
564 V(CONTEXT_EXTENSION, ContextExtension, context_extension) 565 V(CONTEXT_EXTENSION, ContextExtension, context_extension) \
566 V(CONSTANT_ELEMENTS_PAIR, ConstantElementsPair, constant_elements_pair)
565 567
566 // We use the full 8 bits of the instance_type field to encode heap object 568 // We use the full 8 bits of the instance_type field to encode heap object
567 // instance types. The high-order bit (bit 7) is set if the object is not a 569 // instance types. The high-order bit (bit 7) is set if the object is not a
568 // string, and cleared if it is a string. 570 // string, and cleared if it is a string.
569 const uint32_t kIsNotStringMask = 0x80; 571 const uint32_t kIsNotStringMask = 0x80;
570 const uint32_t kStringTag = 0x0; 572 const uint32_t kStringTag = 0x0;
571 const uint32_t kNotStringTag = 0x80; 573 const uint32_t kNotStringTag = 0x80;
572 574
573 // Bit 6 indicates that the object is an internalized string (if set) or not. 575 // Bit 6 indicates that the object is an internalized string (if set) or not.
574 // Bit 7 has to be clear as well. 576 // Bit 7 has to be clear as well.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 FIXED_ARRAY_TYPE, 735 FIXED_ARRAY_TYPE,
734 SHARED_FUNCTION_INFO_TYPE, 736 SHARED_FUNCTION_INFO_TYPE,
735 CELL_TYPE, 737 CELL_TYPE,
736 WEAK_CELL_TYPE, 738 WEAK_CELL_TYPE,
737 TRANSITION_ARRAY_TYPE, 739 TRANSITION_ARRAY_TYPE,
738 PROPERTY_CELL_TYPE, 740 PROPERTY_CELL_TYPE,
739 PROTOTYPE_INFO_TYPE, 741 PROTOTYPE_INFO_TYPE,
740 TUPLE2_TYPE, 742 TUPLE2_TYPE,
741 TUPLE3_TYPE, 743 TUPLE3_TYPE,
742 CONTEXT_EXTENSION_TYPE, 744 CONTEXT_EXTENSION_TYPE,
745 CONSTANT_ELEMENTS_PAIR_TYPE,
743 MODULE_TYPE, 746 MODULE_TYPE,
744 MODULE_INFO_ENTRY_TYPE, 747 MODULE_INFO_ENTRY_TYPE,
745 748
746 // All the following types are subtypes of JSReceiver, which corresponds to 749 // All the following types are subtypes of JSReceiver, which corresponds to
747 // objects in the JS sense. The first and the last type in this range are 750 // objects in the JS sense. The first and the last type in this range are
748 // the two forms of function. This organization enables using the same 751 // the two forms of function. This organization enables using the same
749 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range. 752 // compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range.
750 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE 753 JS_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE
751 JS_GLOBAL_OBJECT_TYPE, // FIRST_JS_OBJECT_TYPE 754 JS_GLOBAL_OBJECT_TYPE, // FIRST_JS_OBJECT_TYPE
752 JS_GLOBAL_PROXY_TYPE, 755 JS_GLOBAL_PROXY_TYPE,
(...skipping 6299 matching lines...) Expand 10 before | Expand all | Expand 10 after
7052 DECLARE_VERIFIER(ContextExtension) 7055 DECLARE_VERIFIER(ContextExtension)
7053 7056
7054 static const int kScopeInfoOffset = HeapObject::kHeaderSize; 7057 static const int kScopeInfoOffset = HeapObject::kHeaderSize;
7055 static const int kExtensionOffset = kScopeInfoOffset + kPointerSize; 7058 static const int kExtensionOffset = kScopeInfoOffset + kPointerSize;
7056 static const int kSize = kExtensionOffset + kPointerSize; 7059 static const int kSize = kExtensionOffset + kPointerSize;
7057 7060
7058 private: 7061 private:
7059 DISALLOW_IMPLICIT_CONSTRUCTORS(ContextExtension); 7062 DISALLOW_IMPLICIT_CONSTRUCTORS(ContextExtension);
7060 }; 7063 };
7061 7064
7065 // Pair of {ElementsKind} and an array of constant values for {ArrayLiteral}
7066 // expressions. Used to communicate with the runtime for literal boilerplate
7067 // creation within the {Runtime_CreateArrayLiteral} method.
7068 class ConstantElementsPair : public Struct {
7069 public:
7070 DECL_INT_ACCESSORS(elements_kind)
7071 DECL_ACCESSORS(constant_values, FixedArrayBase)
7072
7073 DECLARE_CAST(ConstantElementsPair)
7074
7075 // Dispatched behavior.
7076 DECLARE_PRINTER(ConstantElementsPair)
7077 DECLARE_VERIFIER(ConstantElementsPair)
7078
7079 static const int kElementsKindOffset = HeapObject::kHeaderSize;
7080 static const int kConstantValuesOffset = kElementsKindOffset + kPointerSize;
7081 static const int kSize = kConstantValuesOffset + kPointerSize;
7082
7083 private:
7084 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantElementsPair);
7085 };
7062 7086
7063 // Script describes a script which has been added to the VM. 7087 // Script describes a script which has been added to the VM.
7064 class Script: public Struct { 7088 class Script: public Struct {
7065 public: 7089 public:
7066 // Script types. 7090 // Script types.
7067 enum Type { 7091 enum Type {
7068 TYPE_NATIVE = 0, 7092 TYPE_NATIVE = 0,
7069 TYPE_EXTENSION = 1, 7093 TYPE_EXTENSION = 1,
7070 TYPE_NORMAL = 2, 7094 TYPE_NORMAL = 2,
7071 TYPE_WASM = 3, 7095 TYPE_WASM = 3,
(...skipping 4936 matching lines...) Expand 10 before | Expand all | Expand 10 after
12008 } 12032 }
12009 return value; 12033 return value;
12010 } 12034 }
12011 }; 12035 };
12012 12036
12013 12037
12014 } // NOLINT, false-positive due to second-order macros. 12038 } // NOLINT, false-positive due to second-order macros.
12015 } // NOLINT, false-positive due to second-order macros. 12039 } // NOLINT, false-positive due to second-order macros.
12016 12040
12017 #endif // V8_OBJECTS_H_ 12041 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698