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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // - Smi (immediate small integer) | 52 // - Smi (immediate small integer) |
53 // - HeapObject (superclass for everything allocated in the heap) | 53 // - HeapObject (superclass for everything allocated in the heap) |
54 // - JSReceiver (suitable for property access) | 54 // - JSReceiver (suitable for property access) |
55 // - JSObject | 55 // - JSObject |
56 // - JSArray | 56 // - JSArray |
57 // - JSSet | 57 // - JSSet |
58 // - JSMap | 58 // - JSMap |
59 // - JSWeakMap | 59 // - JSWeakMap |
60 // - JSRegExp | 60 // - JSRegExp |
61 // - JSFunction | 61 // - JSFunction |
| 62 // - JSModule |
62 // - GlobalObject | 63 // - GlobalObject |
63 // - JSGlobalObject | 64 // - JSGlobalObject |
64 // - JSBuiltinsObject | 65 // - JSBuiltinsObject |
65 // - JSGlobalProxy | 66 // - JSGlobalProxy |
66 // - JSValue | 67 // - JSValue |
67 // - JSDate | 68 // - JSDate |
68 // - JSMessageObject | 69 // - JSMessageObject |
69 // - JSProxy | 70 // - JSProxy |
70 // - JSFunctionProxy | 71 // - JSFunctionProxy |
71 // - FixedArrayBase | 72 // - FixedArrayBase |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 V(FIXED_ARRAY_TYPE) \ | 300 V(FIXED_ARRAY_TYPE) \ |
300 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 301 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
301 V(SHARED_FUNCTION_INFO_TYPE) \ | 302 V(SHARED_FUNCTION_INFO_TYPE) \ |
302 \ | 303 \ |
303 V(JS_MESSAGE_OBJECT_TYPE) \ | 304 V(JS_MESSAGE_OBJECT_TYPE) \ |
304 \ | 305 \ |
305 V(JS_VALUE_TYPE) \ | 306 V(JS_VALUE_TYPE) \ |
306 V(JS_DATE_TYPE) \ | 307 V(JS_DATE_TYPE) \ |
307 V(JS_OBJECT_TYPE) \ | 308 V(JS_OBJECT_TYPE) \ |
308 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 309 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
| 310 V(JS_MODULE_TYPE) \ |
309 V(JS_GLOBAL_OBJECT_TYPE) \ | 311 V(JS_GLOBAL_OBJECT_TYPE) \ |
310 V(JS_BUILTINS_OBJECT_TYPE) \ | 312 V(JS_BUILTINS_OBJECT_TYPE) \ |
311 V(JS_GLOBAL_PROXY_TYPE) \ | 313 V(JS_GLOBAL_PROXY_TYPE) \ |
312 V(JS_ARRAY_TYPE) \ | 314 V(JS_ARRAY_TYPE) \ |
313 V(JS_PROXY_TYPE) \ | 315 V(JS_PROXY_TYPE) \ |
314 V(JS_WEAK_MAP_TYPE) \ | 316 V(JS_WEAK_MAP_TYPE) \ |
315 V(JS_REGEXP_TYPE) \ | 317 V(JS_REGEXP_TYPE) \ |
316 \ | 318 \ |
317 V(JS_FUNCTION_TYPE) \ | 319 V(JS_FUNCTION_TYPE) \ |
318 V(JS_FUNCTION_PROXY_TYPE) \ | 320 V(JS_FUNCTION_PROXY_TYPE) \ |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 // the two forms of function. This organization enables using the same | 621 // the two forms of function. This organization enables using the same |
620 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the | 622 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the |
621 // NONCALLABLE_JS_OBJECT range. | 623 // NONCALLABLE_JS_OBJECT range. |
622 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE | 624 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE |
623 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE | 625 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE |
624 | 626 |
625 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE | 627 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE |
626 JS_DATE_TYPE, | 628 JS_DATE_TYPE, |
627 JS_OBJECT_TYPE, | 629 JS_OBJECT_TYPE, |
628 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 630 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
| 631 JS_MODULE_TYPE, |
629 JS_GLOBAL_OBJECT_TYPE, | 632 JS_GLOBAL_OBJECT_TYPE, |
630 JS_BUILTINS_OBJECT_TYPE, | 633 JS_BUILTINS_OBJECT_TYPE, |
631 JS_GLOBAL_PROXY_TYPE, | 634 JS_GLOBAL_PROXY_TYPE, |
632 JS_ARRAY_TYPE, | 635 JS_ARRAY_TYPE, |
633 JS_SET_TYPE, | 636 JS_SET_TYPE, |
634 JS_MAP_TYPE, | 637 JS_MAP_TYPE, |
635 JS_WEAK_MAP_TYPE, | 638 JS_WEAK_MAP_TYPE, |
636 | 639 |
637 JS_REGEXP_TYPE, | 640 JS_REGEXP_TYPE, |
638 | 641 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 V(ExternalIntArray) \ | 799 V(ExternalIntArray) \ |
797 V(ExternalUnsignedIntArray) \ | 800 V(ExternalUnsignedIntArray) \ |
798 V(ExternalFloatArray) \ | 801 V(ExternalFloatArray) \ |
799 V(ExternalDoubleArray) \ | 802 V(ExternalDoubleArray) \ |
800 V(ExternalPixelArray) \ | 803 V(ExternalPixelArray) \ |
801 V(ByteArray) \ | 804 V(ByteArray) \ |
802 V(FreeSpace) \ | 805 V(FreeSpace) \ |
803 V(JSReceiver) \ | 806 V(JSReceiver) \ |
804 V(JSObject) \ | 807 V(JSObject) \ |
805 V(JSContextExtensionObject) \ | 808 V(JSContextExtensionObject) \ |
| 809 V(JSModule) \ |
806 V(Map) \ | 810 V(Map) \ |
807 V(DescriptorArray) \ | 811 V(DescriptorArray) \ |
808 V(DeoptimizationInputData) \ | 812 V(DeoptimizationInputData) \ |
809 V(DeoptimizationOutputData) \ | 813 V(DeoptimizationOutputData) \ |
810 V(TypeFeedbackCells) \ | 814 V(TypeFeedbackCells) \ |
811 V(FixedArray) \ | 815 V(FixedArray) \ |
812 V(FixedDoubleArray) \ | 816 V(FixedDoubleArray) \ |
813 V(Context) \ | 817 V(Context) \ |
814 V(GlobalContext) \ | 818 V(GlobalContext) \ |
| 819 V(ModuleContext) \ |
815 V(ScopeInfo) \ | 820 V(ScopeInfo) \ |
816 V(JSFunction) \ | 821 V(JSFunction) \ |
817 V(Code) \ | 822 V(Code) \ |
818 V(Oddball) \ | 823 V(Oddball) \ |
819 V(SharedFunctionInfo) \ | 824 V(SharedFunctionInfo) \ |
820 V(JSValue) \ | 825 V(JSValue) \ |
821 V(JSDate) \ | 826 V(JSDate) \ |
822 V(JSMessageObject) \ | 827 V(JSMessageObject) \ |
823 V(StringWrapper) \ | 828 V(StringWrapper) \ |
824 V(Foreign) \ | 829 V(Foreign) \ |
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2461 | 2466 |
2462 // Initialize or change the enum cache, | 2467 // Initialize or change the enum cache, |
2463 // using the supplied storage for the small "bridge". | 2468 // using the supplied storage for the small "bridge". |
2464 void SetEnumCache(FixedArray* bridge_storage, | 2469 void SetEnumCache(FixedArray* bridge_storage, |
2465 FixedArray* new_cache, | 2470 FixedArray* new_cache, |
2466 Object* new_index_cache); | 2471 Object* new_index_cache); |
2467 | 2472 |
2468 // Accessors for fetching instance descriptor at descriptor number. | 2473 // Accessors for fetching instance descriptor at descriptor number. |
2469 inline String* GetKey(int descriptor_number); | 2474 inline String* GetKey(int descriptor_number); |
2470 inline Object* GetValue(int descriptor_number); | 2475 inline Object* GetValue(int descriptor_number); |
2471 inline Smi* GetDetails(int descriptor_number); | 2476 inline PropertyDetails GetDetails(int descriptor_number); |
2472 inline PropertyType GetType(int descriptor_number); | 2477 inline PropertyType GetType(int descriptor_number); |
2473 inline int GetFieldIndex(int descriptor_number); | 2478 inline int GetFieldIndex(int descriptor_number); |
2474 inline JSFunction* GetConstantFunction(int descriptor_number); | 2479 inline JSFunction* GetConstantFunction(int descriptor_number); |
2475 inline Object* GetCallbacksObject(int descriptor_number); | 2480 inline Object* GetCallbacksObject(int descriptor_number); |
2476 inline AccessorDescriptor* GetCallbacks(int descriptor_number); | 2481 inline AccessorDescriptor* GetCallbacks(int descriptor_number); |
2477 inline bool IsProperty(int descriptor_number); | 2482 inline bool IsProperty(int descriptor_number); |
2478 inline bool IsTransitionOnly(int descriptor_number); | 2483 inline bool IsTransitionOnly(int descriptor_number); |
2479 inline bool IsNullDescriptor(int descriptor_number); | 2484 inline bool IsNullDescriptor(int descriptor_number); |
2480 inline bool IsDontEnum(int descriptor_number); | |
2481 | 2485 |
2482 class WhitenessWitness { | 2486 class WhitenessWitness { |
2483 public: | 2487 public: |
2484 inline explicit WhitenessWitness(DescriptorArray* array); | 2488 inline explicit WhitenessWitness(DescriptorArray* array); |
2485 inline ~WhitenessWitness(); | 2489 inline ~WhitenessWitness(); |
2486 | 2490 |
2487 private: | 2491 private: |
2488 IncrementalMarking* marking_; | 2492 IncrementalMarking* marking_; |
2489 }; | 2493 }; |
2490 | 2494 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2624 } | 2628 } |
2625 | 2629 |
2626 static int ToDetailsIndex(int descriptor_number) { | 2630 static int ToDetailsIndex(int descriptor_number) { |
2627 return (descriptor_number << 1) + 1; | 2631 return (descriptor_number << 1) + 1; |
2628 } | 2632 } |
2629 | 2633 |
2630 static int ToValueIndex(int descriptor_number) { | 2634 static int ToValueIndex(int descriptor_number) { |
2631 return descriptor_number << 1; | 2635 return descriptor_number << 1; |
2632 } | 2636 } |
2633 | 2637 |
2634 bool is_null_descriptor(int descriptor_number) { | |
2635 return PropertyDetails(GetDetails(descriptor_number)).type() == | |
2636 NULL_DESCRIPTOR; | |
2637 } | |
2638 // Swap operation on FixedArray without using write barriers. | 2638 // Swap operation on FixedArray without using write barriers. |
2639 static inline void NoIncrementalWriteBarrierSwap( | 2639 static inline void NoIncrementalWriteBarrierSwap( |
2640 FixedArray* array, int first, int second); | 2640 FixedArray* array, int first, int second); |
2641 | 2641 |
2642 // Swap descriptor first and second. | 2642 // Swap descriptor first and second. |
2643 inline void NoIncrementalWriteBarrierSwapDescriptors( | 2643 inline void NoIncrementalWriteBarrierSwapDescriptors( |
2644 int first, int second); | 2644 int first, int second); |
2645 | 2645 |
2646 FixedArray* GetContentArray() { | 2646 FixedArray* GetContentArray() { |
2647 return FixedArray::cast(get(kContentArrayIndex)); | 2647 return FixedArray::cast(get(kContentArrayIndex)); |
(...skipping 3036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5684 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte); | 5684 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte); |
5685 #else | 5685 #else |
5686 #error Unknown byte ordering | 5686 #error Unknown byte ordering |
5687 #endif | 5687 #endif |
5688 | 5688 |
5689 private: | 5689 private: |
5690 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); | 5690 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); |
5691 }; | 5691 }; |
5692 | 5692 |
5693 | 5693 |
| 5694 // Representation for module instance objects. |
| 5695 class JSModule: public JSObject { |
| 5696 public: |
| 5697 // [context]: the context holding the module's locals, or undefined if none. |
| 5698 DECL_ACCESSORS(context, Object) |
| 5699 |
| 5700 // Casting. |
| 5701 static inline JSModule* cast(Object* obj); |
| 5702 |
| 5703 // Dispatched behavior. |
| 5704 #ifdef OBJECT_PRINT |
| 5705 inline void JSModulePrint() { |
| 5706 JSModulePrint(stdout); |
| 5707 } |
| 5708 void JSModulePrint(FILE* out); |
| 5709 #endif |
| 5710 #ifdef DEBUG |
| 5711 void JSModuleVerify(); |
| 5712 #endif |
| 5713 |
| 5714 // Layout description. |
| 5715 static const int kContextOffset = JSObject::kHeaderSize; |
| 5716 static const int kSize = kContextOffset + kPointerSize; |
| 5717 |
| 5718 private: |
| 5719 DISALLOW_IMPLICIT_CONSTRUCTORS(JSModule); |
| 5720 }; |
| 5721 |
| 5722 |
5694 // JSFunction describes JavaScript functions. | 5723 // JSFunction describes JavaScript functions. |
5695 class JSFunction: public JSObject { | 5724 class JSFunction: public JSObject { |
5696 public: | 5725 public: |
5697 // [prototype_or_initial_map]: | 5726 // [prototype_or_initial_map]: |
5698 DECL_ACCESSORS(prototype_or_initial_map, Object) | 5727 DECL_ACCESSORS(prototype_or_initial_map, Object) |
5699 | 5728 |
5700 // [shared]: The information about the function that | 5729 // [shared]: The information about the function that |
5701 // can be shared by instances. | 5730 // can be shared by instances. |
5702 DECL_ACCESSORS(shared, SharedFunctionInfo) | 5731 DECL_ACCESSORS(shared, SharedFunctionInfo) |
5703 | 5732 |
(...skipping 2891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8595 } else { | 8624 } else { |
8596 value &= ~(1 << bit_position); | 8625 value &= ~(1 << bit_position); |
8597 } | 8626 } |
8598 return value; | 8627 return value; |
8599 } | 8628 } |
8600 }; | 8629 }; |
8601 | 8630 |
8602 } } // namespace v8::internal | 8631 } } // namespace v8::internal |
8603 | 8632 |
8604 #endif // V8_OBJECTS_H_ | 8633 #endif // V8_OBJECTS_H_ |
OLD | NEW |