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

Side by Side Diff: src/objects.h

Issue 7035007: Implement get trap for proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implementing get trap for proxies. 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 String* key, 801 String* key,
798 PropertyAttributes* attributes); 802 PropertyAttributes* attributes);
799 MUST_USE_RESULT MaybeObject* GetProperty(Object* receiver, 803 MUST_USE_RESULT MaybeObject* GetProperty(Object* receiver,
800 LookupResult* result, 804 LookupResult* result,
801 String* key, 805 String* key,
802 PropertyAttributes* attributes); 806 PropertyAttributes* attributes);
803 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, 807 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver,
804 Object* structure, 808 Object* structure,
805 String* name, 809 String* name,
806 Object* holder); 810 Object* holder);
811 MUST_USE_RESULT MaybeObject* GetPropertyWithHandler(Object* receiver,
812 String* name,
813 Object* handler);
807 MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object* receiver, 814 MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object* receiver,
808 JSFunction* getter); 815 JSFunction* getter);
809 816
810 inline MaybeObject* GetElement(uint32_t index); 817 inline MaybeObject* GetElement(uint32_t index);
811 // For use when we know that no exception can be thrown. 818 // For use when we know that no exception can be thrown.
812 inline Object* GetElementNoExceptionThrown(uint32_t index); 819 inline Object* GetElementNoExceptionThrown(uint32_t index);
813 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); 820 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index);
814 821
815 // Return the object's prototype (might be Heap::null_value()). 822 // Return the object's prototype (might be Heap::null_value()).
816 Object* GetPrototype(); 823 Object* GetPrototype();
(...skipping 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3949 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, 3956 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset,
3950 kPointerFieldsEndOffset, 3957 kPointerFieldsEndOffset,
3951 kSize> BodyDescriptor; 3958 kSize> BodyDescriptor;
3952 3959
3953 private: 3960 private:
3954 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); 3961 DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
3955 }; 3962 };
3956 3963
3957 3964
3958 // An abstract superclass, a marker class really, for simple structure classes. 3965 // An abstract superclass, a marker class really, for simple structure classes.
3959 // It doesn't carry much functionality but allows struct classes to me 3966 // It doesn't carry much functionality but allows struct classes to be
3960 // identified in the type system. 3967 // identified in the type system.
3961 class Struct: public HeapObject { 3968 class Struct: public HeapObject {
3962 public: 3969 public:
3963 inline void InitializeBody(int object_size); 3970 inline void InitializeBody(int object_size);
3964 static inline Struct* cast(Object* that); 3971 static inline Struct* cast(Object* that);
3965 }; 3972 };
3966 3973
3967 3974
3968 // Script describes a script which has been added to the VM. 3975 // Script describes a script which has been added to the VM.
3969 class Script: public Struct { 3976 class Script: public Struct {
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after
6096 6103
6097 // Returns the isolate/heap this cell object belongs to. 6104 // Returns the isolate/heap this cell object belongs to.
6098 inline Isolate* isolate(); 6105 inline Isolate* isolate();
6099 inline Heap* heap(); 6106 inline Heap* heap();
6100 6107
6101 private: 6108 private:
6102 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); 6109 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell);
6103 }; 6110 };
6104 6111
6105 6112
6113 // The JSProxy describes EcmaScript Harmony proxies
6114 class JSProxy: public HeapObject {
6115 public:
6116 // [handler]: The handler property.
6117 DECL_ACCESSORS(handler, Object)
6118
6119 // Casting.
6120 static inline JSProxy* cast(Object* obj);
6121
6122 // Dispatched behavior.
6123 #ifdef OBJECT_PRINT
6124 inline void JSProxyPrint() {
6125 JSProxyPrint(stdout);
6126 }
6127 void JSProxyPrint(FILE* out);
6128 #endif
6129 #ifdef DEBUG
6130 void JSProxyVerify();
6131 #endif
6132
6133 // Layout description.
6134 static const int kHandlerOffset = HeapObject::kHeaderSize;
6135 static const int kSize = kHandlerOffset + kPointerSize;
6136
6137 typedef FixedBodyDescriptor<kHandlerOffset,
6138 kHandlerOffset + kPointerSize,
6139 kSize> BodyDescriptor;
6140
6141 private:
6142 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy);
6143 };
6144
6145
6106 6146
6107 // Proxy describes objects pointing from JavaScript to C structures. 6147 // Proxy describes objects pointing from JavaScript to C structures.
6108 // Since they cannot contain references to JS HeapObjects they can be 6148 // Since they cannot contain references to JS HeapObjects they can be
6109 // placed in old_data_space. 6149 // placed in old_data_space.
6110 class Proxy: public HeapObject { 6150 class Proxy: public HeapObject {
6111 public: 6151 public:
6112 // [proxy]: field containing the address. 6152 // [proxy]: field containing the address.
6113 inline Address proxy(); 6153 inline Address proxy();
6114 inline void set_proxy(Address value); 6154 inline void set_proxy(Address value);
6115 6155
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
6738 } else { 6778 } else {
6739 value &= ~(1 << bit_position); 6779 value &= ~(1 << bit_position);
6740 } 6780 }
6741 return value; 6781 return value;
6742 } 6782 }
6743 }; 6783 };
6744 6784
6745 } } // namespace v8::internal 6785 } } // namespace v8::internal
6746 6786
6747 #endif // V8_OBJECTS_H_ 6787 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698