| 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 3155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3166 | 3166 |
| 3167 // Return the name of the given stack local. | 3167 // Return the name of the given stack local. |
| 3168 Handle<String> stack_local_name(int var); | 3168 Handle<String> stack_local_name(int var); |
| 3169 | 3169 |
| 3170 // Return the name of the given context local. | 3170 // Return the name of the given context local. |
| 3171 Handle<String> context_local_name(int var); | 3171 Handle<String> context_local_name(int var); |
| 3172 | 3172 |
| 3173 // Return the mode of the given context local. | 3173 // Return the mode of the given context local. |
| 3174 VariableMode context_local_mode(int var); | 3174 VariableMode context_local_mode(int var); |
| 3175 | 3175 |
| 3176 // Return the initialization flag of the given context local. |
| 3177 InitializationFlag context_local_init_flag(int var); |
| 3178 |
| 3176 // Lookup support for serialized scope info. Returns the | 3179 // Lookup support for serialized scope info. Returns the |
| 3177 // the stack slot index for a given slot name if the slot is | 3180 // the stack slot index for a given slot name if the slot is |
| 3178 // present; otherwise returns a value < 0. The name must be a symbol | 3181 // present; otherwise returns a value < 0. The name must be a symbol |
| 3179 // (canonicalized). | 3182 // (canonicalized). |
| 3180 int StackSlotIndex(String* name); | 3183 int StackSlotIndex(String* name); |
| 3181 | 3184 |
| 3182 // Lookup support for serialized scope info. Returns the | 3185 // Lookup support for serialized scope info. Returns the context slot index |
| 3183 // context slot index for a given slot name if the slot is present; otherwise | 3186 // for a given slot name if the slot is present; otherwise returns a |
| 3184 // returns a value < 0. The name must be a symbol (canonicalized). | 3187 // value < 0. The name must be a symbol (canonicalized). |
| 3185 // If the slot is present and mode != NULL, sets *mode to the corresponding | 3188 // If the slot is present |
| 3186 // mode for that variable. | 3189 // 1. and mode != NULL, sets *mode to the mode of that variable. |
| 3187 int ContextSlotIndex(String* name, VariableMode* mode = NULL); | 3190 // 2. and init_flag != NULL, sets *init_flag to the initialization flag of |
| 3191 // that variable. |
| 3192 int ContextSlotIndex(String* name, |
| 3193 VariableMode* mode = NULL, |
| 3194 InitializationFlag* init_flag = NULL); |
| 3188 | 3195 |
| 3189 // Lookup support for serialized scope info. Returns the | 3196 // Lookup support for serialized scope info. Returns the |
| 3190 // parameter index for a given parameter name if the parameter is present; | 3197 // parameter index for a given parameter name if the parameter is present; |
| 3191 // otherwise returns a value < 0. The name must be a symbol (canonicalized). | 3198 // otherwise returns a value < 0. The name must be a symbol (canonicalized). |
| 3192 int ParameterIndex(String* name); | 3199 int ParameterIndex(String* name); |
| 3193 | 3200 |
| 3194 // Lookup support for serialized scope info. Returns the | 3201 // Lookup support for serialized scope info. Returns the |
| 3195 // function context slot index if the function name is present (named | 3202 // function context slot index if the function name is present (named |
| 3196 // function expressions, only), otherwise returns a value < 0. The name | 3203 // function expressions, only), otherwise returns a value < 0. The name |
| 3197 // must be a symbol (canonicalized). | 3204 // must be a symbol (canonicalized). |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3250 // Contains the names of local variables that are allocated on the stack, | 3257 // Contains the names of local variables that are allocated on the stack, |
| 3251 // in increasing order of the stack slot index. One slot is used per | 3258 // in increasing order of the stack slot index. One slot is used per |
| 3252 // stack local, so in total this part occupies num_stack_locals() slots | 3259 // stack local, so in total this part occupies num_stack_locals() slots |
| 3253 // in the array. | 3260 // in the array. |
| 3254 // 3. ContextLocalNameEntries: | 3261 // 3. ContextLocalNameEntries: |
| 3255 // Contains the names of local variables and parameters that are allocated | 3262 // Contains the names of local variables and parameters that are allocated |
| 3256 // in the context. They are stored in increasing order of the context slot | 3263 // in the context. They are stored in increasing order of the context slot |
| 3257 // index starting with Context::MIN_CONTEXT_SLOTS. One slot is used per | 3264 // index starting with Context::MIN_CONTEXT_SLOTS. One slot is used per |
| 3258 // context local, so in total this part occupies num_context_locals() | 3265 // context local, so in total this part occupies num_context_locals() |
| 3259 // slots in the array. | 3266 // slots in the array. |
| 3260 // 4. ContextLocalModeEntries: | 3267 // 4. ContextLocalInfoEntries: |
| 3261 // Contains the variable modes corresponding to the context locals in | 3268 // Contains the variable modes and initialization flags corresponding to |
| 3262 // ContextLocalNameEntries. One slot is used per context local, so in total | 3269 // the context locals in ContextLocalNameEntries. One slot is used per |
| 3263 // this part occupies num_context_locals() slots in the array. | 3270 // context local, so in total this part occupies num_context_locals() |
| 3271 // slots in the array. |
| 3264 // 5. FunctionNameEntryIndex: | 3272 // 5. FunctionNameEntryIndex: |
| 3265 // If the scope belongs to a named function expression this part contains | 3273 // If the scope belongs to a named function expression this part contains |
| 3266 // information about the function variable. It always occupies two array | 3274 // information about the function variable. It always occupies two array |
| 3267 // slots: a. The name of the function variable. | 3275 // slots: a. The name of the function variable. |
| 3268 // b. The context or stack slot index for the variable. | 3276 // b. The context or stack slot index for the variable. |
| 3269 int ParameterEntriesIndex(); | 3277 int ParameterEntriesIndex(); |
| 3270 int StackLocalEntriesIndex(); | 3278 int StackLocalEntriesIndex(); |
| 3271 int ContextLocalNameEntriesIndex(); | 3279 int ContextLocalNameEntriesIndex(); |
| 3272 int ContextLocalModeEntriesIndex(); | 3280 int ContextLocalInfoEntriesIndex(); |
| 3273 int FunctionNameEntryIndex(); | 3281 int FunctionNameEntryIndex(); |
| 3274 | 3282 |
| 3275 // Location of the function variable for named function expressions. | 3283 // Location of the function variable for named function expressions. |
| 3276 enum FunctionVariableInfo { | 3284 enum FunctionVariableInfo { |
| 3277 NONE, // No function name present. | 3285 NONE, // No function name present. |
| 3278 STACK, // Function | 3286 STACK, // Function |
| 3279 CONTEXT, | 3287 CONTEXT, |
| 3280 UNUSED | 3288 UNUSED |
| 3281 }; | 3289 }; |
| 3282 | 3290 |
| 3283 // Properties of scopes. | 3291 // Properties of scopes. |
| 3284 class TypeField: public BitField<ScopeType, 0, 3> {}; | 3292 class TypeField: public BitField<ScopeType, 0, 3> {}; |
| 3285 class CallsEvalField: public BitField<bool, 3, 1> {}; | 3293 class CallsEvalField: public BitField<bool, 3, 1> {}; |
| 3286 class StrictModeField: public BitField<bool, 4, 1> {}; | 3294 class StrictModeField: public BitField<bool, 4, 1> {}; |
| 3287 class FunctionVariableField: public BitField<FunctionVariableInfo, 5, 2> {}; | 3295 class FunctionVariableField: public BitField<FunctionVariableInfo, 5, 2> {}; |
| 3288 class FunctionVariableMode: public BitField<VariableMode, 7, 3> {}; | 3296 class FunctionVariableMode: public BitField<VariableMode, 7, 3> {}; |
| 3297 |
| 3298 // BitFields representing the encoded information for context locals in the |
| 3299 // ContextLocalInfoEntries part. |
| 3300 class ContextLocalMode: public BitField<VariableMode, 0, 3> {}; |
| 3301 class ContextLocalInitFlag: public BitField<InitializationFlag, 3, 1> {}; |
| 3289 }; | 3302 }; |
| 3290 | 3303 |
| 3291 | 3304 |
| 3292 // The cache for maps used by normalized (dictionary mode) objects. | 3305 // The cache for maps used by normalized (dictionary mode) objects. |
| 3293 // Such maps do not have property descriptors, so a typical program | 3306 // Such maps do not have property descriptors, so a typical program |
| 3294 // needs very limited number of distinct normalized maps. | 3307 // needs very limited number of distinct normalized maps. |
| 3295 class NormalizedMapCache: public FixedArray { | 3308 class NormalizedMapCache: public FixedArray { |
| 3296 public: | 3309 public: |
| 3297 static const int kEntries = 64; | 3310 static const int kEntries = 64; |
| 3298 | 3311 |
| (...skipping 4630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7929 } else { | 7942 } else { |
| 7930 value &= ~(1 << bit_position); | 7943 value &= ~(1 << bit_position); |
| 7931 } | 7944 } |
| 7932 return value; | 7945 return value; |
| 7933 } | 7946 } |
| 7934 }; | 7947 }; |
| 7935 | 7948 |
| 7936 } } // namespace v8::internal | 7949 } } // namespace v8::internal |
| 7937 | 7950 |
| 7938 #endif // V8_OBJECTS_H_ | 7951 #endif // V8_OBJECTS_H_ |
| OLD | NEW |