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

Side by Side Diff: src/objects.h

Issue 12183018: Create pre-frozen change records for Object.observe (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
« no previous file with comments | « src/object-observe.js ('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 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> { 2210 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> {
2211 public: 2211 public:
2212 static inline int SizeOf(Map* map, HeapObject* object); 2212 static inline int SizeOf(Map* map, HeapObject* object);
2213 }; 2213 };
2214 2214
2215 // Enqueue change record for Object.observe. May cause GC. 2215 // Enqueue change record for Object.observe. May cause GC.
2216 static void EnqueueChangeRecord(Handle<JSObject> object, 2216 static void EnqueueChangeRecord(Handle<JSObject> object,
2217 const char* type, 2217 const char* type,
2218 Handle<String> name, 2218 Handle<String> name,
2219 Handle<Object> old_value); 2219 Handle<Object> old_value);
2220 static void EnqueueChangeRecord(Handle<JSObject> object,
2221 Handle<String> type,
2222 Handle<String> name,
2223 Handle<Object> old_value);
2220 2224
2221 // Deliver change records to observers. May cause GC. 2225 // Deliver change records to observers. May cause GC.
2222 static void DeliverChangeRecords(Isolate* isolate); 2226 static void DeliverChangeRecords(Isolate* isolate);
2223 2227
2224 private: 2228 private:
2225 friend class DictionaryElementsAccessor; 2229 friend class DictionaryElementsAccessor;
2226 2230
2227 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, 2231 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
2228 Object* structure, 2232 Object* structure,
2229 uint32_t index, 2233 uint32_t index,
(...skipping 6087 matching lines...) Expand 10 before | Expand all | Expand 10 after
8317 static const int kInputOffset = kIndexOffset + kPointerSize; 8321 static const int kInputOffset = kIndexOffset + kPointerSize;
8318 static const int kSize = kInputOffset + kPointerSize; 8322 static const int kSize = kInputOffset + kPointerSize;
8319 // Indices of in-object properties. 8323 // Indices of in-object properties.
8320 static const int kIndexIndex = 0; 8324 static const int kIndexIndex = 0;
8321 static const int kInputIndex = 1; 8325 static const int kInputIndex = 1;
8322 private: 8326 private:
8323 DISALLOW_IMPLICIT_CONSTRUCTORS(JSRegExpResult); 8327 DISALLOW_IMPLICIT_CONSTRUCTORS(JSRegExpResult);
8324 }; 8328 };
8325 8329
8326 8330
8331 // JSChangeRecords are JSObjects with a particular initial map
8332 // that includes in-object properties and non-extensibility.
8333 class JSChangeRecord: public JSObject {
8334 public:
8335 // Offsets of object fields.
8336 static const int kTypeOffset = JSObject::kHeaderSize;
8337 static const int kObjectOffset = kTypeOffset + kPointerSize;
8338 static const int kNameOffset = kObjectOffset + kPointerSize;
8339 static const int kOldValueOffset = kNameOffset + kPointerSize;
8340 static const int kSize = kOldValueOffset + kPointerSize;
8341 // Indices of in-object properties.
8342 static const int kTypeIndex = 0;
8343 static const int kObjectIndex = 1;
8344 static const int kNameIndex = 2;
8345 static const int kOldValueIndex = 3;
8346 private:
8347 DISALLOW_IMPLICIT_CONSTRUCTORS(JSChangeRecord);
8348 };
8349
8350
8327 // An accessor must have a getter, but can have no setter. 8351 // An accessor must have a getter, but can have no setter.
8328 // 8352 //
8329 // When setting a property, V8 searches accessors in prototypes. 8353 // When setting a property, V8 searches accessors in prototypes.
8330 // If an accessor was found and it does not have a setter, 8354 // If an accessor was found and it does not have a setter,
8331 // the request is ignored. 8355 // the request is ignored.
8332 // 8356 //
8333 // If the accessor in the prototype has the READ_ONLY property attribute, then 8357 // If the accessor in the prototype has the READ_ONLY property attribute, then
8334 // a new value is added to the local object when the property is set. 8358 // a new value is added to the local object when the property is set.
8335 // This shadows the accessor in the prototype. 8359 // This shadows the accessor in the prototype.
8336 class AccessorInfo: public Struct { 8360 class AccessorInfo: public Struct {
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
8885 } else { 8909 } else {
8886 value &= ~(1 << bit_position); 8910 value &= ~(1 << bit_position);
8887 } 8911 }
8888 return value; 8912 return value;
8889 } 8913 }
8890 }; 8914 };
8891 8915
8892 } } // namespace v8::internal 8916 } } // namespace v8::internal
8893 8917
8894 #endif // V8_OBJECTS_H_ 8918 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/object-observe.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698