OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 6059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6070 inline int stress_deopt_counter(); | 6070 inline int stress_deopt_counter(); |
6071 inline void set_stress_deopt_counter(int counter); | 6071 inline void set_stress_deopt_counter(int counter); |
6072 | 6072 |
6073 inline int profiler_ticks(); | 6073 inline int profiler_ticks(); |
6074 | 6074 |
6075 // Inline cache age is used to infer whether the function survived a context | 6075 // Inline cache age is used to infer whether the function survived a context |
6076 // disposal or not. In the former case we reset the opt_count. | 6076 // disposal or not. In the former case we reset the opt_count. |
6077 inline int ic_age(); | 6077 inline int ic_age(); |
6078 inline void set_ic_age(int age); | 6078 inline void set_ic_age(int age); |
6079 | 6079 |
6080 // Add information on assignments of the form this.x = ...; | |
6081 void SetThisPropertyAssignmentsInfo( | |
6082 bool has_only_simple_this_property_assignments, | |
6083 FixedArray* this_property_assignments); | |
6084 | |
6085 // Clear information on assignments of the form this.x = ...; | |
6086 void ClearThisPropertyAssignmentsInfo(); | |
6087 | |
6088 // Indicate that this function only consists of assignments of the form | |
6089 // this.x = y; where y is either a constant or refers to an argument. | |
6090 inline bool has_only_simple_this_property_assignments(); | |
6091 | |
6092 // Indicates if this function can be lazy compiled. | 6080 // Indicates if this function can be lazy compiled. |
6093 // This is used to determine if we can safely flush code from a function | 6081 // This is used to determine if we can safely flush code from a function |
6094 // when doing GC if we expect that the function will no longer be used. | 6082 // when doing GC if we expect that the function will no longer be used. |
6095 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation) | 6083 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation) |
6096 | 6084 |
6097 // Indicates if this function can be lazy compiled without a context. | 6085 // Indicates if this function can be lazy compiled without a context. |
6098 // This is used to determine if we can force compilation without reaching | 6086 // This is used to determine if we can force compilation without reaching |
6099 // the function through program execution but through other means (e.g. heap | 6087 // the function through program execution but through other means (e.g. heap |
6100 // iteration by the debugger). | 6088 // iteration by the debugger). |
6101 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context) | 6089 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6182 | 6170 |
6183 // Disable (further) attempted optimization of all functions sharing this | 6171 // Disable (further) attempted optimization of all functions sharing this |
6184 // shared function info. | 6172 // shared function info. |
6185 void DisableOptimization(const char* reason); | 6173 void DisableOptimization(const char* reason); |
6186 | 6174 |
6187 // Lookup the bailout ID and ASSERT that it exists in the non-optimized | 6175 // Lookup the bailout ID and ASSERT that it exists in the non-optimized |
6188 // code, returns whether it asserted (i.e., always true if assertions are | 6176 // code, returns whether it asserted (i.e., always true if assertions are |
6189 // disabled). | 6177 // disabled). |
6190 bool VerifyBailoutId(BailoutId id); | 6178 bool VerifyBailoutId(BailoutId id); |
6191 | 6179 |
6192 // Check whether a inlined constructor can be generated with the given | |
6193 // prototype. | |
6194 bool CanGenerateInlineConstructor(Object* prototype); | |
6195 | |
6196 // Prevents further attempts to generate inline constructors. | |
6197 // To be called if generation failed for any reason. | |
6198 void ForbidInlineConstructor(); | |
6199 | |
6200 // For functions which only contains this property assignments this provides | |
6201 // access to the names for the properties assigned. | |
6202 DECL_ACCESSORS(this_property_assignments, Object) | |
6203 inline int this_property_assignments_count(); | |
6204 inline void set_this_property_assignments_count(int value); | |
6205 String* GetThisPropertyAssignmentName(int index); | |
6206 bool IsThisPropertyAssignmentArgument(int index); | |
6207 int GetThisPropertyAssignmentArgument(int index); | |
6208 Object* GetThisPropertyAssignmentConstant(int index); | |
6209 | |
6210 // [source code]: Source code for the function. | 6180 // [source code]: Source code for the function. |
6211 bool HasSourceCode(); | 6181 bool HasSourceCode(); |
6212 Handle<Object> GetSourceCode(); | 6182 Handle<Object> GetSourceCode(); |
6213 | 6183 |
6214 // Number of times the function was optimized. | 6184 // Number of times the function was optimized. |
6215 inline int opt_count(); | 6185 inline int opt_count(); |
6216 inline void set_opt_count(int opt_count); | 6186 inline void set_opt_count(int opt_count); |
6217 | 6187 |
6218 // Number of times the function was deoptimized. | 6188 // Number of times the function was deoptimized. |
6219 inline void set_deopt_count(int value); | 6189 inline void set_deopt_count(int value); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6269 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; | 6239 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
6270 static const int kInstanceClassNameOffset = | 6240 static const int kInstanceClassNameOffset = |
6271 kConstructStubOffset + kPointerSize; | 6241 kConstructStubOffset + kPointerSize; |
6272 static const int kFunctionDataOffset = | 6242 static const int kFunctionDataOffset = |
6273 kInstanceClassNameOffset + kPointerSize; | 6243 kInstanceClassNameOffset + kPointerSize; |
6274 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 6244 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
6275 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 6245 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
6276 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 6246 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
6277 static const int kInitialMapOffset = | 6247 static const int kInitialMapOffset = |
6278 kInferredNameOffset + kPointerSize; | 6248 kInferredNameOffset + kPointerSize; |
6279 static const int kThisPropertyAssignmentsOffset = | |
6280 kInitialMapOffset + kPointerSize; | |
6281 // ast_node_count is a Smi field. It could be grouped with another Smi field | 6249 // ast_node_count is a Smi field. It could be grouped with another Smi field |
6282 // into a PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available. | 6250 // into a PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available. |
6283 static const int kAstNodeCountOffset = | 6251 static const int kAstNodeCountOffset = |
6284 kThisPropertyAssignmentsOffset + kPointerSize; | 6252 kInitialMapOffset + kPointerSize; |
6285 #if V8_HOST_ARCH_32_BIT | 6253 #if V8_HOST_ARCH_32_BIT |
6286 // Smi fields. | 6254 // Smi fields. |
6287 static const int kLengthOffset = | 6255 static const int kLengthOffset = |
6288 kAstNodeCountOffset + kPointerSize; | 6256 kAstNodeCountOffset + kPointerSize; |
6289 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 6257 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
6290 static const int kExpectedNofPropertiesOffset = | 6258 static const int kExpectedNofPropertiesOffset = |
6291 kFormalParameterCountOffset + kPointerSize; | 6259 kFormalParameterCountOffset + kPointerSize; |
6292 static const int kNumLiteralsOffset = | 6260 static const int kNumLiteralsOffset = |
6293 kExpectedNofPropertiesOffset + kPointerSize; | 6261 kExpectedNofPropertiesOffset + kPointerSize; |
6294 static const int kStartPositionAndTypeOffset = | 6262 static const int kStartPositionAndTypeOffset = |
6295 kNumLiteralsOffset + kPointerSize; | 6263 kNumLiteralsOffset + kPointerSize; |
6296 static const int kEndPositionOffset = | 6264 static const int kEndPositionOffset = |
6297 kStartPositionAndTypeOffset + kPointerSize; | 6265 kStartPositionAndTypeOffset + kPointerSize; |
6298 static const int kFunctionTokenPositionOffset = | 6266 static const int kFunctionTokenPositionOffset = |
6299 kEndPositionOffset + kPointerSize; | 6267 kEndPositionOffset + kPointerSize; |
6300 static const int kCompilerHintsOffset = | 6268 static const int kCompilerHintsOffset = |
6301 kFunctionTokenPositionOffset + kPointerSize; | 6269 kFunctionTokenPositionOffset + kPointerSize; |
6302 static const int kThisPropertyAssignmentsCountOffset = | 6270 static const int kOptCountOffset = kCompilerHintsOffset + kPointerSize; |
6303 kCompilerHintsOffset + kPointerSize; | |
6304 static const int kOptCountOffset = | |
6305 kThisPropertyAssignmentsCountOffset + kPointerSize; | |
6306 static const int kCountersOffset = kOptCountOffset + kPointerSize; | 6271 static const int kCountersOffset = kOptCountOffset + kPointerSize; |
6307 static const int kStressDeoptCounterOffset = kCountersOffset + kPointerSize; | 6272 static const int kStressDeoptCounterOffset = kCountersOffset + kPointerSize; |
6308 | 6273 |
6309 // Total size. | 6274 // Total size. |
6310 static const int kSize = kStressDeoptCounterOffset + kPointerSize; | 6275 static const int kSize = kStressDeoptCounterOffset + kPointerSize; |
6311 #else | 6276 #else |
6312 // The only reason to use smi fields instead of int fields | 6277 // The only reason to use smi fields instead of int fields |
6313 // is to allow iteration without maps decoding during | 6278 // is to allow iteration without maps decoding during |
6314 // garbage collections. | 6279 // garbage collections. |
6315 // To avoid wasting space on 64-bit architectures we use | 6280 // To avoid wasting space on 64-bit architectures we use |
(...skipping 15 matching lines...) Expand all Loading... |
6331 static const int kEndPositionOffset = | 6296 static const int kEndPositionOffset = |
6332 kNumLiteralsOffset + kIntSize; | 6297 kNumLiteralsOffset + kIntSize; |
6333 static const int kStartPositionAndTypeOffset = | 6298 static const int kStartPositionAndTypeOffset = |
6334 kEndPositionOffset + kIntSize; | 6299 kEndPositionOffset + kIntSize; |
6335 | 6300 |
6336 static const int kFunctionTokenPositionOffset = | 6301 static const int kFunctionTokenPositionOffset = |
6337 kStartPositionAndTypeOffset + kIntSize; | 6302 kStartPositionAndTypeOffset + kIntSize; |
6338 static const int kCompilerHintsOffset = | 6303 static const int kCompilerHintsOffset = |
6339 kFunctionTokenPositionOffset + kIntSize; | 6304 kFunctionTokenPositionOffset + kIntSize; |
6340 | 6305 |
6341 static const int kThisPropertyAssignmentsCountOffset = | 6306 static const int kOptCountOffset = kCompilerHintsOffset + kIntSize; |
6342 kCompilerHintsOffset + kIntSize; | |
6343 static const int kOptCountOffset = | |
6344 kThisPropertyAssignmentsCountOffset + kIntSize; | |
6345 | 6307 |
6346 static const int kCountersOffset = kOptCountOffset + kIntSize; | 6308 static const int kCountersOffset = kOptCountOffset + kIntSize; |
6347 static const int kStressDeoptCounterOffset = kCountersOffset + kIntSize; | 6309 static const int kStressDeoptCounterOffset = kCountersOffset + kIntSize; |
6348 | 6310 |
6349 // Total size. | 6311 // Total size. |
6350 static const int kSize = kStressDeoptCounterOffset + kIntSize; | 6312 static const int kSize = kStressDeoptCounterOffset + kIntSize; |
6351 | 6313 |
6352 #endif | 6314 #endif |
6353 | 6315 |
6354 // The construction counter for inobject slack tracking is stored in the | 6316 // The construction counter for inobject slack tracking is stored in the |
6355 // most significant byte of compiler_hints which is otherwise unused. | 6317 // most significant byte of compiler_hints which is otherwise unused. |
6356 // Its offset depends on the endian-ness of the architecture. | 6318 // Its offset depends on the endian-ness of the architecture. |
6357 #if __BYTE_ORDER == __LITTLE_ENDIAN | 6319 #if __BYTE_ORDER == __LITTLE_ENDIAN |
6358 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; | 6320 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; |
6359 #elif __BYTE_ORDER == __BIG_ENDIAN | 6321 #elif __BYTE_ORDER == __BIG_ENDIAN |
6360 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; | 6322 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; |
6361 #else | 6323 #else |
6362 #error Unknown byte ordering | 6324 #error Unknown byte ordering |
6363 #endif | 6325 #endif |
6364 | 6326 |
6365 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); | 6327 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); |
6366 | 6328 |
6367 typedef FixedBodyDescriptor<kNameOffset, | 6329 typedef FixedBodyDescriptor<kNameOffset, |
6368 kThisPropertyAssignmentsOffset + kPointerSize, | 6330 kInitialMapOffset + kPointerSize, |
6369 kSize> BodyDescriptor; | 6331 kSize> BodyDescriptor; |
6370 | 6332 |
6371 // Bit positions in start_position_and_type. | 6333 // Bit positions in start_position_and_type. |
6372 // The source code start position is in the 30 most significant bits of | 6334 // The source code start position is in the 30 most significant bits of |
6373 // the start_position_and_type field. | 6335 // the start_position_and_type field. |
6374 static const int kIsExpressionBit = 0; | 6336 static const int kIsExpressionBit = 0; |
6375 static const int kIsTopLevelBit = 1; | 6337 static const int kIsTopLevelBit = 1; |
6376 static const int kStartPositionShift = 2; | 6338 static const int kStartPositionShift = 2; |
6377 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 6339 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
6378 | 6340 |
6379 // Bit positions in compiler_hints. | 6341 // Bit positions in compiler_hints. |
6380 static const int kCodeAgeSize = 3; | 6342 static const int kCodeAgeSize = 3; |
6381 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; | 6343 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; |
6382 | 6344 |
6383 enum CompilerHints { | 6345 enum CompilerHints { |
6384 kHasOnlySimpleThisPropertyAssignments, | |
6385 kAllowLazyCompilation, | 6346 kAllowLazyCompilation, |
6386 kAllowLazyCompilationWithoutContext, | 6347 kAllowLazyCompilationWithoutContext, |
6387 kLiveObjectsMayExist, | 6348 kLiveObjectsMayExist, |
6388 kCodeAgeShift, | 6349 kCodeAgeShift, |
6389 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, | 6350 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, |
6390 kStrictModeFunction, | 6351 kStrictModeFunction, |
6391 kExtendedModeFunction, | 6352 kExtendedModeFunction, |
6392 kUsesArguments, | 6353 kUsesArguments, |
6393 kHasDuplicateParameters, | 6354 kHasDuplicateParameters, |
6394 kNative, | 6355 kNative, |
(...skipping 3245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9640 } else { | 9601 } else { |
9641 value &= ~(1 << bit_position); | 9602 value &= ~(1 << bit_position); |
9642 } | 9603 } |
9643 return value; | 9604 return value; |
9644 } | 9605 } |
9645 }; | 9606 }; |
9646 | 9607 |
9647 } } // namespace v8::internal | 9608 } } // namespace v8::internal |
9648 | 9609 |
9649 #endif // V8_OBJECTS_H_ | 9610 #endif // V8_OBJECTS_H_ |
OLD | NEW |