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

Side by Side Diff: src/objects.h

Issue 12297012: Runtime version of declarative native accessors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 8361 matching lines...) Expand 10 before | Expand all | Expand 10 after
8372 // Bit positions in flag. 8372 // Bit positions in flag.
8373 static const int kAllCanReadBit = 0; 8373 static const int kAllCanReadBit = 0;
8374 static const int kAllCanWriteBit = 1; 8374 static const int kAllCanWriteBit = 1;
8375 static const int kProhibitsOverwritingBit = 2; 8375 static const int kProhibitsOverwritingBit = 2;
8376 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; 8376 class AttributesField: public BitField<PropertyAttributes, 3, 3> {};
8377 8377
8378 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); 8378 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo);
8379 }; 8379 };
8380 8380
8381 8381
8382 class AccessorDescriptorSerializerBase {
8383 public:
8384 void VisitError() { CHECK(false); }
Sven Panne 2013/02/19 08:41:16 Hmmm, unless I misunderstood things, this seems to
8385 bool Complete() { return length_ == offset_; }
8386
8387 protected:
8388 AccessorDescriptorSerializerBase(uint16_t length, uint8_t* storage) :
8389 offset_(0), length_(length), storage_(storage) {
8390 }
8391
8392 uint16_t offset_;
8393 const uint16_t length_;
8394 uint8_t* const storage_;
8395
8396 private:
8397 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorDescriptorSerializerBase);
8398 };
8399
8400
8401 class AccessorDescriptorDeserializer
8402 : public AccessorDescriptorSerializerBase {
8403 public:
8404 inline AccessorDescriptorDeserializer(uint16_t length, uint8_t* storage);
8405
8406 template<typename T>
8407 inline bool ShouldVisit(T* descriptor);
8408 inline bool ShouldVisit(v8::AccessorDescriptor* descriptor);
8409
8410 template<typename T>
8411 inline void Visit(T* member);
8412
8413 inline void Next(v8::AccessorDescriptor* descriptor);
8414
8415 private:
8416 bool visited_;
8417 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorDescriptorDeserializer);
8418 };
8419
8420
8382 class DeclaredAccessorDescriptor: public Struct { 8421 class DeclaredAccessorDescriptor: public Struct {
8383 public: 8422 public:
8384 // TODO(dcarney): Fill out this class. 8423 DECL_ACCESSORS(serialized_descriptor, ByteArray)
Sven Panne 2013/02/19 08:41:16 Why do we need it? It's unclear to me, which is an
8385 DECL_ACCESSORS(internal_field, Smi)
8386 8424
8387 static inline DeclaredAccessorDescriptor* cast(Object* obj); 8425 static inline DeclaredAccessorDescriptor* cast(Object* obj);
8388 8426
8427 static int SerializedLength(
8428 const v8::AccessorDescriptor* descriptor);
8429 static Handle<DeclaredAccessorDescriptor> Create(
8430 const v8::AccessorDescriptor* descriptor,
8431 Isolate* isolate);
8432
8389 // Dispatched behavior. 8433 // Dispatched behavior.
8390 DECLARE_PRINTER(DeclaredAccessorDescriptor) 8434 DECLARE_PRINTER(DeclaredAccessorDescriptor)
8391 DECLARE_VERIFIER(DeclaredAccessorDescriptor) 8435 DECLARE_VERIFIER(DeclaredAccessorDescriptor)
8392 8436
8393 static const int kInternalFieldOffset = HeapObject::kHeaderSize; 8437 static const int kSerializedDescriptorOffset = HeapObject::kHeaderSize;
8394 static const int kSize = kInternalFieldOffset + kPointerSize; 8438 static const int kSize = kSerializedDescriptorOffset + kPointerSize;
8395 8439
8396 private: 8440 private:
8397 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptor); 8441 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptor);
8398 }; 8442 };
8399 8443
8400 8444
8401 class DeclaredAccessorInfo: public AccessorInfo { 8445 class DeclaredAccessorInfo: public AccessorInfo {
8402 public: 8446 public:
8403 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor) 8447 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor)
8404 8448
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
8950 } else { 8994 } else {
8951 value &= ~(1 << bit_position); 8995 value &= ~(1 << bit_position);
8952 } 8996 }
8953 return value; 8997 return value;
8954 } 8998 }
8955 }; 8999 };
8956 9000
8957 } } // namespace v8::internal 9001 } } // namespace v8::internal
8958 9002
8959 #endif // V8_OBJECTS_H_ 9003 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698