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 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 | 3004 |
3005 // Casting | 3005 // Casting |
3006 static inline JSFunctionResultCache* cast(Object* obj); | 3006 static inline JSFunctionResultCache* cast(Object* obj); |
3007 | 3007 |
3008 #ifdef DEBUG | 3008 #ifdef DEBUG |
3009 void JSFunctionResultCacheVerify(); | 3009 void JSFunctionResultCacheVerify(); |
3010 #endif | 3010 #endif |
3011 }; | 3011 }; |
3012 | 3012 |
3013 | 3013 |
| 3014 // This object provides quick access to scope info details for runtime |
| 3015 // routines w/o the need to explicitly create a ScopeInfo object. |
| 3016 class SerializedScopeInfo : public FixedArray { |
| 3017 public : |
| 3018 static SerializedScopeInfo* cast(Object* object) { |
| 3019 ASSERT(object->IsSerializedScopeInfo()); |
| 3020 return reinterpret_cast<SerializedScopeInfo*>(object); |
| 3021 } |
| 3022 |
| 3023 // Does this scope call eval? |
| 3024 bool CallsEval(); |
| 3025 |
| 3026 // Is this scope a strict mode scope? |
| 3027 bool IsStrictMode(); |
| 3028 |
| 3029 // Return the number of stack slots for code. |
| 3030 int NumberOfStackSlots(); |
| 3031 |
| 3032 // Return the number of context slots for code. |
| 3033 int NumberOfContextSlots(); |
| 3034 |
| 3035 // Return if this has context slots besides MIN_CONTEXT_SLOTS; |
| 3036 bool HasHeapAllocatedLocals(); |
| 3037 |
| 3038 // Lookup support for serialized scope info. Returns the |
| 3039 // the stack slot index for a given slot name if the slot is |
| 3040 // present; otherwise returns a value < 0. The name must be a symbol |
| 3041 // (canonicalized). |
| 3042 int StackSlotIndex(String* name); |
| 3043 |
| 3044 // Lookup support for serialized scope info. Returns the |
| 3045 // context slot index for a given slot name if the slot is present; otherwise |
| 3046 // returns a value < 0. The name must be a symbol (canonicalized). |
| 3047 // If the slot is present and mode != NULL, sets *mode to the corresponding |
| 3048 // mode for that variable. |
| 3049 int ContextSlotIndex(String* name, VariableMode* mode); |
| 3050 |
| 3051 // Lookup support for serialized scope info. Returns the |
| 3052 // parameter index for a given parameter name if the parameter is present; |
| 3053 // otherwise returns a value < 0. The name must be a symbol (canonicalized). |
| 3054 int ParameterIndex(String* name); |
| 3055 |
| 3056 // Lookup support for serialized scope info. Returns the |
| 3057 // function context slot index if the function name is present (named |
| 3058 // function expressions, only), otherwise returns a value < 0. The name |
| 3059 // must be a symbol (canonicalized). |
| 3060 int FunctionContextSlotIndex(String* name); |
| 3061 |
| 3062 static Handle<SerializedScopeInfo> Create(Scope* scope); |
| 3063 |
| 3064 // Serializes empty scope info. |
| 3065 static SerializedScopeInfo* Empty(); |
| 3066 |
| 3067 private: |
| 3068 Object** ContextEntriesAddr(); |
| 3069 |
| 3070 Object** ParameterEntriesAddr(); |
| 3071 |
| 3072 Object** StackSlotEntriesAddr(); |
| 3073 }; |
| 3074 |
| 3075 |
3014 // The cache for maps used by normalized (dictionary mode) objects. | 3076 // The cache for maps used by normalized (dictionary mode) objects. |
3015 // Such maps do not have property descriptors, so a typical program | 3077 // Such maps do not have property descriptors, so a typical program |
3016 // needs very limited number of distinct normalized maps. | 3078 // needs very limited number of distinct normalized maps. |
3017 class NormalizedMapCache: public FixedArray { | 3079 class NormalizedMapCache: public FixedArray { |
3018 public: | 3080 public: |
3019 static const int kEntries = 64; | 3081 static const int kEntries = 64; |
3020 | 3082 |
3021 MUST_USE_RESULT MaybeObject* Get(JSObject* object, | 3083 MUST_USE_RESULT MaybeObject* Get(JSObject* object, |
3022 PropertyNormalizationMode mode); | 3084 PropertyNormalizationMode mode); |
3023 | 3085 |
(...skipping 4488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7512 } else { | 7574 } else { |
7513 value &= ~(1 << bit_position); | 7575 value &= ~(1 << bit_position); |
7514 } | 7576 } |
7515 return value; | 7577 return value; |
7516 } | 7578 } |
7517 }; | 7579 }; |
7518 | 7580 |
7519 } } // namespace v8::internal | 7581 } } // namespace v8::internal |
7520 | 7582 |
7521 #endif // V8_OBJECTS_H_ | 7583 #endif // V8_OBJECTS_H_ |
OLD | NEW |