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

Side by Side Diff: src/objects.h

Issue 1722003: Added ability to remove prototype from function. In this case, [[Construct]] ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Fixes according to Erik's comments Created 10 years, 8 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 2836 matching lines...) Expand 10 before | Expand all | Expand 10 after
2847 inline void set_bit_field2(byte value); 2847 inline void set_bit_field2(byte value);
2848 2848
2849 // Tells whether the object in the prototype property will be used 2849 // Tells whether the object in the prototype property will be used
2850 // for instances created from this function. If the prototype 2850 // for instances created from this function. If the prototype
2851 // property is set to a value that is not a JSObject, the prototype 2851 // property is set to a value that is not a JSObject, the prototype
2852 // property will not be used to create instances of the function. 2852 // property will not be used to create instances of the function.
2853 // See ECMA-262, 13.2.2. 2853 // See ECMA-262, 13.2.2.
2854 inline void set_non_instance_prototype(bool value); 2854 inline void set_non_instance_prototype(bool value);
2855 inline bool has_non_instance_prototype(); 2855 inline bool has_non_instance_prototype();
2856 2856
2857 // Tells whether function has special prototype property. If not, prototype
2858 // property will not be created when accessed (will return undefined),
2859 // and construction from this function will not be allowed.
2860 inline void set_function_with_prototype(bool value);
2861 inline bool function_with_prototype();
2862
2857 // Tells whether the instance with this map should be ignored by the 2863 // Tells whether the instance with this map should be ignored by the
2858 // __proto__ accessor. 2864 // __proto__ accessor.
2859 inline void set_is_hidden_prototype() { 2865 inline void set_is_hidden_prototype() {
2860 set_bit_field(bit_field() | (1 << kIsHiddenPrototype)); 2866 set_bit_field(bit_field() | (1 << kIsHiddenPrototype));
2861 } 2867 }
2862 2868
2863 inline bool is_hidden_prototype() { 2869 inline bool is_hidden_prototype() {
2864 return ((1 << kIsHiddenPrototype) & bit_field()) != 0; 2870 return ((1 << kIsHiddenPrototype) & bit_field()) != 0;
2865 } 2871 }
2866 2872
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 static const int kHasNonInstancePrototype = 1; 3029 static const int kHasNonInstancePrototype = 1;
3024 static const int kIsHiddenPrototype = 2; 3030 static const int kIsHiddenPrototype = 2;
3025 static const int kHasNamedInterceptor = 3; 3031 static const int kHasNamedInterceptor = 3;
3026 static const int kHasIndexedInterceptor = 4; 3032 static const int kHasIndexedInterceptor = 4;
3027 static const int kIsUndetectable = 5; 3033 static const int kIsUndetectable = 5;
3028 static const int kHasInstanceCallHandler = 6; 3034 static const int kHasInstanceCallHandler = 6;
3029 static const int kIsAccessCheckNeeded = 7; 3035 static const int kIsAccessCheckNeeded = 7;
3030 3036
3031 // Bit positions for bit field 2 3037 // Bit positions for bit field 2
3032 static const int kIsExtensible = 0; 3038 static const int kIsExtensible = 0;
3039 static const int kFunctionWithPrototype = 1;
3033 3040
3034 // Layout of the default cache. It holds alternating name and code objects. 3041 // Layout of the default cache. It holds alternating name and code objects.
3035 static const int kCodeCacheEntrySize = 2; 3042 static const int kCodeCacheEntrySize = 2;
3036 static const int kCodeCacheEntryNameOffset = 0; 3043 static const int kCodeCacheEntryNameOffset = 0;
3037 static const int kCodeCacheEntryCodeOffset = 1; 3044 static const int kCodeCacheEntryCodeOffset = 1;
3038 3045
3039 private: 3046 private:
3040 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); 3047 DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
3041 }; 3048 };
3042 3049
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
3389 // function has an initial map the prototype is set on the initial 3396 // function has an initial map the prototype is set on the initial
3390 // map. Otherwise, the prototype is put in the initial map field 3397 // map. Otherwise, the prototype is put in the initial map field
3391 // until an initial map is needed. 3398 // until an initial map is needed.
3392 inline bool has_prototype(); 3399 inline bool has_prototype();
3393 inline bool has_instance_prototype(); 3400 inline bool has_instance_prototype();
3394 inline Object* prototype(); 3401 inline Object* prototype();
3395 inline Object* instance_prototype(); 3402 inline Object* instance_prototype();
3396 Object* SetInstancePrototype(Object* value); 3403 Object* SetInstancePrototype(Object* value);
3397 Object* SetPrototype(Object* value); 3404 Object* SetPrototype(Object* value);
3398 3405
3406 // After prototype is removed, it will not be created when accessed, and
3407 // [[Construct]] from this function will not be allowed.
3408 Object* RemovePrototype();
3409 inline bool should_have_prototype();
3410
3399 // Accessor for this function's initial map's [[class]] 3411 // Accessor for this function's initial map's [[class]]
3400 // property. This is primarily used by ECMA native functions. This 3412 // property. This is primarily used by ECMA native functions. This
3401 // method sets the class_name field of this function's initial map 3413 // method sets the class_name field of this function's initial map
3402 // to a given value. It creates an initial map if this function does 3414 // to a given value. It creates an initial map if this function does
3403 // not have one. Note that this method does not copy the initial map 3415 // not have one. Note that this method does not copy the initial map
3404 // if it has one already, but simply replaces it with the new value. 3416 // if it has one already, but simply replaces it with the new value.
3405 // Instances created afterwards will have a map whose [[class]] is 3417 // Instances created afterwards will have a map whose [[class]] is
3406 // set to 'value', but there is no guarantees on instances created 3418 // set to 'value', but there is no guarantees on instances created
3407 // before. 3419 // before.
3408 Object* SetInstanceClassName(String* name); 3420 Object* SetInstanceClassName(String* name);
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
5133 } else { 5145 } else {
5134 value &= ~(1 << bit_position); 5146 value &= ~(1 << bit_position);
5135 } 5147 }
5136 return value; 5148 return value;
5137 } 5149 }
5138 }; 5150 };
5139 5151
5140 } } // namespace v8::internal 5152 } } // namespace v8::internal
5141 5153
5142 #endif // V8_OBJECTS_H_ 5154 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698