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

Side by Side Diff: src/objects.h

Issue 10442129: Implement implicit instance checks for API accessors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Daniel Clifford. Created 8 years, 6 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
« no previous file with comments | « src/mips/stub-cache-mips.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 // 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 8068 matching lines...) Expand 10 before | Expand all | Expand 10 after
8079 // If the accessor in the prototype has the READ_ONLY property attribute, then 8079 // If the accessor in the prototype has the READ_ONLY property attribute, then
8080 // a new value is added to the local object when the property is set. 8080 // a new value is added to the local object when the property is set.
8081 // This shadows the accessor in the prototype. 8081 // This shadows the accessor in the prototype.
8082 class AccessorInfo: public Struct { 8082 class AccessorInfo: public Struct {
8083 public: 8083 public:
8084 DECL_ACCESSORS(getter, Object) 8084 DECL_ACCESSORS(getter, Object)
8085 DECL_ACCESSORS(setter, Object) 8085 DECL_ACCESSORS(setter, Object)
8086 DECL_ACCESSORS(data, Object) 8086 DECL_ACCESSORS(data, Object)
8087 DECL_ACCESSORS(name, Object) 8087 DECL_ACCESSORS(name, Object)
8088 DECL_ACCESSORS(flag, Smi) 8088 DECL_ACCESSORS(flag, Smi)
8089 DECL_ACCESSORS(expected_receiver_type, Object)
8089 8090
8090 inline bool all_can_read(); 8091 inline bool all_can_read();
8091 inline void set_all_can_read(bool value); 8092 inline void set_all_can_read(bool value);
8092 8093
8093 inline bool all_can_write(); 8094 inline bool all_can_write();
8094 inline void set_all_can_write(bool value); 8095 inline void set_all_can_write(bool value);
8095 8096
8096 inline bool prohibits_overwriting(); 8097 inline bool prohibits_overwriting();
8097 inline void set_prohibits_overwriting(bool value); 8098 inline void set_prohibits_overwriting(bool value);
8098 8099
8099 inline PropertyAttributes property_attributes(); 8100 inline PropertyAttributes property_attributes();
8100 inline void set_property_attributes(PropertyAttributes attributes); 8101 inline void set_property_attributes(PropertyAttributes attributes);
8101 8102
8103 // Checks whether the given receiver is compatible with this accessor.
8104 inline bool IsCompatibleReceiver(Object* receiver);
8105
8102 static inline AccessorInfo* cast(Object* obj); 8106 static inline AccessorInfo* cast(Object* obj);
8103 8107
8104 #ifdef OBJECT_PRINT 8108 #ifdef OBJECT_PRINT
8105 inline void AccessorInfoPrint() { 8109 inline void AccessorInfoPrint() {
8106 AccessorInfoPrint(stdout); 8110 AccessorInfoPrint(stdout);
8107 } 8111 }
8108 void AccessorInfoPrint(FILE* out); 8112 void AccessorInfoPrint(FILE* out);
8109 #endif 8113 #endif
8110 #ifdef DEBUG 8114 #ifdef DEBUG
8111 void AccessorInfoVerify(); 8115 void AccessorInfoVerify();
8112 #endif 8116 #endif
8113 8117
8114 static const int kGetterOffset = HeapObject::kHeaderSize; 8118 static const int kGetterOffset = HeapObject::kHeaderSize;
8115 static const int kSetterOffset = kGetterOffset + kPointerSize; 8119 static const int kSetterOffset = kGetterOffset + kPointerSize;
8116 static const int kDataOffset = kSetterOffset + kPointerSize; 8120 static const int kDataOffset = kSetterOffset + kPointerSize;
8117 static const int kNameOffset = kDataOffset + kPointerSize; 8121 static const int kNameOffset = kDataOffset + kPointerSize;
8118 static const int kFlagOffset = kNameOffset + kPointerSize; 8122 static const int kFlagOffset = kNameOffset + kPointerSize;
8119 static const int kSize = kFlagOffset + kPointerSize; 8123 static const int kExpectedReceiverTypeOffset = kFlagOffset + kPointerSize;
8124 static const int kSize = kExpectedReceiverTypeOffset + kPointerSize;
8120 8125
8121 private: 8126 private:
8122 // Bit positions in flag. 8127 // Bit positions in flag.
8123 static const int kAllCanReadBit = 0; 8128 static const int kAllCanReadBit = 0;
8124 static const int kAllCanWriteBit = 1; 8129 static const int kAllCanWriteBit = 1;
8125 static const int kProhibitsOverwritingBit = 2; 8130 static const int kProhibitsOverwritingBit = 2;
8126 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; 8131 class AttributesField: public BitField<PropertyAttributes, 3, 3> {};
8127 8132
8128 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); 8133 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo);
8129 }; 8134 };
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
8684 } else { 8689 } else {
8685 value &= ~(1 << bit_position); 8690 value &= ~(1 << bit_position);
8686 } 8691 }
8687 return value; 8692 return value;
8688 } 8693 }
8689 }; 8694 };
8690 8695
8691 } } // namespace v8::internal 8696 } } // namespace v8::internal
8692 8697
8693 #endif // V8_OBJECTS_H_ 8698 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698