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

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: addressed nits Created 7 years, 9 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') | 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 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 // This function is not yet stable and should not be used at this time.
1613 bool SetAccessor(Handle<String> name,
1614 Handle<DeclaredAccessorDescriptor> descriptor,
1615 AccessControl settings = DEFAULT,
1616 PropertyAttribute attribute = None);
1617
1609 /** 1618 /**
1610 * Returns an array containing the names of the enumerable properties 1619 * Returns an array containing the names of the enumerable properties
1611 * of this object, including properties from prototype objects. The 1620 * of this object, including properties from prototype objects. The
1612 * array returned by this method contains the same values as would 1621 * array returned by this method contains the same values as would
1613 * be enumerated by a for-in statement over this object. 1622 * be enumerated by a for-in statement over this object.
1614 */ 1623 */
1615 Local<Array> GetPropertyNames(); 1624 Local<Array> GetPropertyNames();
1616 1625
1617 /** 1626 /**
1618 * This function has the same functionality as GetPropertyNames but 1627 * This function has the same functionality as GetPropertyNames but
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 void ReadOnlyPrototype(); 2379 void ReadOnlyPrototype();
2371 2380
2372 /** 2381 /**
2373 * Returns true if the given object is an instance of this function 2382 * Returns true if the given object is an instance of this function
2374 * template. 2383 * template.
2375 */ 2384 */
2376 bool HasInstance(Handle<Value> object); 2385 bool HasInstance(Handle<Value> object);
2377 2386
2378 private: 2387 private:
2379 FunctionTemplate(); 2388 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, 2389 void SetNamedInstancePropertyHandler(NamedPropertyGetter getter,
2388 NamedPropertySetter setter, 2390 NamedPropertySetter setter,
2389 NamedPropertyQuery query, 2391 NamedPropertyQuery query,
2390 NamedPropertyDeleter remover, 2392 NamedPropertyDeleter remover,
2391 NamedPropertyEnumerator enumerator, 2393 NamedPropertyEnumerator enumerator,
2392 Handle<Value> data); 2394 Handle<Value> data);
2393 void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter, 2395 void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter,
2394 IndexedPropertySetter setter, 2396 IndexedPropertySetter setter,
2395 IndexedPropertyQuery query, 2397 IndexedPropertyQuery query,
2396 IndexedPropertyDeleter remover, 2398 IndexedPropertyDeleter remover,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2449 */ 2451 */
2450 void SetAccessor(Handle<String> name, 2452 void SetAccessor(Handle<String> name,
2451 AccessorGetter getter, 2453 AccessorGetter getter,
2452 AccessorSetter setter = 0, 2454 AccessorSetter setter = 0,
2453 Handle<Value> data = Handle<Value>(), 2455 Handle<Value> data = Handle<Value>(),
2454 AccessControl settings = DEFAULT, 2456 AccessControl settings = DEFAULT,
2455 PropertyAttribute attribute = None, 2457 PropertyAttribute attribute = None,
2456 Handle<AccessorSignature> signature = 2458 Handle<AccessorSignature> signature =
2457 Handle<AccessorSignature>()); 2459 Handle<AccessorSignature>());
2458 2460
2461 // This function is not yet stable and should not be used at this time.
2462 bool SetAccessor(Handle<String> name,
2463 Handle<DeclaredAccessorDescriptor> descriptor,
2464 AccessControl settings = DEFAULT,
2465 PropertyAttribute attribute = None,
2466 Handle<AccessorSignature> signature =
2467 Handle<AccessorSignature>());
2468
2459 /** 2469 /**
2460 * Sets a named property handler on the object template. 2470 * Sets a named property handler on the object template.
2461 * 2471 *
2462 * Whenever a named property is accessed on objects created from 2472 * Whenever a named property is accessed on objects created from
2463 * this object template, the provided callback is invoked instead of 2473 * this object template, the provided callback is invoked instead of
2464 * accessing the property directly on the JavaScript object. 2474 * accessing the property directly on the JavaScript object.
2465 * 2475 *
2466 * \param getter The callback to invoke when getting a property. 2476 * \param getter The callback to invoke when getting a property.
2467 * \param setter The callback to invoke when setting a property. 2477 * \param setter The callback to invoke when setting a property.
2468 * \param query The callback to invoke to check if a property is present, 2478 * \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 */ 2588 */
2579 class V8EXPORT AccessorSignature : public Data { 2589 class V8EXPORT AccessorSignature : public Data {
2580 public: 2590 public:
2581 static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver = 2591 static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver =
2582 Handle<FunctionTemplate>()); 2592 Handle<FunctionTemplate>());
2583 private: 2593 private:
2584 AccessorSignature(); 2594 AccessorSignature();
2585 }; 2595 };
2586 2596
2587 2597
2598 class V8EXPORT DeclaredAccessorDescriptor : public Data {
2599 private:
2600 DeclaredAccessorDescriptor();
2601 };
2602
2603
2604 class V8EXPORT ObjectOperationDescriptor : public Data {
2605 public:
2606 // This function is not yet stable and should not be used at this time.
2607 static Local<RawOperationDescriptor> NewInternalFieldDereference(
2608 Isolate* isolate,
2609 int internal_field);
2610 private:
2611 ObjectOperationDescriptor();
2612 };
2613
2614
2615 enum DeclaredAccessorDescriptorDataType {
2616 kDescriptorBoolType,
2617 kDescriptorInt8Type, kDescriptorUint8Type,
2618 kDescriptorInt16Type, kDescriptorUint16Type,
2619 kDescriptorInt32Type, kDescriptorUint32Type,
2620 kDescriptorFloatType, kDescriptorDoubleType
2621 };
2622
2623
2624 class V8EXPORT RawOperationDescriptor : public Data {
2625 public:
2626 Local<DeclaredAccessorDescriptor> NewHandleDereference(Isolate* isolate);
2627 Local<RawOperationDescriptor> NewRawDereference(Isolate* isolate);
2628 Local<RawOperationDescriptor> NewRawShift(Isolate* isolate,
2629 int16_t byte_offset);
2630 Local<DeclaredAccessorDescriptor> NewPointerCompare(Isolate* isolate,
2631 void* compare_value);
2632 Local<DeclaredAccessorDescriptor> NewPrimitiveValue(
2633 Isolate* isolate,
2634 DeclaredAccessorDescriptorDataType data_type,
2635 uint8_t bool_offset = 0);
2636 Local<DeclaredAccessorDescriptor> NewBitmaskCompare8(Isolate* isolate,
2637 uint8_t bitmask,
2638 uint8_t compare_value);
2639 Local<DeclaredAccessorDescriptor> NewBitmaskCompare16(
2640 Isolate* isolate,
2641 uint16_t bitmask,
2642 uint16_t compare_value);
2643 Local<DeclaredAccessorDescriptor> NewBitmaskCompare32(
2644 Isolate* isolate,
2645 uint32_t bitmask,
2646 uint32_t compare_value);
2647
2648 private:
2649 RawOperationDescriptor();
2650 };
2651
2652
2588 /** 2653 /**
2589 * A utility for determining the type of objects based on the template 2654 * A utility for determining the type of objects based on the template
2590 * they were constructed from. 2655 * they were constructed from.
2591 */ 2656 */
2592 class V8EXPORT TypeSwitch : public Data { 2657 class V8EXPORT TypeSwitch : public Data {
2593 public: 2658 public:
2594 static Local<TypeSwitch> New(Handle<FunctionTemplate> type); 2659 static Local<TypeSwitch> New(Handle<FunctionTemplate> type);
2595 static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]); 2660 static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]);
2596 int match(Handle<Value> value); 2661 int match(Handle<Value> value);
2597 private: 2662 private:
(...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after
4956 5021
4957 5022
4958 } // namespace v8 5023 } // namespace v8
4959 5024
4960 5025
4961 #undef V8EXPORT 5026 #undef V8EXPORT
4962 #undef TYPE_CHECK 5027 #undef TYPE_CHECK
4963 5028
4964 5029
4965 #endif // V8_H_ 5030 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698