| 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 4976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4987 // Bit field containing various information collected by the compiler to | 4987 // Bit field containing various information collected by the compiler to |
| 4988 // drive optimization. | 4988 // drive optimization. |
| 4989 inline int compiler_hints(); | 4989 inline int compiler_hints(); |
| 4990 inline void set_compiler_hints(int value); | 4990 inline void set_compiler_hints(int value); |
| 4991 | 4991 |
| 4992 // A counter used to determine when to stress the deoptimizer with a | 4992 // A counter used to determine when to stress the deoptimizer with a |
| 4993 // deopt. | 4993 // deopt. |
| 4994 inline Smi* deopt_counter(); | 4994 inline Smi* deopt_counter(); |
| 4995 inline void set_deopt_counter(Smi* counter); | 4995 inline void set_deopt_counter(Smi* counter); |
| 4996 | 4996 |
| 4997 inline int call_counter(); |
| 4998 inline void set_call_counter(int count); |
| 4999 |
| 4997 // Add information on assignments of the form this.x = ...; | 5000 // Add information on assignments of the form this.x = ...; |
| 4998 void SetThisPropertyAssignmentsInfo( | 5001 void SetThisPropertyAssignmentsInfo( |
| 4999 bool has_only_simple_this_property_assignments, | 5002 bool has_only_simple_this_property_assignments, |
| 5000 FixedArray* this_property_assignments); | 5003 FixedArray* this_property_assignments); |
| 5001 | 5004 |
| 5002 // Clear information on assignments of the form this.x = ...; | 5005 // Clear information on assignments of the form this.x = ...; |
| 5003 void ClearThisPropertyAssignmentsInfo(); | 5006 void ClearThisPropertyAssignmentsInfo(); |
| 5004 | 5007 |
| 5005 // Indicate that this function only consists of assignments of the form | 5008 // Indicate that this function only consists of assignments of the form |
| 5006 // this.x = y; where y is either a constant or refers to an argument. | 5009 // this.x = y; where y is either a constant or refers to an argument. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5147 ClearExceptionFlag flag); | 5150 ClearExceptionFlag flag); |
| 5148 static bool CompileLazy(Handle<SharedFunctionInfo> shared, | 5151 static bool CompileLazy(Handle<SharedFunctionInfo> shared, |
| 5149 ClearExceptionFlag flag); | 5152 ClearExceptionFlag flag); |
| 5150 | 5153 |
| 5151 // Casting. | 5154 // Casting. |
| 5152 static inline SharedFunctionInfo* cast(Object* obj); | 5155 static inline SharedFunctionInfo* cast(Object* obj); |
| 5153 | 5156 |
| 5154 // Constants. | 5157 // Constants. |
| 5155 static const int kDontAdaptArgumentsSentinel = -1; | 5158 static const int kDontAdaptArgumentsSentinel = -1; |
| 5156 | 5159 |
| 5160 // Number of calls until a "primitive" function triggers its own optimization. |
| 5161 #if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_X64) |
| 5162 static const int kCallsUntilPrimitiveOptimization = 20000; |
| 5163 #elif defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS) |
| 5164 static const int kCallsUntilPrimitiveOptimization = 1000; |
| 5165 #endif |
| 5166 |
| 5157 // Layout description. | 5167 // Layout description. |
| 5158 // Pointer fields. | 5168 // Pointer fields. |
| 5159 static const int kNameOffset = HeapObject::kHeaderSize; | 5169 static const int kNameOffset = HeapObject::kHeaderSize; |
| 5160 static const int kCodeOffset = kNameOffset + kPointerSize; | 5170 static const int kCodeOffset = kNameOffset + kPointerSize; |
| 5161 static const int kScopeInfoOffset = kCodeOffset + kPointerSize; | 5171 static const int kScopeInfoOffset = kCodeOffset + kPointerSize; |
| 5162 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; | 5172 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
| 5163 static const int kInstanceClassNameOffset = | 5173 static const int kInstanceClassNameOffset = |
| 5164 kConstructStubOffset + kPointerSize; | 5174 kConstructStubOffset + kPointerSize; |
| 5165 static const int kFunctionDataOffset = | 5175 static const int kFunctionDataOffset = |
| 5166 kInstanceClassNameOffset + kPointerSize; | 5176 kInstanceClassNameOffset + kPointerSize; |
| 5167 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 5177 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
| 5168 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 5178 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
| 5169 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 5179 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
| 5170 static const int kInitialMapOffset = | 5180 static const int kInitialMapOffset = |
| 5171 kInferredNameOffset + kPointerSize; | 5181 kInferredNameOffset + kPointerSize; |
| 5172 static const int kThisPropertyAssignmentsOffset = | 5182 static const int kThisPropertyAssignmentsOffset = |
| 5173 kInitialMapOffset + kPointerSize; | 5183 kInitialMapOffset + kPointerSize; |
| 5184 static const int kCallCounterOffset = |
| 5185 kThisPropertyAssignmentsOffset + kPointerSize; |
| 5174 static const int kDeoptCounterOffset = | 5186 static const int kDeoptCounterOffset = |
| 5175 kThisPropertyAssignmentsOffset + kPointerSize; | 5187 kCallCounterOffset + kPointerSize; |
| 5176 #if V8_HOST_ARCH_32_BIT | 5188 #if V8_HOST_ARCH_32_BIT |
| 5177 // Smi fields. | 5189 // Smi fields. |
| 5178 static const int kLengthOffset = | 5190 static const int kLengthOffset = |
| 5179 kDeoptCounterOffset + kPointerSize; | 5191 kDeoptCounterOffset + kPointerSize; |
| 5180 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 5192 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
| 5181 static const int kExpectedNofPropertiesOffset = | 5193 static const int kExpectedNofPropertiesOffset = |
| 5182 kFormalParameterCountOffset + kPointerSize; | 5194 kFormalParameterCountOffset + kPointerSize; |
| 5183 static const int kNumLiteralsOffset = | 5195 static const int kNumLiteralsOffset = |
| 5184 kExpectedNofPropertiesOffset + kPointerSize; | 5196 kExpectedNofPropertiesOffset + kPointerSize; |
| 5185 static const int kStartPositionAndTypeOffset = | 5197 static const int kStartPositionAndTypeOffset = |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5454 // before. | 5466 // before. |
| 5455 Object* SetInstanceClassName(String* name); | 5467 Object* SetInstanceClassName(String* name); |
| 5456 | 5468 |
| 5457 // Returns if this function has been compiled to native code yet. | 5469 // Returns if this function has been compiled to native code yet. |
| 5458 inline bool is_compiled(); | 5470 inline bool is_compiled(); |
| 5459 | 5471 |
| 5460 // [next_function_link]: Field for linking functions. This list is treated as | 5472 // [next_function_link]: Field for linking functions. This list is treated as |
| 5461 // a weak list by the GC. | 5473 // a weak list by the GC. |
| 5462 DECL_ACCESSORS(next_function_link, Object) | 5474 DECL_ACCESSORS(next_function_link, Object) |
| 5463 | 5475 |
| 5476 inline int profiler_ticks(); |
| 5477 inline void set_profiler_ticks(int ticks); |
| 5478 |
| 5464 // Prints the name of the function using PrintF. | 5479 // Prints the name of the function using PrintF. |
| 5465 inline void PrintName() { | 5480 inline void PrintName() { |
| 5466 PrintName(stdout); | 5481 PrintName(stdout); |
| 5467 } | 5482 } |
| 5468 void PrintName(FILE* out); | 5483 void PrintName(FILE* out); |
| 5469 | 5484 |
| 5470 // Casting. | 5485 // Casting. |
| 5471 static inline JSFunction* cast(Object* obj); | 5486 static inline JSFunction* cast(Object* obj); |
| 5472 | 5487 |
| 5473 // Iterates the objects, including code objects indirectly referenced | 5488 // Iterates the objects, including code objects indirectly referenced |
| (...skipping 19 matching lines...) Expand all Loading... |
| 5493 | 5508 |
| 5494 // Layout descriptors. The last property (from kNonWeakFieldsEndOffset to | 5509 // Layout descriptors. The last property (from kNonWeakFieldsEndOffset to |
| 5495 // kSize) is weak and has special handling during garbage collection. | 5510 // kSize) is weak and has special handling during garbage collection. |
| 5496 static const int kCodeEntryOffset = JSObject::kHeaderSize; | 5511 static const int kCodeEntryOffset = JSObject::kHeaderSize; |
| 5497 static const int kPrototypeOrInitialMapOffset = | 5512 static const int kPrototypeOrInitialMapOffset = |
| 5498 kCodeEntryOffset + kPointerSize; | 5513 kCodeEntryOffset + kPointerSize; |
| 5499 static const int kSharedFunctionInfoOffset = | 5514 static const int kSharedFunctionInfoOffset = |
| 5500 kPrototypeOrInitialMapOffset + kPointerSize; | 5515 kPrototypeOrInitialMapOffset + kPointerSize; |
| 5501 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; | 5516 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; |
| 5502 static const int kLiteralsOffset = kContextOffset + kPointerSize; | 5517 static const int kLiteralsOffset = kContextOffset + kPointerSize; |
| 5503 static const int kNonWeakFieldsEndOffset = kLiteralsOffset + kPointerSize; | 5518 static const int kProfilerTicksOffset = kLiteralsOffset + kPointerSize; |
| 5519 static const int kNonWeakFieldsEndOffset = |
| 5520 kProfilerTicksOffset + kPointerSize; |
| 5504 static const int kNextFunctionLinkOffset = kNonWeakFieldsEndOffset; | 5521 static const int kNextFunctionLinkOffset = kNonWeakFieldsEndOffset; |
| 5505 static const int kSize = kNextFunctionLinkOffset + kPointerSize; | 5522 static const int kSize = kNextFunctionLinkOffset + kPointerSize; |
| 5506 | 5523 |
| 5507 // Layout of the literals array. | 5524 // Layout of the literals array. |
| 5508 static const int kLiteralsPrefixSize = 1; | 5525 static const int kLiteralsPrefixSize = 1; |
| 5509 static const int kLiteralGlobalContextIndex = 0; | 5526 static const int kLiteralGlobalContextIndex = 0; |
| 5510 | 5527 |
| 5511 // Layout of the bound-function binding array. | 5528 // Layout of the bound-function binding array. |
| 5512 static const int kBoundFunctionIndex = 0; | 5529 static const int kBoundFunctionIndex = 0; |
| 5513 static const int kBoundThisIndex = 1; | 5530 static const int kBoundThisIndex = 1; |
| (...skipping 2469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7983 } else { | 8000 } else { |
| 7984 value &= ~(1 << bit_position); | 8001 value &= ~(1 << bit_position); |
| 7985 } | 8002 } |
| 7986 return value; | 8003 return value; |
| 7987 } | 8004 } |
| 7988 }; | 8005 }; |
| 7989 | 8006 |
| 7990 } } // namespace v8::internal | 8007 } } // namespace v8::internal |
| 7991 | 8008 |
| 7992 #endif // V8_OBJECTS_H_ | 8009 #endif // V8_OBJECTS_H_ |
| OLD | NEW |