OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2623 // An abstract superclass, a marker class really, for simple structure classes. | 2623 // An abstract superclass, a marker class really, for simple structure classes. |
2624 // It doesn't carry much functionality but allows struct classes to me | 2624 // It doesn't carry much functionality but allows struct classes to me |
2625 // identified in the type system. | 2625 // identified in the type system. |
2626 class Struct: public HeapObject { | 2626 class Struct: public HeapObject { |
2627 public: | 2627 public: |
2628 inline void InitializeBody(int object_size); | 2628 inline void InitializeBody(int object_size); |
2629 static inline Struct* cast(Object* that); | 2629 static inline Struct* cast(Object* that); |
2630 }; | 2630 }; |
2631 | 2631 |
2632 | 2632 |
2633 // Script types. | |
2634 enum ScriptType { | |
2635 SCRIPT_TYPE_NATIVE, | |
2636 SCRIPT_TYPE_EXTENSION, | |
2637 SCRIPT_TYPE_NORMAL | |
2638 }; | |
2639 | |
2640 | |
2641 // Script describes a script which has been added to the VM. | 2633 // Script describes a script which has been added to the VM. |
2642 class Script: public Struct { | 2634 class Script: public Struct { |
2643 public: | 2635 public: |
| 2636 // Script types. |
| 2637 enum Type { |
| 2638 TYPE_NATIVE, |
| 2639 TYPE_EXTENSION, |
| 2640 TYPE_NORMAL |
| 2641 }; |
| 2642 |
| 2643 // Script compilation types. |
| 2644 enum CompilationType { |
| 2645 COMPILATION_TYPE_HOST, |
| 2646 COMPILATION_TYPE_EVAL, |
| 2647 COMPILATION_TYPE_JSON |
| 2648 }; |
| 2649 |
2644 // [source]: the script source. | 2650 // [source]: the script source. |
2645 DECL_ACCESSORS(source, Object) | 2651 DECL_ACCESSORS(source, Object) |
2646 | 2652 |
2647 // [name]: the script name. | 2653 // [name]: the script name. |
2648 DECL_ACCESSORS(name, Object) | 2654 DECL_ACCESSORS(name, Object) |
2649 | 2655 |
2650 // [id]: the script id. | 2656 // [id]: the script id. |
2651 DECL_ACCESSORS(id, Object) | 2657 DECL_ACCESSORS(id, Object) |
2652 | 2658 |
2653 // [line_offset]: script line offset in resource from where it was extracted. | 2659 // [line_offset]: script line offset in resource from where it was extracted. |
2654 DECL_ACCESSORS(line_offset, Smi) | 2660 DECL_ACCESSORS(line_offset, Smi) |
2655 | 2661 |
2656 // [column_offset]: script column offset in resource from where it was | 2662 // [column_offset]: script column offset in resource from where it was |
2657 // extracted. | 2663 // extracted. |
2658 DECL_ACCESSORS(column_offset, Smi) | 2664 DECL_ACCESSORS(column_offset, Smi) |
2659 | 2665 |
2660 // [data]: additional data associated with this script. | 2666 // [data]: additional data associated with this script. |
2661 DECL_ACCESSORS(data, Object) | 2667 DECL_ACCESSORS(data, Object) |
2662 | 2668 |
2663 // [context_data]: context data for the context this script was compiled in. | 2669 // [context_data]: context data for the context this script was compiled in. |
2664 DECL_ACCESSORS(context_data, Object) | 2670 DECL_ACCESSORS(context_data, Object) |
2665 | 2671 |
2666 // [wrapper]: the wrapper cache. | 2672 // [wrapper]: the wrapper cache. |
2667 DECL_ACCESSORS(wrapper, Proxy) | 2673 DECL_ACCESSORS(wrapper, Proxy) |
2668 | 2674 |
2669 // [type]: the script type. | 2675 // [type]: the script type. |
2670 DECL_ACCESSORS(type, Smi) | 2676 DECL_ACCESSORS(type, Smi) |
2671 | 2677 |
2672 // [line_ends]: array of line ends positions | 2678 // [compilation]: how the the script was compiled. |
| 2679 DECL_ACCESSORS(compilation_type, Smi) |
| 2680 |
| 2681 // [line_ends]: array of line ends positions. |
2673 DECL_ACCESSORS(line_ends, Object) | 2682 DECL_ACCESSORS(line_ends, Object) |
2674 | 2683 |
| 2684 // [eval_from_function]: for eval scripts the funcion from which eval was |
| 2685 // called. |
| 2686 DECL_ACCESSORS(eval_from_function, Object) |
| 2687 |
| 2688 // [eval_from_instructions_offset]: the instruction offset in the code for the |
| 2689 // function from which eval was called where eval was called. |
| 2690 DECL_ACCESSORS(eval_from_instructions_offset, Smi) |
| 2691 |
2675 static inline Script* cast(Object* obj); | 2692 static inline Script* cast(Object* obj); |
2676 | 2693 |
2677 #ifdef DEBUG | 2694 #ifdef DEBUG |
2678 void ScriptPrint(); | 2695 void ScriptPrint(); |
2679 void ScriptVerify(); | 2696 void ScriptVerify(); |
2680 #endif | 2697 #endif |
2681 | 2698 |
2682 static const int kSourceOffset = HeapObject::kHeaderSize; | 2699 static const int kSourceOffset = HeapObject::kHeaderSize; |
2683 static const int kNameOffset = kSourceOffset + kPointerSize; | 2700 static const int kNameOffset = kSourceOffset + kPointerSize; |
2684 static const int kLineOffsetOffset = kNameOffset + kPointerSize; | 2701 static const int kLineOffsetOffset = kNameOffset + kPointerSize; |
2685 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize; | 2702 static const int kColumnOffsetOffset = kLineOffsetOffset + kPointerSize; |
2686 static const int kDataOffset = kColumnOffsetOffset + kPointerSize; | 2703 static const int kDataOffset = kColumnOffsetOffset + kPointerSize; |
2687 static const int kContextOffset = kDataOffset + kPointerSize; | 2704 static const int kContextOffset = kDataOffset + kPointerSize; |
2688 static const int kWrapperOffset = kContextOffset + kPointerSize; | 2705 static const int kWrapperOffset = kContextOffset + kPointerSize; |
2689 static const int kTypeOffset = kWrapperOffset + kPointerSize; | 2706 static const int kTypeOffset = kWrapperOffset + kPointerSize; |
2690 static const int kLineEndsOffset = kTypeOffset + kPointerSize; | 2707 static const int kCompilationTypeOffset = kTypeOffset + kPointerSize; |
| 2708 static const int kLineEndsOffset = kCompilationTypeOffset + kPointerSize; |
2691 static const int kIdOffset = kLineEndsOffset + kPointerSize; | 2709 static const int kIdOffset = kLineEndsOffset + kPointerSize; |
2692 static const int kSize = kIdOffset + kPointerSize; | 2710 static const int kEvalFromFunctionOffset = kIdOffset + kPointerSize; |
| 2711 static const int kEvalFrominstructionsOffsetOffset = |
| 2712 kEvalFromFunctionOffset + kPointerSize; |
| 2713 static const int kSize = kEvalFrominstructionsOffsetOffset + kPointerSize; |
2693 | 2714 |
2694 private: | 2715 private: |
2695 DISALLOW_IMPLICIT_CONSTRUCTORS(Script); | 2716 DISALLOW_IMPLICIT_CONSTRUCTORS(Script); |
2696 }; | 2717 }; |
2697 | 2718 |
2698 | 2719 |
2699 // SharedFunctionInfo describes the JSFunction information that can be | 2720 // SharedFunctionInfo describes the JSFunction information that can be |
2700 // shared by multiple instances of the function. | 2721 // shared by multiple instances of the function. |
2701 class SharedFunctionInfo: public HeapObject { | 2722 class SharedFunctionInfo: public HeapObject { |
2702 public: | 2723 public: |
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4408 } else { | 4429 } else { |
4409 value &= ~(1 << bit_position); | 4430 value &= ~(1 << bit_position); |
4410 } | 4431 } |
4411 return value; | 4432 return value; |
4412 } | 4433 } |
4413 }; | 4434 }; |
4414 | 4435 |
4415 } } // namespace v8::internal | 4436 } } // namespace v8::internal |
4416 | 4437 |
4417 #endif // V8_OBJECTS_H_ | 4438 #endif // V8_OBJECTS_H_ |
OLD | NEW |