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

Side by Side Diff: include/v8.h

Issue 12297012: Runtime version of declarative native accessors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: round 2 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 | « no previous file | src/api.h » ('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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 template <class T> class Handle; 124 template <class T> class Handle;
125 template <class T> class Local; 125 template <class T> class Local;
126 template <class T> class Persistent; 126 template <class T> class Persistent;
127 class FunctionTemplate; 127 class FunctionTemplate;
128 class ObjectTemplate; 128 class ObjectTemplate;
129 class Data; 129 class Data;
130 class AccessorInfo; 130 class AccessorInfo;
131 class StackTrace; 131 class StackTrace;
132 class StackFrame; 132 class StackFrame;
133 class Isolate; 133 class Isolate;
134 class DeclaredAccessorDescriptor;
135 class ObjectOperationDescriptor;
136 class RawOperationDescriptor;
134 137
135 namespace internal { 138 namespace internal {
136 139
137 class Arguments; 140 class Arguments;
138 class Object; 141 class Object;
139 class Heap; 142 class Heap;
140 class HeapObject; 143 class HeapObject;
141 class Isolate; 144 class Isolate;
142 } 145 }
143 146
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 1602
1600 bool Delete(uint32_t index); 1603 bool Delete(uint32_t index);
1601 1604
1602 bool SetAccessor(Handle<String> name, 1605 bool SetAccessor(Handle<String> name,
1603 AccessorGetter getter, 1606 AccessorGetter getter,
1604 AccessorSetter setter = 0, 1607 AccessorSetter setter = 0,
1605 Handle<Value> data = Handle<Value>(), 1608 Handle<Value> data = Handle<Value>(),
1606 AccessControl settings = DEFAULT, 1609 AccessControl settings = DEFAULT,
1607 PropertyAttribute attribute = None); 1610 PropertyAttribute attribute = None);
1608 1611
1612 bool SetAccessor(Handle<String> name,
Sven Panne 2013/03/07 08:18:48 Add some kind of warning comment that this part of
1613 Handle<DeclaredAccessorDescriptor> descriptor,
1614 AccessControl settings = DEFAULT,
1615 PropertyAttribute attribute = None);
1616
1609 /** 1617 /**
1610 * Returns an array containing the names of the enumerable properties 1618 * Returns an array containing the names of the enumerable properties
1611 * of this object, including properties from prototype objects. The 1619 * of this object, including properties from prototype objects. The
1612 * array returned by this method contains the same values as would 1620 * array returned by this method contains the same values as would
1613 * be enumerated by a for-in statement over this object. 1621 * be enumerated by a for-in statement over this object.
1614 */ 1622 */
1615 Local<Array> GetPropertyNames(); 1623 Local<Array> GetPropertyNames();
1616 1624
1617 /** 1625 /**
1618 * This function has the same functionality as GetPropertyNames but 1626 * This function has the same functionality as GetPropertyNames but
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 void ReadOnlyPrototype(); 2378 void ReadOnlyPrototype();
2371 2379
2372 /** 2380 /**
2373 * Returns true if the given object is an instance of this function 2381 * Returns true if the given object is an instance of this function
2374 * template. 2382 * template.
2375 */ 2383 */
2376 bool HasInstance(Handle<Value> object); 2384 bool HasInstance(Handle<Value> object);
2377 2385
2378 private: 2386 private:
2379 FunctionTemplate(); 2387 FunctionTemplate();
2380 void AddInstancePropertyAccessor(Handle<String> name,
2381 AccessorGetter getter,
2382 AccessorSetter setter,
2383 Handle<Value> data,
2384 AccessControl settings,
2385 PropertyAttribute attributes,
2386 Handle<AccessorSignature> signature);
2387 void SetNamedInstancePropertyHandler(NamedPropertyGetter getter, 2388 void SetNamedInstancePropertyHandler(NamedPropertyGetter getter,
2388 NamedPropertySetter setter, 2389 NamedPropertySetter setter,
2389 NamedPropertyQuery query, 2390 NamedPropertyQuery query,
2390 NamedPropertyDeleter remover, 2391 NamedPropertyDeleter remover,
2391 NamedPropertyEnumerator enumerator, 2392 NamedPropertyEnumerator enumerator,
2392 Handle<Value> data); 2393 Handle<Value> data);
2393 void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter, 2394 void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter,
2394 IndexedPropertySetter setter, 2395 IndexedPropertySetter setter,
2395 IndexedPropertyQuery query, 2396 IndexedPropertyQuery query,
2396 IndexedPropertyDeleter remover, 2397 IndexedPropertyDeleter remover,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2449 */ 2450 */
2450 void SetAccessor(Handle<String> name, 2451 void SetAccessor(Handle<String> name,
2451 AccessorGetter getter, 2452 AccessorGetter getter,
2452 AccessorSetter setter = 0, 2453 AccessorSetter setter = 0,
2453 Handle<Value> data = Handle<Value>(), 2454 Handle<Value> data = Handle<Value>(),
2454 AccessControl settings = DEFAULT, 2455 AccessControl settings = DEFAULT,
2455 PropertyAttribute attribute = None, 2456 PropertyAttribute attribute = None,
2456 Handle<AccessorSignature> signature = 2457 Handle<AccessorSignature> signature =
2457 Handle<AccessorSignature>()); 2458 Handle<AccessorSignature>());
2458 2459
2460 bool SetAccessor(Handle<String> name,
Sven Panne 2013/03/07 08:18:48 Same here...
2461 Handle<DeclaredAccessorDescriptor> descriptor,
2462 AccessControl settings = DEFAULT,
2463 PropertyAttribute attribute = None,
2464 Handle<AccessorSignature> signature =
2465 Handle<AccessorSignature>());
2466
2459 /** 2467 /**
2460 * Sets a named property handler on the object template. 2468 * Sets a named property handler on the object template.
2461 * 2469 *
2462 * Whenever a named property is accessed on objects created from 2470 * Whenever a named property is accessed on objects created from
2463 * this object template, the provided callback is invoked instead of 2471 * this object template, the provided callback is invoked instead of
2464 * accessing the property directly on the JavaScript object. 2472 * accessing the property directly on the JavaScript object.
2465 * 2473 *
2466 * \param getter The callback to invoke when getting a property. 2474 * \param getter The callback to invoke when getting a property.
2467 * \param setter The callback to invoke when setting a property. 2475 * \param setter The callback to invoke when setting a property.
2468 * \param query The callback to invoke to check if a property is present, 2476 * \param query The callback to invoke to check if a property is present,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 */ 2586 */
2579 class V8EXPORT AccessorSignature : public Data { 2587 class V8EXPORT AccessorSignature : public Data {
2580 public: 2588 public:
2581 static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver = 2589 static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver =
2582 Handle<FunctionTemplate>()); 2590 Handle<FunctionTemplate>());
2583 private: 2591 private:
2584 AccessorSignature(); 2592 AccessorSignature();
2585 }; 2593 };
2586 2594
2587 2595
2596 class V8EXPORT DeclaredAccessorDescriptor : public Data {
2597 private:
2598 DeclaredAccessorDescriptor();
2599 };
2600
2601
2602 class V8EXPORT ObjectOperationDescriptor : public Data {
2603 public:
2604 static Local<RawOperationDescriptor> New(Isolate* isolate,
Sven Panne 2013/03/07 08:18:48 A more descriptive name indicating that the operat
2605 int internal_field);
2606 private:
2607 ObjectOperationDescriptor();
2608 };
2609
2610
2611 enum DeclaredAccessorDescriptorDataType {
2612 kDescriptorBoolType,
2613 kDescriptorInt8Type, kDescriptorUint8Type,
2614 kDescriptorInt16Type, kDescriptorUint16Type,
2615 kDescriptorInt32Type, kDescriptorUint32Type,
2616 kDescriptorFloatType, kDescriptorDoubleType
2617 };
2618
2619
2620 class V8EXPORT RawOperationDescriptor : public Data {
2621 public:
2622 Local<DeclaredAccessorDescriptor> NewHandleDereference(Isolate* isolate);
2623 Local<RawOperationDescriptor> NewRawDereference(Isolate* isolate);
2624 Local<RawOperationDescriptor> NewRawShift(Isolate* isolate,
2625 int16_t byte_offset);
2626 Local<DeclaredAccessorDescriptor> NewPointerCompare(Isolate* isolate,
2627 void* compare_value);
2628 Local<DeclaredAccessorDescriptor> NewPrimitiveValue(
2629 Isolate* isolate,
2630 DeclaredAccessorDescriptorDataType data_type,
2631 uint8_t bool_offset = 0);
2632 Local<DeclaredAccessorDescriptor> NewBitmaskCompare8(Isolate* isolate,
2633 uint8_t bitmask,
2634 uint8_t compare_value);
2635 Local<DeclaredAccessorDescriptor> NewBitmaskCompare16(
2636 Isolate* isolate,
2637 uint16_t bitmask,
2638 uint16_t compare_value);
2639 Local<DeclaredAccessorDescriptor> NewBitmaskCompare32(
2640 Isolate* isolate,
2641 uint32_t bitmask,
2642 uint32_t compare_value);
2643
2644 private:
2645 RawOperationDescriptor();
2646 };
2647
2648
2588 /** 2649 /**
2589 * A utility for determining the type of objects based on the template 2650 * A utility for determining the type of objects based on the template
2590 * they were constructed from. 2651 * they were constructed from.
2591 */ 2652 */
2592 class V8EXPORT TypeSwitch : public Data { 2653 class V8EXPORT TypeSwitch : public Data {
2593 public: 2654 public:
2594 static Local<TypeSwitch> New(Handle<FunctionTemplate> type); 2655 static Local<TypeSwitch> New(Handle<FunctionTemplate> type);
2595 static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]); 2656 static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]);
2596 int match(Handle<Value> value); 2657 int match(Handle<Value> value);
2597 private: 2658 private:
(...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after
4922 4983
4923 4984
4924 } // namespace v8 4985 } // namespace v8
4925 4986
4926 4987
4927 #undef V8EXPORT 4988 #undef V8EXPORT
4928 #undef TYPE_CHECK 4989 #undef TYPE_CHECK
4929 4990
4930 4991
4931 #endif // V8_H_ 4992 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698