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

Side by Side Diff: src/objects.h

Issue 6932068: A first skeleton for introducing Harmony proxies (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 7 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // - SeqAsciiString 83 // - SeqAsciiString
84 // - SeqTwoByteString 84 // - SeqTwoByteString
85 // - ConsString 85 // - ConsString
86 // - ExternalString 86 // - ExternalString
87 // - ExternalAsciiString 87 // - ExternalAsciiString
88 // - ExternalTwoByteString 88 // - ExternalTwoByteString
89 // - HeapNumber 89 // - HeapNumber
90 // - Code 90 // - Code
91 // - Map 91 // - Map
92 // - Oddball 92 // - Oddball
93 // - JSProxy
93 // - Proxy 94 // - Proxy
94 // - SharedFunctionInfo 95 // - SharedFunctionInfo
95 // - Struct 96 // - Struct
96 // - AccessorInfo 97 // - AccessorInfo
97 // - AccessCheckInfo 98 // - AccessCheckInfo
98 // - InterceptorInfo 99 // - InterceptorInfo
99 // - CallHandlerInfo 100 // - CallHandlerInfo
100 // - TemplateInfo 101 // - TemplateInfo
101 // - FunctionTemplateInfo 102 // - FunctionTemplateInfo
102 // - ObjectTemplateInfo 103 // - ObjectTemplateInfo
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ 281 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \
281 V(EXTERNAL_ASCII_STRING_TYPE) \ 282 V(EXTERNAL_ASCII_STRING_TYPE) \
282 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ 283 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \
283 \ 284 \
284 V(MAP_TYPE) \ 285 V(MAP_TYPE) \
285 V(CODE_TYPE) \ 286 V(CODE_TYPE) \
286 V(ODDBALL_TYPE) \ 287 V(ODDBALL_TYPE) \
287 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ 288 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \
288 \ 289 \
289 V(HEAP_NUMBER_TYPE) \ 290 V(HEAP_NUMBER_TYPE) \
291 V(JS_PROXY_TYPE) \
290 V(PROXY_TYPE) \ 292 V(PROXY_TYPE) \
291 V(BYTE_ARRAY_TYPE) \ 293 V(BYTE_ARRAY_TYPE) \
292 /* Note: the order of these external array */ \ 294 /* Note: the order of these external array */ \
293 /* types is relied upon in */ \ 295 /* types is relied upon in */ \
294 /* Object::IsExternalArray(). */ \ 296 /* Object::IsExternalArray(). */ \
295 V(EXTERNAL_BYTE_ARRAY_TYPE) \ 297 V(EXTERNAL_BYTE_ARRAY_TYPE) \
296 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ 298 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \
297 V(EXTERNAL_SHORT_ARRAY_TYPE) \ 299 V(EXTERNAL_SHORT_ARRAY_TYPE) \
298 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \ 300 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \
299 V(EXTERNAL_INT_ARRAY_TYPE) \ 301 V(EXTERNAL_INT_ARRAY_TYPE) \
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 // Objects allocated in their own spaces (never in new space). 511 // Objects allocated in their own spaces (never in new space).
510 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE 512 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE
511 CODE_TYPE, 513 CODE_TYPE,
512 ODDBALL_TYPE, 514 ODDBALL_TYPE,
513 JS_GLOBAL_PROPERTY_CELL_TYPE, 515 JS_GLOBAL_PROPERTY_CELL_TYPE,
514 516
515 // "Data", objects that cannot contain non-map-word pointers to heap 517 // "Data", objects that cannot contain non-map-word pointers to heap
516 // objects. 518 // objects.
517 HEAP_NUMBER_TYPE, 519 HEAP_NUMBER_TYPE,
518 PROXY_TYPE, 520 PROXY_TYPE,
521 JS_PROXY_TYPE,
519 BYTE_ARRAY_TYPE, 522 BYTE_ARRAY_TYPE,
520 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE 523 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
521 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 524 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
522 EXTERNAL_SHORT_ARRAY_TYPE, 525 EXTERNAL_SHORT_ARRAY_TYPE,
523 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, 526 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE,
524 EXTERNAL_INT_ARRAY_TYPE, 527 EXTERNAL_INT_ARRAY_TYPE,
525 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, 528 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE,
526 EXTERNAL_FLOAT_ARRAY_TYPE, 529 EXTERNAL_FLOAT_ARRAY_TYPE,
527 EXTERNAL_DOUBLE_ARRAY_TYPE, 530 EXTERNAL_DOUBLE_ARRAY_TYPE,
528 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE 531 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 V(JSFunction) \ 719 V(JSFunction) \
717 V(Code) \ 720 V(Code) \
718 V(Oddball) \ 721 V(Oddball) \
719 V(SharedFunctionInfo) \ 722 V(SharedFunctionInfo) \
720 V(JSValue) \ 723 V(JSValue) \
721 V(JSMessageObject) \ 724 V(JSMessageObject) \
722 V(StringWrapper) \ 725 V(StringWrapper) \
723 V(Proxy) \ 726 V(Proxy) \
724 V(Boolean) \ 727 V(Boolean) \
725 V(JSArray) \ 728 V(JSArray) \
729 V(JSProxy) \
726 V(JSRegExp) \ 730 V(JSRegExp) \
727 V(HashTable) \ 731 V(HashTable) \
728 V(Dictionary) \ 732 V(Dictionary) \
729 V(SymbolTable) \ 733 V(SymbolTable) \
730 V(JSFunctionResultCache) \ 734 V(JSFunctionResultCache) \
731 V(NormalizedMapCache) \ 735 V(NormalizedMapCache) \
732 V(CompilationCacheTable) \ 736 V(CompilationCacheTable) \
733 V(CodeCacheHashTable) \ 737 V(CodeCacheHashTable) \
734 V(MapCache) \ 738 V(MapCache) \
735 V(Primitive) \ 739 V(Primitive) \
(...skipping 3207 matching lines...) Expand 10 before | Expand all | Expand 10 after
3943 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, 3947 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset,
3944 kPointerFieldsEndOffset, 3948 kPointerFieldsEndOffset,
3945 kSize> BodyDescriptor; 3949 kSize> BodyDescriptor;
3946 3950
3947 private: 3951 private:
3948 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); 3952 DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
3949 }; 3953 };
3950 3954
3951 3955
3952 // An abstract superclass, a marker class really, for simple structure classes. 3956 // An abstract superclass, a marker class really, for simple structure classes.
3953 // It doesn't carry much functionality but allows struct classes to me 3957 // It doesn't carry much functionality but allows struct classes to be
3954 // identified in the type system. 3958 // identified in the type system.
3955 class Struct: public HeapObject { 3959 class Struct: public HeapObject {
3956 public: 3960 public:
3957 inline void InitializeBody(int object_size); 3961 inline void InitializeBody(int object_size);
3958 static inline Struct* cast(Object* that); 3962 static inline Struct* cast(Object* that);
3959 }; 3963 };
3960 3964
3961 3965
3962 // Script describes a script which has been added to the VM. 3966 // Script describes a script which has been added to the VM.
3963 class Script: public Struct { 3967 class Script: public Struct {
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after
6073 6077
6074 // Returns the isolate/heap this cell object belongs to. 6078 // Returns the isolate/heap this cell object belongs to.
6075 inline Isolate* isolate(); 6079 inline Isolate* isolate();
6076 inline Heap* heap(); 6080 inline Heap* heap();
6077 6081
6078 private: 6082 private:
6079 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); 6083 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell);
6080 }; 6084 };
6081 6085
6082 6086
6087 // The JSProxy describes EcmaScript Harmony proxies
6088 class JSProxy: public HeapObject {
6089 public:
6090 // [handler]: The handler property.
6091 DECL_ACCESSORS(handler, Object)
6092
6093 // Casting.
6094 static inline JSProxy* cast(Object* obj);
6095
6096 // Dispatched behavior.
6097 #ifdef OBJECT_PRINT
6098 inline void JSProxyPrint() {
6099 JSProxyPrint(stdout);
6100 }
6101 void JSProxyPrint(FILE* out);
6102 #endif
6103 #ifdef DEBUG
6104 void JSProxyVerify();
6105 #endif
6106
6107 // Layout description.
6108 static const int kHandlerOffset = HeapObject::kHeaderSize;
6109 static const int kSize = kHandlerOffset + kPointerSize;
6110
6111 typedef FixedBodyDescriptor<kHandlerOffset,
6112 kHandlerOffset + kPointerSize,
6113 kSize> BodyDescriptor;
6114
6115 private:
6116 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy);
6117 };
6118
6119
6083 6120
6084 // Proxy describes objects pointing from JavaScript to C structures. 6121 // Proxy describes objects pointing from JavaScript to C structures.
6085 // Since they cannot contain references to JS HeapObjects they can be 6122 // Since they cannot contain references to JS HeapObjects they can be
6086 // placed in old_data_space. 6123 // placed in old_data_space.
6087 class Proxy: public HeapObject { 6124 class Proxy: public HeapObject {
6088 public: 6125 public:
6089 // [proxy]: field containing the address. 6126 // [proxy]: field containing the address.
6090 inline Address proxy(); 6127 inline Address proxy();
6091 inline void set_proxy(Address value); 6128 inline void set_proxy(Address value);
6092 6129
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
6715 } else { 6752 } else {
6716 value &= ~(1 << bit_position); 6753 value &= ~(1 << bit_position);
6717 } 6754 }
6718 return value; 6755 return value;
6719 } 6756 }
6720 }; 6757 };
6721 6758
6722 } } // namespace v8::internal 6759 } } // namespace v8::internal
6723 6760
6724 #endif // V8_OBJECTS_H_ 6761 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698