| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 382 |
| 383 // A struct is a simple object a set of object-valued fields. Including an | 383 // A struct is a simple object a set of object-valued fields. Including an |
| 384 // object type in this causes the compiler to generate most of the boilerplate | 384 // object type in this causes the compiler to generate most of the boilerplate |
| 385 // code for the class including allocation and garbage collection routines, | 385 // code for the class including allocation and garbage collection routines, |
| 386 // casts and predicates. All you need to define is the class, methods and | 386 // casts and predicates. All you need to define is the class, methods and |
| 387 // object verification routines. Easy, no? | 387 // object verification routines. Easy, no? |
| 388 // | 388 // |
| 389 // Note that for subtle reasons related to the ordering or numerical values of | 389 // Note that for subtle reasons related to the ordering or numerical values of |
| 390 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST | 390 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST |
| 391 // manually. | 391 // manually. |
| 392 #define STRUCT_LIST(V) \ | 392 #define STRUCT_LIST_ALL(V) \ |
| 393 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ | 393 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ |
| 394 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 394 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
| 395 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 395 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
| 396 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 396 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
| 397 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 397 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
| 398 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 398 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
| 399 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ | 399 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ |
| 400 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ | 400 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ |
| 401 V(DEBUG_INFO, DebugInfo, debug_info) \ | |
| 402 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \ | |
| 403 V(SCRIPT, Script, script) | 401 V(SCRIPT, Script, script) |
| 404 | 402 |
| 403 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 404 #define STRUCT_LIST_DEBUGGER(V) \ |
| 405 V(DEBUG_INFO, DebugInfo, debug_info) \ |
| 406 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) |
| 407 #else |
| 408 #define STRUCT_LIST_DEBUGGER(V) |
| 409 #endif |
| 410 |
| 411 #define STRUCT_LIST(V) \ |
| 412 STRUCT_LIST_ALL(V) \ |
| 413 STRUCT_LIST_DEBUGGER(V) |
| 405 | 414 |
| 406 // We use the full 8 bits of the instance_type field to encode heap object | 415 // We use the full 8 bits of the instance_type field to encode heap object |
| 407 // instance types. The high-order bit (bit 7) is set if the object is not a | 416 // instance types. The high-order bit (bit 7) is set if the object is not a |
| 408 // string, and cleared if it is a string. | 417 // string, and cleared if it is a string. |
| 409 const uint32_t kIsNotStringMask = 0x80; | 418 const uint32_t kIsNotStringMask = 0x80; |
| 410 const uint32_t kStringTag = 0x0; | 419 const uint32_t kStringTag = 0x0; |
| 411 const uint32_t kNotStringTag = 0x80; | 420 const uint32_t kNotStringTag = 0x80; |
| 412 | 421 |
| 413 // If bit 7 is clear, bit 5 indicates that the string is a symbol (if set) or | 422 // If bit 7 is clear, bit 5 indicates that the string is a symbol (if set) or |
| 414 // not (if cleared). | 423 // not (if cleared). |
| (...skipping 3729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4144 #ifdef DEBUG | 4153 #ifdef DEBUG |
| 4145 void TypeSwitchInfoPrint(); | 4154 void TypeSwitchInfoPrint(); |
| 4146 void TypeSwitchInfoVerify(); | 4155 void TypeSwitchInfoVerify(); |
| 4147 #endif | 4156 #endif |
| 4148 | 4157 |
| 4149 static const int kTypesOffset = Struct::kHeaderSize; | 4158 static const int kTypesOffset = Struct::kHeaderSize; |
| 4150 static const int kSize = kTypesOffset + kPointerSize; | 4159 static const int kSize = kTypesOffset + kPointerSize; |
| 4151 }; | 4160 }; |
| 4152 | 4161 |
| 4153 | 4162 |
| 4163 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 4154 // The DebugInfo class holds additional information for a function being | 4164 // The DebugInfo class holds additional information for a function being |
| 4155 // debugged. | 4165 // debugged. |
| 4156 class DebugInfo: public Struct { | 4166 class DebugInfo: public Struct { |
| 4157 public: | 4167 public: |
| 4158 // The shared function info for the source being debugged. | 4168 // The shared function info for the source being debugged. |
| 4159 DECL_ACCESSORS(shared, SharedFunctionInfo) | 4169 DECL_ACCESSORS(shared, SharedFunctionInfo) |
| 4160 // Code object for the original code. | 4170 // Code object for the original code. |
| 4161 DECL_ACCESSORS(original_code, Code) | 4171 DECL_ACCESSORS(original_code, Code) |
| 4162 // Code object for the patched code. This code object is the code object | 4172 // Code object for the patched code. This code object is the code object |
| 4163 // currently active for the function. | 4173 // currently active for the function. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4249 static const int kSourcePositionIndex = kCodePositionIndex + kPointerSize; | 4259 static const int kSourcePositionIndex = kCodePositionIndex + kPointerSize; |
| 4250 static const int kStatementPositionIndex = | 4260 static const int kStatementPositionIndex = |
| 4251 kSourcePositionIndex + kPointerSize; | 4261 kSourcePositionIndex + kPointerSize; |
| 4252 static const int kBreakPointObjectsIndex = | 4262 static const int kBreakPointObjectsIndex = |
| 4253 kStatementPositionIndex + kPointerSize; | 4263 kStatementPositionIndex + kPointerSize; |
| 4254 static const int kSize = kBreakPointObjectsIndex + kPointerSize; | 4264 static const int kSize = kBreakPointObjectsIndex + kPointerSize; |
| 4255 | 4265 |
| 4256 private: | 4266 private: |
| 4257 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo); | 4267 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo); |
| 4258 }; | 4268 }; |
| 4269 #endif // ENABLE_DEBUGGER_SUPPORT |
| 4259 | 4270 |
| 4260 | 4271 |
| 4261 #undef DECL_BOOLEAN_ACCESSORS | 4272 #undef DECL_BOOLEAN_ACCESSORS |
| 4262 #undef DECL_ACCESSORS | 4273 #undef DECL_ACCESSORS |
| 4263 | 4274 |
| 4264 | 4275 |
| 4265 // Abstract base class for visiting, and optionally modifying, the | 4276 // Abstract base class for visiting, and optionally modifying, the |
| 4266 // pointers contained in Objects. Used in GC and serialization/deserialization. | 4277 // pointers contained in Objects. Used in GC and serialization/deserialization. |
| 4267 class ObjectVisitor BASE_EMBEDDED { | 4278 class ObjectVisitor BASE_EMBEDDED { |
| 4268 public: | 4279 public: |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4332 } else { | 4343 } else { |
| 4333 value &= ~(1 << bit_position); | 4344 value &= ~(1 << bit_position); |
| 4334 } | 4345 } |
| 4335 return value; | 4346 return value; |
| 4336 } | 4347 } |
| 4337 }; | 4348 }; |
| 4338 | 4349 |
| 4339 } } // namespace v8::internal | 4350 } } // namespace v8::internal |
| 4340 | 4351 |
| 4341 #endif // V8_OBJECTS_H_ | 4352 #endif // V8_OBJECTS_H_ |
| OLD | NEW |