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

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: Addressed Kevin's comments. 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 // Objects allocated in their own spaces (never in new space). 510 // Objects allocated in their own spaces (never in new space).
509 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE 511 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE
510 CODE_TYPE, 512 CODE_TYPE,
511 ODDBALL_TYPE, 513 ODDBALL_TYPE,
512 JS_GLOBAL_PROPERTY_CELL_TYPE, 514 JS_GLOBAL_PROPERTY_CELL_TYPE,
513 515
514 // "Data", objects that cannot contain non-map-word pointers to heap 516 // "Data", objects that cannot contain non-map-word pointers to heap
515 // objects. 517 // objects.
516 HEAP_NUMBER_TYPE, 518 HEAP_NUMBER_TYPE,
517 PROXY_TYPE, 519 PROXY_TYPE,
520 JS_PROXY_TYPE,
518 BYTE_ARRAY_TYPE, 521 BYTE_ARRAY_TYPE,
519 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE 522 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
520 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 523 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
521 EXTERNAL_SHORT_ARRAY_TYPE, 524 EXTERNAL_SHORT_ARRAY_TYPE,
522 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, 525 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE,
523 EXTERNAL_INT_ARRAY_TYPE, 526 EXTERNAL_INT_ARRAY_TYPE,
524 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, 527 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE,
525 EXTERNAL_FLOAT_ARRAY_TYPE, 528 EXTERNAL_FLOAT_ARRAY_TYPE,
526 EXTERNAL_DOUBLE_ARRAY_TYPE, 529 EXTERNAL_DOUBLE_ARRAY_TYPE,
527 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE 530 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 V(JSFunction) \ 716 V(JSFunction) \
714 V(Code) \ 717 V(Code) \
715 V(Oddball) \ 718 V(Oddball) \
716 V(SharedFunctionInfo) \ 719 V(SharedFunctionInfo) \
717 V(JSValue) \ 720 V(JSValue) \
718 V(JSMessageObject) \ 721 V(JSMessageObject) \
719 V(StringWrapper) \ 722 V(StringWrapper) \
720 V(Proxy) \ 723 V(Proxy) \
721 V(Boolean) \ 724 V(Boolean) \
722 V(JSArray) \ 725 V(JSArray) \
726 V(JSProxy) \
723 V(JSRegExp) \ 727 V(JSRegExp) \
724 V(HashTable) \ 728 V(HashTable) \
725 V(Dictionary) \ 729 V(Dictionary) \
726 V(SymbolTable) \ 730 V(SymbolTable) \
727 V(JSFunctionResultCache) \ 731 V(JSFunctionResultCache) \
728 V(NormalizedMapCache) \ 732 V(NormalizedMapCache) \
729 V(CompilationCacheTable) \ 733 V(CompilationCacheTable) \
730 V(CodeCacheHashTable) \ 734 V(CodeCacheHashTable) \
731 V(MapCache) \ 735 V(MapCache) \
732 V(Primitive) \ 736 V(Primitive) \
(...skipping 3207 matching lines...) Expand 10 before | Expand all | Expand 10 after
3940 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, 3944 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset,
3941 kPointerFieldsEndOffset, 3945 kPointerFieldsEndOffset,
3942 kSize> BodyDescriptor; 3946 kSize> BodyDescriptor;
3943 3947
3944 private: 3948 private:
3945 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); 3949 DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
3946 }; 3950 };
3947 3951
3948 3952
3949 // An abstract superclass, a marker class really, for simple structure classes. 3953 // An abstract superclass, a marker class really, for simple structure classes.
3950 // It doesn't carry much functionality but allows struct classes to me 3954 // It doesn't carry much functionality but allows struct classes to be
3951 // identified in the type system. 3955 // identified in the type system.
3952 class Struct: public HeapObject { 3956 class Struct: public HeapObject {
3953 public: 3957 public:
3954 inline void InitializeBody(int object_size); 3958 inline void InitializeBody(int object_size);
3955 static inline Struct* cast(Object* that); 3959 static inline Struct* cast(Object* that);
3956 }; 3960 };
3957 3961
3958 3962
3959 // Script describes a script which has been added to the VM. 3963 // Script describes a script which has been added to the VM.
3960 class Script: public Struct { 3964 class Script: public Struct {
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after
6070 6074
6071 // Returns the isolate/heap this cell object belongs to. 6075 // Returns the isolate/heap this cell object belongs to.
6072 inline Isolate* isolate(); 6076 inline Isolate* isolate();
6073 inline Heap* heap(); 6077 inline Heap* heap();
6074 6078
6075 private: 6079 private:
6076 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); 6080 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell);
6077 }; 6081 };
6078 6082
6079 6083
6084 // The JSProxy describes EcmaScript Harmony proxies
6085 class JSProxy: public HeapObject {
6086 public:
6087 // [handler]: The handler property.
6088 DECL_ACCESSORS(handler, Object)
6089
6090 // Casting.
6091 static inline JSProxy* cast(Object* obj);
6092
6093 // Dispatched behavior.
6094 #ifdef OBJECT_PRINT
6095 inline void JSProxyPrint() {
6096 JSProxyPrint(stdout);
6097 }
6098 void JSProxyPrint(FILE* out);
6099 #endif
6100 #ifdef DEBUG
6101 void JSProxyVerify();
6102 #endif
6103
6104 // Layout description.
6105 static const int kHandlerOffset = HeapObject::kHeaderSize;
6106 static const int kSize = kHandlerOffset + kPointerSize;
6107
6108 typedef FixedBodyDescriptor<kHandlerOffset,
6109 kHandlerOffset + kPointerSize,
6110 kSize> BodyDescriptor;
6111
6112 private:
6113 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy);
6114 };
6115
6116
6080 6117
6081 // Proxy describes objects pointing from JavaScript to C structures. 6118 // Proxy describes objects pointing from JavaScript to C structures.
6082 // Since they cannot contain references to JS HeapObjects they can be 6119 // Since they cannot contain references to JS HeapObjects they can be
6083 // placed in old_data_space. 6120 // placed in old_data_space.
6084 class Proxy: public HeapObject { 6121 class Proxy: public HeapObject {
6085 public: 6122 public:
6086 // [proxy]: field containing the address. 6123 // [proxy]: field containing the address.
6087 inline Address proxy(); 6124 inline Address proxy();
6088 inline void set_proxy(Address value); 6125 inline void set_proxy(Address value);
6089 6126
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
6712 } else { 6749 } else {
6713 value &= ~(1 << bit_position); 6750 value &= ~(1 << bit_position);
6714 } 6751 }
6715 return value; 6752 return value;
6716 } 6753 }
6717 }; 6754 };
6718 6755
6719 } } // namespace v8::internal 6756 } } // namespace v8::internal
6720 6757
6721 #endif // V8_OBJECTS_H_ 6758 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698