OLD | NEW |
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 5020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5031 static const int kCompilerHintsSmiTagSize = 0; | 5031 static const int kCompilerHintsSmiTagSize = 0; |
5032 static const int kCompilerHintsSize = kIntSize; | 5032 static const int kCompilerHintsSize = kIntSize; |
5033 #endif | 5033 #endif |
5034 | 5034 |
5035 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= | 5035 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= |
5036 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); | 5036 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); |
5037 | 5037 |
5038 public: | 5038 public: |
5039 // Constants for optimizing codegen for strict mode function and | 5039 // Constants for optimizing codegen for strict mode function and |
5040 // native tests. | 5040 // native tests. |
5041 // Allows to use byte-widgh instructions. | 5041 // Allows to use byte-width instructions. |
5042 static const int kStrictModeBitWithinByte = | 5042 static const int kStrictModeBitWithinByte = |
5043 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; | 5043 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; |
5044 | 5044 |
5045 static const int kNativeBitWithinByte = | 5045 static const int kNativeBitWithinByte = |
5046 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte; | 5046 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte; |
5047 | 5047 |
5048 #if __BYTE_ORDER == __LITTLE_ENDIAN | 5048 #if __BYTE_ORDER == __LITTLE_ENDIAN |
5049 static const int kStrictModeByteOffset = kCompilerHintsOffset + | 5049 static const int kStrictModeByteOffset = kCompilerHintsOffset + |
5050 (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte; | 5050 (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte; |
5051 static const int kNativeByteOffset = kCompilerHintsOffset + | 5051 static const int kNativeByteOffset = kCompilerHintsOffset + |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5109 // recompiled the next time it is executed. | 5109 // recompiled the next time it is executed. |
5110 void MarkForLazyRecompilation(); | 5110 void MarkForLazyRecompilation(); |
5111 | 5111 |
5112 // Tells whether or not the function is already marked for lazy | 5112 // Tells whether or not the function is already marked for lazy |
5113 // recompilation. | 5113 // recompilation. |
5114 inline bool IsMarkedForLazyRecompilation(); | 5114 inline bool IsMarkedForLazyRecompilation(); |
5115 | 5115 |
5116 // Check whether or not this function is inlineable. | 5116 // Check whether or not this function is inlineable. |
5117 bool IsInlineable(); | 5117 bool IsInlineable(); |
5118 | 5118 |
5119 // [literals]: Fixed array holding the materialized literals. | 5119 // [literals_or_bindings]: Fixed array holding either |
| 5120 // the materialized literals or the bindings of a bound function. |
5120 // | 5121 // |
5121 // If the function contains object, regexp or array literals, the | 5122 // If the function contains object, regexp or array literals, the |
5122 // literals array prefix contains the object, regexp, and array | 5123 // literals array prefix contains the object, regexp, and array |
5123 // function to be used when creating these literals. This is | 5124 // function to be used when creating these literals. This is |
5124 // necessary so that we do not dynamically lookup the object, regexp | 5125 // necessary so that we do not dynamically lookup the object, regexp |
5125 // or array functions. Performing a dynamic lookup, we might end up | 5126 // or array functions. Performing a dynamic lookup, we might end up |
5126 // using the functions from a new context that we should not have | 5127 // using the functions from a new context that we should not have |
5127 // access to. | 5128 // access to. |
5128 DECL_ACCESSORS(literals, FixedArray) | 5129 // |
| 5130 // On bound functions, the array is a (copy-on-write) fixed-array containing |
| 5131 // the function that was bound, bound this-value and any bound |
| 5132 // arguments. Bound functions never contain literals. |
| 5133 DECL_ACCESSORS(literals_or_bindings, FixedArray) |
| 5134 |
| 5135 inline FixedArray* literals(); |
| 5136 inline void set_literals(FixedArray* literals); |
| 5137 |
| 5138 inline FixedArray* function_bindings(); |
| 5139 inline void set_function_bindings(FixedArray* bindings); |
5129 | 5140 |
5130 // The initial map for an object created by this constructor. | 5141 // The initial map for an object created by this constructor. |
5131 inline Map* initial_map(); | 5142 inline Map* initial_map(); |
5132 inline void set_initial_map(Map* value); | 5143 inline void set_initial_map(Map* value); |
5133 inline bool has_initial_map(); | 5144 inline bool has_initial_map(); |
5134 | 5145 |
5135 // Get and set the prototype property on a JSFunction. If the | 5146 // Get and set the prototype property on a JSFunction. If the |
5136 // function has an initial map the prototype is set on the initial | 5147 // function has an initial map the prototype is set on the initial |
5137 // map. Otherwise, the prototype is put in the initial map field | 5148 // map. Otherwise, the prototype is put in the initial map field |
5138 // until an initial map is needed. | 5149 // until an initial map is needed. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5206 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; | 5217 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; |
5207 static const int kLiteralsOffset = kContextOffset + kPointerSize; | 5218 static const int kLiteralsOffset = kContextOffset + kPointerSize; |
5208 static const int kNonWeakFieldsEndOffset = kLiteralsOffset + kPointerSize; | 5219 static const int kNonWeakFieldsEndOffset = kLiteralsOffset + kPointerSize; |
5209 static const int kNextFunctionLinkOffset = kNonWeakFieldsEndOffset; | 5220 static const int kNextFunctionLinkOffset = kNonWeakFieldsEndOffset; |
5210 static const int kSize = kNextFunctionLinkOffset + kPointerSize; | 5221 static const int kSize = kNextFunctionLinkOffset + kPointerSize; |
5211 | 5222 |
5212 // Layout of the literals array. | 5223 // Layout of the literals array. |
5213 static const int kLiteralsPrefixSize = 1; | 5224 static const int kLiteralsPrefixSize = 1; |
5214 static const int kLiteralGlobalContextIndex = 0; | 5225 static const int kLiteralGlobalContextIndex = 0; |
5215 | 5226 |
| 5227 // Layout of the bound-function binding array. |
| 5228 static const int kBoundFunctionIndex = 0; |
| 5229 static const int kBoundThisIndex = 1; |
| 5230 static const int kBoundArgumentsStartIndex = 2; |
| 5231 |
5216 private: | 5232 private: |
5217 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction); | 5233 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction); |
5218 }; | 5234 }; |
5219 | 5235 |
5220 | 5236 |
5221 // JSGlobalProxy's prototype must be a JSGlobalObject or null, | 5237 // JSGlobalProxy's prototype must be a JSGlobalObject or null, |
5222 // and the prototype is hidden. JSGlobalProxy always delegates | 5238 // and the prototype is hidden. JSGlobalProxy always delegates |
5223 // property accesses to its prototype if the prototype is not null. | 5239 // property accesses to its prototype if the prototype is not null. |
5224 // | 5240 // |
5225 // A JSGlobalProxy can be reinitialized which will preserve its identity. | 5241 // A JSGlobalProxy can be reinitialized which will preserve its identity. |
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7589 } else { | 7605 } else { |
7590 value &= ~(1 << bit_position); | 7606 value &= ~(1 << bit_position); |
7591 } | 7607 } |
7592 return value; | 7608 return value; |
7593 } | 7609 } |
7594 }; | 7610 }; |
7595 | 7611 |
7596 } } // namespace v8::internal | 7612 } } // namespace v8::internal |
7597 | 7613 |
7598 #endif // V8_OBJECTS_H_ | 7614 #endif // V8_OBJECTS_H_ |
OLD | NEW |