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

Side by Side Diff: src/objects.h

Issue 9428026: Cleaned up setting of accessors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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
« no previous file with comments | « src/heap.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')
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 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 2132
2133 bool CanSetCallback(String* name); 2133 bool CanSetCallback(String* name);
2134 MUST_USE_RESULT MaybeObject* SetElementCallback( 2134 MUST_USE_RESULT MaybeObject* SetElementCallback(
2135 uint32_t index, 2135 uint32_t index,
2136 Object* structure, 2136 Object* structure,
2137 PropertyAttributes attributes); 2137 PropertyAttributes attributes);
2138 MUST_USE_RESULT MaybeObject* SetPropertyCallback( 2138 MUST_USE_RESULT MaybeObject* SetPropertyCallback(
2139 String* name, 2139 String* name,
2140 Object* structure, 2140 Object* structure,
2141 PropertyAttributes attributes); 2141 PropertyAttributes attributes);
2142 MUST_USE_RESULT MaybeObject* DefineGetterSetter( 2142 MUST_USE_RESULT MaybeObject* DefineElementAccessor(
2143 uint32_t index,
2144 bool is_getter,
2145 Object* fun,
2146 PropertyAttributes attributes);
2147 MUST_USE_RESULT MaybeObject* DefinePropertyAccessor(
2143 String* name, 2148 String* name,
2149 bool is_getter,
2150 Object* fun,
2144 PropertyAttributes attributes); 2151 PropertyAttributes attributes);
2145
2146 void LookupInDescriptor(String* name, LookupResult* result); 2152 void LookupInDescriptor(String* name, LookupResult* result);
2147 2153
2148 // Returns the hidden properties backing store object, currently 2154 // Returns the hidden properties backing store object, currently
2149 // a StringDictionary, stored on this object. 2155 // a StringDictionary, stored on this object.
2150 // If no hidden properties object has been put on this object, 2156 // If no hidden properties object has been put on this object,
2151 // return undefined, unless create_if_absent is true, in which case 2157 // return undefined, unless create_if_absent is true, in which case
2152 // a new dictionary is created, added to this object, and returned. 2158 // a new dictionary is created, added to this object, and returned.
2153 MUST_USE_RESULT MaybeObject* GetHiddenPropertiesDictionary( 2159 MUST_USE_RESULT MaybeObject* GetHiddenPropertiesDictionary(
2154 bool create_if_absent); 2160 bool create_if_absent);
2155 // Updates the existing hidden properties dictionary. 2161 // Updates the existing hidden properties dictionary.
(...skipping 5674 matching lines...) Expand 10 before | Expand all | Expand 10 after
7830 // * a pointer to a map: a transition used to ensure map sharing 7836 // * a pointer to a map: a transition used to ensure map sharing
7831 class AccessorPair: public Struct { 7837 class AccessorPair: public Struct {
7832 public: 7838 public:
7833 DECL_ACCESSORS(getter, Object) 7839 DECL_ACCESSORS(getter, Object)
7834 DECL_ACCESSORS(setter, Object) 7840 DECL_ACCESSORS(setter, Object)
7835 7841
7836 static inline AccessorPair* cast(Object* obj); 7842 static inline AccessorPair* cast(Object* obj);
7837 7843
7838 MUST_USE_RESULT MaybeObject* CopyWithoutTransitions(); 7844 MUST_USE_RESULT MaybeObject* CopyWithoutTransitions();
7839 7845
7846 // TODO(svenpanne) Evil temporary helper, will vanish soon...
7847 void set(bool modify_getter, Object* value) {
7848 if (modify_getter) {
7849 set_getter(value);
7850 } else {
7851 set_setter(value);
7852 }
7853 }
7854
7840 #ifdef OBJECT_PRINT 7855 #ifdef OBJECT_PRINT
7841 void AccessorPairPrint(FILE* out = stdout); 7856 void AccessorPairPrint(FILE* out = stdout);
7842 #endif 7857 #endif
7843 #ifdef DEBUG 7858 #ifdef DEBUG
7844 void AccessorPairVerify(); 7859 void AccessorPairVerify();
7845 #endif 7860 #endif
7846 7861
7847 static const int kGetterOffset = HeapObject::kHeaderSize; 7862 static const int kGetterOffset = HeapObject::kHeaderSize;
7848 static const int kSetterOffset = kGetterOffset + kPointerSize; 7863 static const int kSetterOffset = kGetterOffset + kPointerSize;
7849 static const int kSize = kSetterOffset + kPointerSize; 7864 static const int kSize = kSetterOffset + kPointerSize;
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
8341 } else { 8356 } else {
8342 value &= ~(1 << bit_position); 8357 value &= ~(1 << bit_position);
8343 } 8358 }
8344 return value; 8359 return value;
8345 } 8360 }
8346 }; 8361 };
8347 8362
8348 } } // namespace v8::internal 8363 } } // namespace v8::internal
8349 8364
8350 #endif // V8_OBJECTS_H_ 8365 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698