OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // - Smi (immediate small integer) | 47 // - Smi (immediate small integer) |
48 // - HeapObject (superclass for everything allocated in the heap) | 48 // - HeapObject (superclass for everything allocated in the heap) |
49 // - JSObject | 49 // - JSObject |
50 // - JSArray | 50 // - JSArray |
51 // - JSRegExp | 51 // - JSRegExp |
52 // - JSFunction | 52 // - JSFunction |
53 // - GlobalObject | 53 // - GlobalObject |
54 // - JSGlobalObject | 54 // - JSGlobalObject |
55 // - JSBuiltinsObject | 55 // - JSBuiltinsObject |
56 // - JSGlobalProxy | 56 // - JSGlobalProxy |
57 // - JSValue | 57 // - JSValue |
| 58 // - JSMessageObject |
58 // - ByteArray | 59 // - ByteArray |
59 // - PixelArray | 60 // - PixelArray |
60 // - ExternalArray | 61 // - ExternalArray |
61 // - ExternalByteArray | 62 // - ExternalByteArray |
62 // - ExternalUnsignedByteArray | 63 // - ExternalUnsignedByteArray |
63 // - ExternalShortArray | 64 // - ExternalShortArray |
64 // - ExternalUnsignedShortArray | 65 // - ExternalUnsignedShortArray |
65 // - ExternalIntArray | 66 // - ExternalIntArray |
66 // - ExternalUnsignedIntArray | 67 // - ExternalUnsignedIntArray |
67 // - ExternalFloatArray | 68 // - ExternalFloatArray |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 V(FUNCTION_TEMPLATE_INFO_TYPE) \ | 282 V(FUNCTION_TEMPLATE_INFO_TYPE) \ |
282 V(OBJECT_TEMPLATE_INFO_TYPE) \ | 283 V(OBJECT_TEMPLATE_INFO_TYPE) \ |
283 V(SIGNATURE_INFO_TYPE) \ | 284 V(SIGNATURE_INFO_TYPE) \ |
284 V(TYPE_SWITCH_INFO_TYPE) \ | 285 V(TYPE_SWITCH_INFO_TYPE) \ |
285 V(SCRIPT_TYPE) \ | 286 V(SCRIPT_TYPE) \ |
286 V(CODE_CACHE_TYPE) \ | 287 V(CODE_CACHE_TYPE) \ |
287 \ | 288 \ |
288 V(FIXED_ARRAY_TYPE) \ | 289 V(FIXED_ARRAY_TYPE) \ |
289 V(SHARED_FUNCTION_INFO_TYPE) \ | 290 V(SHARED_FUNCTION_INFO_TYPE) \ |
290 \ | 291 \ |
| 292 V(JS_MESSAGE_OBJECT_TYPE) \ |
| 293 \ |
291 V(JS_VALUE_TYPE) \ | 294 V(JS_VALUE_TYPE) \ |
292 V(JS_OBJECT_TYPE) \ | 295 V(JS_OBJECT_TYPE) \ |
293 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 296 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
294 V(JS_GLOBAL_OBJECT_TYPE) \ | 297 V(JS_GLOBAL_OBJECT_TYPE) \ |
295 V(JS_BUILTINS_OBJECT_TYPE) \ | 298 V(JS_BUILTINS_OBJECT_TYPE) \ |
296 V(JS_GLOBAL_PROXY_TYPE) \ | 299 V(JS_GLOBAL_PROXY_TYPE) \ |
297 V(JS_ARRAY_TYPE) \ | 300 V(JS_ARRAY_TYPE) \ |
298 V(JS_REGEXP_TYPE) \ | 301 V(JS_REGEXP_TYPE) \ |
299 \ | 302 \ |
300 V(JS_FUNCTION_TYPE) \ | 303 V(JS_FUNCTION_TYPE) \ |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT | 514 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT |
512 // is defined. However as include/v8.h contain some of the instance type | 515 // is defined. However as include/v8.h contain some of the instance type |
513 // constants always having them avoids them getting different numbers | 516 // constants always having them avoids them getting different numbers |
514 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. | 517 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. |
515 DEBUG_INFO_TYPE, | 518 DEBUG_INFO_TYPE, |
516 BREAK_POINT_INFO_TYPE, | 519 BREAK_POINT_INFO_TYPE, |
517 | 520 |
518 FIXED_ARRAY_TYPE, | 521 FIXED_ARRAY_TYPE, |
519 SHARED_FUNCTION_INFO_TYPE, | 522 SHARED_FUNCTION_INFO_TYPE, |
520 | 523 |
| 524 JS_MESSAGE_OBJECT_TYPE, |
| 525 |
521 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE | 526 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE |
522 JS_OBJECT_TYPE, | 527 JS_OBJECT_TYPE, |
523 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 528 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
524 JS_GLOBAL_OBJECT_TYPE, | 529 JS_GLOBAL_OBJECT_TYPE, |
525 JS_BUILTINS_OBJECT_TYPE, | 530 JS_BUILTINS_OBJECT_TYPE, |
526 JS_GLOBAL_PROXY_TYPE, | 531 JS_GLOBAL_PROXY_TYPE, |
527 JS_ARRAY_TYPE, | 532 JS_ARRAY_TYPE, |
528 | 533 |
529 JS_REGEXP_TYPE, // LAST_JS_OBJECT_TYPE, FIRST_FUNCTION_CLASS_TYPE | 534 JS_REGEXP_TYPE, // LAST_JS_OBJECT_TYPE, FIRST_FUNCTION_CLASS_TYPE |
530 | 535 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 V(DeoptimizationOutputData) \ | 673 V(DeoptimizationOutputData) \ |
669 V(FixedArray) \ | 674 V(FixedArray) \ |
670 V(Context) \ | 675 V(Context) \ |
671 V(CatchContext) \ | 676 V(CatchContext) \ |
672 V(GlobalContext) \ | 677 V(GlobalContext) \ |
673 V(JSFunction) \ | 678 V(JSFunction) \ |
674 V(Code) \ | 679 V(Code) \ |
675 V(Oddball) \ | 680 V(Oddball) \ |
676 V(SharedFunctionInfo) \ | 681 V(SharedFunctionInfo) \ |
677 V(JSValue) \ | 682 V(JSValue) \ |
| 683 V(JSMessageObject) \ |
678 V(StringWrapper) \ | 684 V(StringWrapper) \ |
679 V(Proxy) \ | 685 V(Proxy) \ |
680 V(Boolean) \ | 686 V(Boolean) \ |
681 V(JSArray) \ | 687 V(JSArray) \ |
682 V(JSRegExp) \ | 688 V(JSRegExp) \ |
683 V(HashTable) \ | 689 V(HashTable) \ |
684 V(Dictionary) \ | 690 V(Dictionary) \ |
685 V(SymbolTable) \ | 691 V(SymbolTable) \ |
686 V(JSFunctionResultCache) \ | 692 V(JSFunctionResultCache) \ |
687 V(NormalizedMapCache) \ | 693 V(NormalizedMapCache) \ |
(...skipping 4001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4689 #endif | 4695 #endif |
4690 | 4696 |
4691 // Layout description. | 4697 // Layout description. |
4692 static const int kValueOffset = JSObject::kHeaderSize; | 4698 static const int kValueOffset = JSObject::kHeaderSize; |
4693 static const int kSize = kValueOffset + kPointerSize; | 4699 static const int kSize = kValueOffset + kPointerSize; |
4694 | 4700 |
4695 private: | 4701 private: |
4696 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); | 4702 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); |
4697 }; | 4703 }; |
4698 | 4704 |
| 4705 |
| 4706 // Representation of message objects used for error reporting through |
| 4707 // the API. The messages are formatted in JavaScript so this object is |
| 4708 // a real JavaScript object. The information used for formatting the |
| 4709 // error messages are not directly accessible from JavaScript to |
| 4710 // prevent leaking information to user code called during error |
| 4711 // formatting. |
| 4712 class JSMessageObject: public JSObject { |
| 4713 public: |
| 4714 // [type]: the type of error message. |
| 4715 DECL_ACCESSORS(type, String) |
| 4716 |
| 4717 // [arguments]: the arguments for formatting the error message. |
| 4718 DECL_ACCESSORS(arguments, JSArray) |
| 4719 |
| 4720 // [script]: the script from which the error message originated. |
| 4721 DECL_ACCESSORS(script, Object) |
| 4722 |
| 4723 // [stack_trace]: the stack trace for this error message. |
| 4724 DECL_ACCESSORS(stack_trace, Object) |
| 4725 |
| 4726 // [stack_frames]: an array of stack frames for this error object. |
| 4727 DECL_ACCESSORS(stack_frames, Object) |
| 4728 |
| 4729 // [start_position]: the start position in the script for the error message. |
| 4730 inline int start_position(); |
| 4731 inline void set_start_position(int value); |
| 4732 |
| 4733 // [end_position]: the end position in the script for the error message. |
| 4734 inline int end_position(); |
| 4735 inline void set_end_position(int value); |
| 4736 |
| 4737 // Casting. |
| 4738 static inline JSMessageObject* cast(Object* obj); |
| 4739 |
| 4740 // Dispatched behavior. |
| 4741 #ifdef OBJECT_PRINT |
| 4742 inline void JSMessageObjectPrint() { |
| 4743 JSMessageObjectPrint(stdout); |
| 4744 } |
| 4745 void JSMessageObjectPrint(FILE* out); |
| 4746 #endif |
| 4747 #ifdef DEBUG |
| 4748 void JSMessageObjectVerify(); |
| 4749 #endif |
| 4750 |
| 4751 // Layout description. |
| 4752 static const int kTypeOffset = JSObject::kHeaderSize; |
| 4753 static const int kArgumentsOffset = kTypeOffset + kPointerSize; |
| 4754 static const int kScriptOffset = kArgumentsOffset + kPointerSize; |
| 4755 static const int kStackTraceOffset = kScriptOffset + kPointerSize; |
| 4756 static const int kStackFramesOffset = kStackTraceOffset + kPointerSize; |
| 4757 static const int kStartPositionOffset = kStackFramesOffset + kPointerSize; |
| 4758 static const int kEndPositionOffset = kStartPositionOffset + kPointerSize; |
| 4759 static const int kSize = kEndPositionOffset + kPointerSize; |
| 4760 |
| 4761 typedef FixedBodyDescriptor<HeapObject::kMapOffset, |
| 4762 kStackFramesOffset + kPointerSize, |
| 4763 kSize> BodyDescriptor; |
| 4764 }; |
| 4765 |
| 4766 |
4699 // Regular expressions | 4767 // Regular expressions |
4700 // The regular expression holds a single reference to a FixedArray in | 4768 // The regular expression holds a single reference to a FixedArray in |
4701 // the kDataOffset field. | 4769 // the kDataOffset field. |
4702 // The FixedArray contains the following data: | 4770 // The FixedArray contains the following data: |
4703 // - tag : type of regexp implementation (not compiled yet, atom or irregexp) | 4771 // - tag : type of regexp implementation (not compiled yet, atom or irregexp) |
4704 // - reference to the original source string | 4772 // - reference to the original source string |
4705 // - reference to the original flag string | 4773 // - reference to the original flag string |
4706 // If it is an atom regexp | 4774 // If it is an atom regexp |
4707 // - a reference to a literal string to search for | 4775 // - a reference to a literal string to search for |
4708 // If it is an irregexp regexp: | 4776 // If it is an irregexp regexp: |
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6424 } else { | 6492 } else { |
6425 value &= ~(1 << bit_position); | 6493 value &= ~(1 << bit_position); |
6426 } | 6494 } |
6427 return value; | 6495 return value; |
6428 } | 6496 } |
6429 }; | 6497 }; |
6430 | 6498 |
6431 } } // namespace v8::internal | 6499 } } // namespace v8::internal |
6432 | 6500 |
6433 #endif // V8_OBJECTS_H_ | 6501 #endif // V8_OBJECTS_H_ |
OLD | NEW |