Chromium Code Reviews| 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 5092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5103 // Is this function a top-level function (scripts, evals). | 5103 // Is this function a top-level function (scripts, evals). |
| 5104 DECL_BOOLEAN_ACCESSORS(is_toplevel) | 5104 DECL_BOOLEAN_ACCESSORS(is_toplevel) |
| 5105 | 5105 |
| 5106 // Bit field containing various information collected by the compiler to | 5106 // Bit field containing various information collected by the compiler to |
| 5107 // drive optimization. | 5107 // drive optimization. |
| 5108 inline int compiler_hints(); | 5108 inline int compiler_hints(); |
| 5109 inline void set_compiler_hints(int value); | 5109 inline void set_compiler_hints(int value); |
| 5110 | 5110 |
| 5111 // A counter used to determine when to stress the deoptimizer with a | 5111 // A counter used to determine when to stress the deoptimizer with a |
| 5112 // deopt. | 5112 // deopt. |
| 5113 inline Smi* deopt_counter(); | 5113 inline Smi* stress_deopt_counter(); |
| 5114 inline void set_deopt_counter(Smi* counter); | 5114 inline void set_stress_deopt_counter(Smi* counter); |
| 5115 | 5115 |
| 5116 // Add information on assignments of the form this.x = ...; | 5116 // Add information on assignments of the form this.x = ...; |
| 5117 void SetThisPropertyAssignmentsInfo( | 5117 void SetThisPropertyAssignmentsInfo( |
| 5118 bool has_only_simple_this_property_assignments, | 5118 bool has_only_simple_this_property_assignments, |
| 5119 FixedArray* this_property_assignments); | 5119 FixedArray* this_property_assignments); |
| 5120 | 5120 |
| 5121 // Clear information on assignments of the form this.x = ...; | 5121 // Clear information on assignments of the form this.x = ...; |
| 5122 void ClearThisPropertyAssignmentsInfo(); | 5122 void ClearThisPropertyAssignmentsInfo(); |
| 5123 | 5123 |
| 5124 // Indicate that this function only consists of assignments of the form | 5124 // Indicate that this function only consists of assignments of the form |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5185 // through the API, which does not change this flag). | 5185 // through the API, which does not change this flag). |
| 5186 DECL_BOOLEAN_ACCESSORS(is_anonymous) | 5186 DECL_BOOLEAN_ACCESSORS(is_anonymous) |
| 5187 | 5187 |
| 5188 // Indicates whether or not the code in the shared function support | 5188 // Indicates whether or not the code in the shared function support |
| 5189 // deoptimization. | 5189 // deoptimization. |
| 5190 inline bool has_deoptimization_support(); | 5190 inline bool has_deoptimization_support(); |
| 5191 | 5191 |
| 5192 // Enable deoptimization support through recompiled code. | 5192 // Enable deoptimization support through recompiled code. |
| 5193 void EnableDeoptimizationSupport(Code* recompiled); | 5193 void EnableDeoptimizationSupport(Code* recompiled); |
| 5194 | 5194 |
| 5195 // Disable (further) attempted optimization of all functions sharing this | 5195 // Disable (further) attempted optimization of all functions sharing this |
|
Jakob Kummerow
2012/01/16 11:41:25
nit: truncated comment (missing "shared function i
fschneider
2012/01/19 10:26:11
Done.
| |
| 5196 // shared function info. The function is the one we actually tried to | 5196 void DisableOptimization(); |
| 5197 // optimize. | 5197 |
| 5198 void DisableOptimization(JSFunction* function); | 5198 void IncrementAndCheckDeoptCount(); |
| 5199 | 5199 |
| 5200 // Lookup the bailout ID and ASSERT that it exists in the non-optimized | 5200 // Lookup the bailout ID and ASSERT that it exists in the non-optimized |
| 5201 // code, returns whether it asserted (i.e., always true if assertions are | 5201 // code, returns whether it asserted (i.e., always true if assertions are |
| 5202 // disabled). | 5202 // disabled). |
| 5203 bool VerifyBailoutId(int id); | 5203 bool VerifyBailoutId(int id); |
| 5204 | 5204 |
| 5205 // Check whether a inlined constructor can be generated with the given | 5205 // Check whether a inlined constructor can be generated with the given |
| 5206 // prototype. | 5206 // prototype. |
| 5207 bool CanGenerateInlineConstructor(Object* prototype); | 5207 bool CanGenerateInlineConstructor(Object* prototype); |
| 5208 | 5208 |
| 5209 // Prevents further attempts to generate inline constructors. | 5209 // Prevents further attempts to generate inline constructors. |
| 5210 // To be called if generation failed for any reason. | 5210 // To be called if generation failed for any reason. |
| 5211 void ForbidInlineConstructor(); | 5211 void ForbidInlineConstructor(); |
| 5212 | 5212 |
| 5213 // For functions which only contains this property assignments this provides | 5213 // For functions which only contains this property assignments this provides |
| 5214 // access to the names for the properties assigned. | 5214 // access to the names for the properties assigned. |
| 5215 DECL_ACCESSORS(this_property_assignments, Object) | 5215 DECL_ACCESSORS(this_property_assignments, Object) |
| 5216 inline int this_property_assignments_count(); | 5216 inline int this_property_assignments_count(); |
| 5217 inline void set_this_property_assignments_count(int value); | 5217 inline void set_this_property_assignments_count(int value); |
| 5218 String* GetThisPropertyAssignmentName(int index); | 5218 String* GetThisPropertyAssignmentName(int index); |
| 5219 bool IsThisPropertyAssignmentArgument(int index); | 5219 bool IsThisPropertyAssignmentArgument(int index); |
| 5220 int GetThisPropertyAssignmentArgument(int index); | 5220 int GetThisPropertyAssignmentArgument(int index); |
| 5221 Object* GetThisPropertyAssignmentConstant(int index); | 5221 Object* GetThisPropertyAssignmentConstant(int index); |
| 5222 | 5222 |
| 5223 // [source code]: Source code for the function. | 5223 // [source code]: Source code for the function. |
| 5224 bool HasSourceCode(); | 5224 bool HasSourceCode(); |
| 5225 Object* GetSourceCode(); | 5225 Object* GetSourceCode(); |
| 5226 | 5226 |
| 5227 inline int opt_count(); | 5227 inline int deopt_count(); |
| 5228 inline void set_opt_count(int opt_count); | 5228 inline void set_deopt_count(int deopt_count); |
| 5229 | 5229 |
| 5230 // Source size of this function. | 5230 // Source size of this function. |
| 5231 int SourceSize(); | 5231 int SourceSize(); |
| 5232 | 5232 |
| 5233 // Calculate the instance size. | 5233 // Calculate the instance size. |
| 5234 int CalculateInstanceSize(); | 5234 int CalculateInstanceSize(); |
| 5235 | 5235 |
| 5236 // Calculate the number of in-object properties. | 5236 // Calculate the number of in-object properties. |
| 5237 int CalculateInObjectProperties(); | 5237 int CalculateInObjectProperties(); |
| 5238 | 5238 |
| 5239 // Dispatched behavior. | 5239 // Dispatched behavior. |
| 5240 // Set max_length to -1 for unlimited length. | 5240 // Set max_length to -1 for unlimited length. |
| 5241 void SourceCodePrint(StringStream* accumulator, int max_length); | 5241 void SourceCodePrint(StringStream* accumulator, int max_length); |
| 5242 #ifdef OBJECT_PRINT | 5242 #ifdef OBJECT_PRINT |
| 5243 inline void SharedFunctionInfoPrint() { | 5243 inline void SharedFunctionInfoPrint() { |
| 5244 SharedFunctionInfoPrint(stdout); | 5244 SharedFunctionInfoPrint(stdout); |
| 5245 } | 5245 } |
| 5246 void SharedFunctionInfoPrint(FILE* out); | 5246 void SharedFunctionInfoPrint(FILE* out); |
| 5247 #endif | 5247 #endif |
| 5248 #ifdef DEBUG | 5248 #ifdef DEBUG |
| 5249 void SharedFunctionInfoVerify(); | 5249 void SharedFunctionInfoVerify(); |
| 5250 #endif | 5250 #endif |
| 5251 | 5251 |
| 5252 // Prints the name of the function using PrintF. | |
| 5253 void PrintName() { PrintName(stdout); } | |
| 5254 void PrintName(FILE* out); | |
| 5255 | |
| 5252 // Helpers to compile the shared code. Returns true on success, false on | 5256 // Helpers to compile the shared code. Returns true on success, false on |
| 5253 // failure (e.g., stack overflow during compilation). | 5257 // failure (e.g., stack overflow during compilation). |
| 5254 static bool EnsureCompiled(Handle<SharedFunctionInfo> shared, | 5258 static bool EnsureCompiled(Handle<SharedFunctionInfo> shared, |
| 5255 ClearExceptionFlag flag); | 5259 ClearExceptionFlag flag); |
| 5256 static bool CompileLazy(Handle<SharedFunctionInfo> shared, | 5260 static bool CompileLazy(Handle<SharedFunctionInfo> shared, |
| 5257 ClearExceptionFlag flag); | 5261 ClearExceptionFlag flag); |
| 5258 | 5262 |
| 5259 // Casting. | 5263 // Casting. |
| 5260 static inline SharedFunctionInfo* cast(Object* obj); | 5264 static inline SharedFunctionInfo* cast(Object* obj); |
| 5261 | 5265 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 5272 kConstructStubOffset + kPointerSize; | 5276 kConstructStubOffset + kPointerSize; |
| 5273 static const int kFunctionDataOffset = | 5277 static const int kFunctionDataOffset = |
| 5274 kInstanceClassNameOffset + kPointerSize; | 5278 kInstanceClassNameOffset + kPointerSize; |
| 5275 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 5279 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
| 5276 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 5280 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
| 5277 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 5281 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
| 5278 static const int kInitialMapOffset = | 5282 static const int kInitialMapOffset = |
| 5279 kInferredNameOffset + kPointerSize; | 5283 kInferredNameOffset + kPointerSize; |
| 5280 static const int kThisPropertyAssignmentsOffset = | 5284 static const int kThisPropertyAssignmentsOffset = |
| 5281 kInitialMapOffset + kPointerSize; | 5285 kInitialMapOffset + kPointerSize; |
| 5282 static const int kDeoptCounterOffset = | 5286 static const int kDeoptCounterOffset = |
|
Jakob Kummerow
2012/01/16 11:41:25
Rename this to kStressDeoptCounterOffset?
fschneider
2012/01/19 10:26:11
Done.
| |
| 5283 kThisPropertyAssignmentsOffset + kPointerSize; | 5287 kThisPropertyAssignmentsOffset + kPointerSize; |
| 5284 #if V8_HOST_ARCH_32_BIT | 5288 #if V8_HOST_ARCH_32_BIT |
| 5285 // Smi fields. | 5289 // Smi fields. |
| 5286 static const int kLengthOffset = | 5290 static const int kLengthOffset = |
| 5287 kDeoptCounterOffset + kPointerSize; | 5291 kDeoptCounterOffset + kPointerSize; |
| 5288 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 5292 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
| 5289 static const int kExpectedNofPropertiesOffset = | 5293 static const int kExpectedNofPropertiesOffset = |
| 5290 kFormalParameterCountOffset + kPointerSize; | 5294 kFormalParameterCountOffset + kPointerSize; |
| 5291 static const int kNumLiteralsOffset = | 5295 static const int kNumLiteralsOffset = |
| 5292 kExpectedNofPropertiesOffset + kPointerSize; | 5296 kExpectedNofPropertiesOffset + kPointerSize; |
| 5293 static const int kStartPositionAndTypeOffset = | 5297 static const int kStartPositionAndTypeOffset = |
| 5294 kNumLiteralsOffset + kPointerSize; | 5298 kNumLiteralsOffset + kPointerSize; |
| 5295 static const int kEndPositionOffset = | 5299 static const int kEndPositionOffset = |
| 5296 kStartPositionAndTypeOffset + kPointerSize; | 5300 kStartPositionAndTypeOffset + kPointerSize; |
| 5297 static const int kFunctionTokenPositionOffset = | 5301 static const int kFunctionTokenPositionOffset = |
| 5298 kEndPositionOffset + kPointerSize; | 5302 kEndPositionOffset + kPointerSize; |
| 5299 static const int kCompilerHintsOffset = | 5303 static const int kCompilerHintsOffset = |
| 5300 kFunctionTokenPositionOffset + kPointerSize; | 5304 kFunctionTokenPositionOffset + kPointerSize; |
| 5301 static const int kThisPropertyAssignmentsCountOffset = | 5305 static const int kThisPropertyAssignmentsCountOffset = |
| 5302 kCompilerHintsOffset + kPointerSize; | 5306 kCompilerHintsOffset + kPointerSize; |
| 5303 static const int kOptCountOffset = | 5307 static const int kDeoptCountOffset = |
| 5304 kThisPropertyAssignmentsCountOffset + kPointerSize; | 5308 kThisPropertyAssignmentsCountOffset + kPointerSize; |
| 5305 // Total size. | 5309 // Total size. |
| 5306 static const int kSize = kOptCountOffset + kPointerSize; | 5310 static const int kSize = kDeoptCountOffset + kPointerSize; |
| 5307 #else | 5311 #else |
| 5308 // The only reason to use smi fields instead of int fields | 5312 // The only reason to use smi fields instead of int fields |
| 5309 // is to allow iteration without maps decoding during | 5313 // is to allow iteration without maps decoding during |
| 5310 // garbage collections. | 5314 // garbage collections. |
| 5311 // To avoid wasting space on 64-bit architectures we use | 5315 // To avoid wasting space on 64-bit architectures we use |
| 5312 // the following trick: we group integer fields into pairs | 5316 // the following trick: we group integer fields into pairs |
| 5313 // First integer in each pair is shifted left by 1. | 5317 // First integer in each pair is shifted left by 1. |
| 5314 // By doing this we guarantee that LSB of each kPointerSize aligned | 5318 // By doing this we guarantee that LSB of each kPointerSize aligned |
| 5315 // word is not set and thus this word cannot be treated as pointer | 5319 // word is not set and thus this word cannot be treated as pointer |
| 5316 // to HeapObject during old space traversal. | 5320 // to HeapObject during old space traversal. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 5329 static const int kStartPositionAndTypeOffset = | 5333 static const int kStartPositionAndTypeOffset = |
| 5330 kEndPositionOffset + kIntSize; | 5334 kEndPositionOffset + kIntSize; |
| 5331 | 5335 |
| 5332 static const int kFunctionTokenPositionOffset = | 5336 static const int kFunctionTokenPositionOffset = |
| 5333 kStartPositionAndTypeOffset + kIntSize; | 5337 kStartPositionAndTypeOffset + kIntSize; |
| 5334 static const int kCompilerHintsOffset = | 5338 static const int kCompilerHintsOffset = |
| 5335 kFunctionTokenPositionOffset + kIntSize; | 5339 kFunctionTokenPositionOffset + kIntSize; |
| 5336 | 5340 |
| 5337 static const int kThisPropertyAssignmentsCountOffset = | 5341 static const int kThisPropertyAssignmentsCountOffset = |
| 5338 kCompilerHintsOffset + kIntSize; | 5342 kCompilerHintsOffset + kIntSize; |
| 5339 static const int kOptCountOffset = | 5343 static const int kDeoptCountOffset = |
| 5340 kThisPropertyAssignmentsCountOffset + kIntSize; | 5344 kThisPropertyAssignmentsCountOffset + kIntSize; |
| 5341 | 5345 |
| 5342 // Total size. | 5346 // Total size. |
| 5343 static const int kSize = kOptCountOffset + kIntSize; | 5347 static const int kSize = kDeoptCountOffset + kIntSize; |
| 5344 | 5348 |
| 5345 #endif | 5349 #endif |
| 5346 | 5350 |
| 5347 // The construction counter for inobject slack tracking is stored in the | 5351 // The construction counter for inobject slack tracking is stored in the |
| 5348 // most significant byte of compiler_hints which is otherwise unused. | 5352 // most significant byte of compiler_hints which is otherwise unused. |
| 5349 // Its offset depends on the endian-ness of the architecture. | 5353 // Its offset depends on the endian-ness of the architecture. |
| 5350 #if __BYTE_ORDER == __LITTLE_ENDIAN | 5354 #if __BYTE_ORDER == __LITTLE_ENDIAN |
| 5351 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; | 5355 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; |
| 5352 #elif __BYTE_ORDER == __BIG_ENDIAN | 5356 #elif __BYTE_ORDER == __BIG_ENDIAN |
| 5353 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; | 5357 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5556 Object* SetInstanceClassName(String* name); | 5560 Object* SetInstanceClassName(String* name); |
| 5557 | 5561 |
| 5558 // Returns if this function has been compiled to native code yet. | 5562 // Returns if this function has been compiled to native code yet. |
| 5559 inline bool is_compiled(); | 5563 inline bool is_compiled(); |
| 5560 | 5564 |
| 5561 // [next_function_link]: Field for linking functions. This list is treated as | 5565 // [next_function_link]: Field for linking functions. This list is treated as |
| 5562 // a weak list by the GC. | 5566 // a weak list by the GC. |
| 5563 DECL_ACCESSORS(next_function_link, Object) | 5567 DECL_ACCESSORS(next_function_link, Object) |
| 5564 | 5568 |
| 5565 // Prints the name of the function using PrintF. | 5569 // Prints the name of the function using PrintF. |
| 5566 inline void PrintName() { | 5570 void PrintName() { PrintName(stdout); } |
| 5567 PrintName(stdout); | 5571 void PrintName(FILE* out) { shared()->PrintName(out); } |
| 5568 } | |
| 5569 void PrintName(FILE* out); | |
| 5570 | 5572 |
| 5571 // Casting. | 5573 // Casting. |
| 5572 static inline JSFunction* cast(Object* obj); | 5574 static inline JSFunction* cast(Object* obj); |
| 5573 | 5575 |
| 5574 // Iterates the objects, including code objects indirectly referenced | 5576 // Iterates the objects, including code objects indirectly referenced |
| 5575 // through pointers to the first instruction in the code object. | 5577 // through pointers to the first instruction in the code object. |
| 5576 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); | 5578 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); |
| 5577 | 5579 |
| 5578 // Dispatched behavior. | 5580 // Dispatched behavior. |
| 5579 #ifdef OBJECT_PRINT | 5581 #ifdef OBJECT_PRINT |
| (...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8154 } else { | 8156 } else { |
| 8155 value &= ~(1 << bit_position); | 8157 value &= ~(1 << bit_position); |
| 8156 } | 8158 } |
| 8157 return value; | 8159 return value; |
| 8158 } | 8160 } |
| 8159 }; | 8161 }; |
| 8160 | 8162 |
| 8161 } } // namespace v8::internal | 8163 } } // namespace v8::internal |
| 8162 | 8164 |
| 8163 #endif // V8_OBJECTS_H_ | 8165 #endif // V8_OBJECTS_H_ |
| OLD | NEW |