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 834443004: remove declarative accessors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « src/lookup.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // - HeapNumber 121 // - HeapNumber
122 // - Cell 122 // - Cell
123 // - PropertyCell 123 // - PropertyCell
124 // - Code 124 // - Code
125 // - Map 125 // - Map
126 // - Oddball 126 // - Oddball
127 // - Foreign 127 // - Foreign
128 // - SharedFunctionInfo 128 // - SharedFunctionInfo
129 // - Struct 129 // - Struct
130 // - Box 130 // - Box
131 // - DeclaredAccessorDescriptor
132 // - AccessorInfo 131 // - AccessorInfo
133 // - DeclaredAccessorInfo
134 // - ExecutableAccessorInfo 132 // - ExecutableAccessorInfo
135 // - AccessorPair 133 // - AccessorPair
136 // - AccessCheckInfo 134 // - AccessCheckInfo
137 // - InterceptorInfo 135 // - InterceptorInfo
138 // - CallHandlerInfo 136 // - CallHandlerInfo
139 // - TemplateInfo 137 // - TemplateInfo
140 // - FunctionTemplateInfo 138 // - FunctionTemplateInfo
141 // - ObjectTemplateInfo 139 // - ObjectTemplateInfo
142 // - Script 140 // - Script
143 // - SignatureInfo 141 // - SignatureInfo
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 // object type in this causes the compiler to generate most of the boilerplate 511 // object type in this causes the compiler to generate most of the boilerplate
514 // code for the class including allocation and garbage collection routines, 512 // code for the class including allocation and garbage collection routines,
515 // casts and predicates. All you need to define is the class, methods and 513 // casts and predicates. All you need to define is the class, methods and
516 // object verification routines. Easy, no? 514 // object verification routines. Easy, no?
517 // 515 //
518 // Note that for subtle reasons related to the ordering or numerical values of 516 // Note that for subtle reasons related to the ordering or numerical values of
519 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST 517 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST
520 // manually. 518 // manually.
521 #define STRUCT_LIST(V) \ 519 #define STRUCT_LIST(V) \
522 V(BOX, Box, box) \ 520 V(BOX, Box, box) \
523 V(DECLARED_ACCESSOR_DESCRIPTOR, \
524 DeclaredAccessorDescriptor, \
525 declared_accessor_descriptor) \
526 V(DECLARED_ACCESSOR_INFO, DeclaredAccessorInfo, declared_accessor_info) \
527 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\ 521 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\
528 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ 522 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \
529 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ 523 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \
530 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ 524 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \
531 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ 525 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \
532 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ 526 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \
533 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ 527 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \
534 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ 528 V(SIGNATURE_INFO, SignatureInfo, signature_info) \
535 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ 529 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \
536 V(SCRIPT, Script, script) \ 530 V(SCRIPT, Script, script) \
(...skipping 9861 matching lines...) Expand 10 before | Expand all | Expand 10 after
10398 } 10392 }
10399 // Bit positions in flag. 10393 // Bit positions in flag.
10400 static const int kAllCanReadBit = 0; 10394 static const int kAllCanReadBit = 0;
10401 static const int kAllCanWriteBit = 1; 10395 static const int kAllCanWriteBit = 1;
10402 class AttributesField: public BitField<PropertyAttributes, 2, 3> {}; 10396 class AttributesField: public BitField<PropertyAttributes, 2, 3> {};
10403 10397
10404 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); 10398 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo);
10405 }; 10399 };
10406 10400
10407 10401
10408 enum AccessorDescriptorType {
10409 kDescriptorBitmaskCompare,
10410 kDescriptorPointerCompare,
10411 kDescriptorPrimitiveValue,
10412 kDescriptorObjectDereference,
10413 kDescriptorPointerDereference,
10414 kDescriptorPointerShift,
10415 kDescriptorReturnObject
10416 };
10417
10418
10419 struct BitmaskCompareDescriptor {
10420 uint32_t bitmask;
10421 uint32_t compare_value;
10422 uint8_t size; // Must be in {1,2,4}.
10423 };
10424
10425
10426 struct PointerCompareDescriptor {
10427 void* compare_value;
10428 };
10429
10430
10431 struct PrimitiveValueDescriptor {
10432 v8::DeclaredAccessorDescriptorDataType data_type;
10433 uint8_t bool_offset; // Must be in [0,7], used for kDescriptorBoolType.
10434 };
10435
10436
10437 struct ObjectDerefenceDescriptor {
10438 uint8_t internal_field;
10439 };
10440
10441
10442 struct PointerShiftDescriptor {
10443 int16_t byte_offset;
10444 };
10445
10446
10447 struct DeclaredAccessorDescriptorData {
10448 AccessorDescriptorType type;
10449 union {
10450 struct BitmaskCompareDescriptor bitmask_compare_descriptor;
10451 struct PointerCompareDescriptor pointer_compare_descriptor;
10452 struct PrimitiveValueDescriptor primitive_value_descriptor;
10453 struct ObjectDerefenceDescriptor object_dereference_descriptor;
10454 struct PointerShiftDescriptor pointer_shift_descriptor;
10455 };
10456 };
10457
10458
10459 class DeclaredAccessorDescriptor;
10460
10461
10462 class DeclaredAccessorDescriptorIterator {
10463 public:
10464 explicit DeclaredAccessorDescriptorIterator(
10465 DeclaredAccessorDescriptor* descriptor);
10466 const DeclaredAccessorDescriptorData* Next();
10467 bool Complete() const { return length_ == offset_; }
10468 private:
10469 uint8_t* array_;
10470 const int length_;
10471 int offset_;
10472 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptorIterator);
10473 };
10474
10475
10476 class DeclaredAccessorDescriptor: public Struct {
10477 public:
10478 DECL_ACCESSORS(serialized_data, ByteArray)
10479
10480 DECLARE_CAST(DeclaredAccessorDescriptor)
10481
10482 static Handle<DeclaredAccessorDescriptor> Create(
10483 Isolate* isolate,
10484 const DeclaredAccessorDescriptorData& data,
10485 Handle<DeclaredAccessorDescriptor> previous);
10486
10487 // Dispatched behavior.
10488 DECLARE_PRINTER(DeclaredAccessorDescriptor)
10489 DECLARE_VERIFIER(DeclaredAccessorDescriptor)
10490
10491 static const int kSerializedDataOffset = HeapObject::kHeaderSize;
10492 static const int kSize = kSerializedDataOffset + kPointerSize;
10493
10494 private:
10495 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptor);
10496 };
10497
10498
10499 class DeclaredAccessorInfo: public AccessorInfo {
10500 public:
10501 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor)
10502
10503 DECLARE_CAST(DeclaredAccessorInfo)
10504
10505 // Dispatched behavior.
10506 DECLARE_PRINTER(DeclaredAccessorInfo)
10507 DECLARE_VERIFIER(DeclaredAccessorInfo)
10508
10509 static const int kDescriptorOffset = AccessorInfo::kSize;
10510 static const int kSize = kDescriptorOffset + kPointerSize;
10511
10512 private:
10513 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorInfo);
10514 };
10515
10516
10517 // An accessor must have a getter, but can have no setter. 10402 // An accessor must have a getter, but can have no setter.
10518 // 10403 //
10519 // When setting a property, V8 searches accessors in prototypes. 10404 // When setting a property, V8 searches accessors in prototypes.
10520 // If an accessor was found and it does not have a setter, 10405 // If an accessor was found and it does not have a setter,
10521 // the request is ignored. 10406 // the request is ignored.
10522 // 10407 //
10523 // If the accessor in the prototype has the READ_ONLY property attribute, then 10408 // If the accessor in the prototype has the READ_ONLY property attribute, then
10524 // a new value is added to the derived object when the property is set. 10409 // a new value is added to the derived object when the property is set.
10525 // This shadows the accessor in the prototype. 10410 // This shadows the accessor in the prototype.
10526 class ExecutableAccessorInfo: public AccessorInfo { 10411 class ExecutableAccessorInfo: public AccessorInfo {
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
11067 } else { 10952 } else {
11068 value &= ~(1 << bit_position); 10953 value &= ~(1 << bit_position);
11069 } 10954 }
11070 return value; 10955 return value;
11071 } 10956 }
11072 }; 10957 };
11073 10958
11074 } } // namespace v8::internal 10959 } } // namespace v8::internal
11075 10960
11076 #endif // V8_OBJECTS_H_ 10961 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/lookup.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698