OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 3923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3934 // Lookup support for serialized scope info. Returns the | 3934 // Lookup support for serialized scope info. Returns the |
3935 // context slot index for a given slot name if the slot is present; otherwise | 3935 // context slot index for a given slot name if the slot is present; otherwise |
3936 // returns a value < 0. The name must be an internalized string. | 3936 // returns a value < 0. The name must be an internalized string. |
3937 // If the slot is present and mode != NULL, sets *mode to the corresponding | 3937 // If the slot is present and mode != NULL, sets *mode to the corresponding |
3938 // mode for that variable. | 3938 // mode for that variable. |
3939 static int ContextSlotIndex(Handle<ScopeInfo> scope_info, Handle<String> name, | 3939 static int ContextSlotIndex(Handle<ScopeInfo> scope_info, Handle<String> name, |
3940 VariableMode* mode, VariableLocation* location, | 3940 VariableMode* mode, VariableLocation* location, |
3941 InitializationFlag* init_flag, | 3941 InitializationFlag* init_flag, |
3942 MaybeAssignedFlag* maybe_assigned_flag); | 3942 MaybeAssignedFlag* maybe_assigned_flag); |
3943 | 3943 |
3944 static int LexicalContextSlotIndex(Handle<ScopeInfo> scope_info, | |
3945 Handle<String> name); | |
3946 | |
3947 // Lookup the name of a certain context slot by its index. | 3944 // Lookup the name of a certain context slot by its index. |
3948 String* ContextSlotName(int slot_index); | 3945 String* ContextSlotName(int slot_index); |
3949 | 3946 |
3950 // Lookup support for serialized scope info. Returns the | 3947 // Lookup support for serialized scope info. Returns the |
3951 // parameter index for a given parameter name if the parameter is present; | 3948 // parameter index for a given parameter name if the parameter is present; |
3952 // otherwise returns a value < 0. The name must be an internalized string. | 3949 // otherwise returns a value < 0. The name must be an internalized string. |
3953 int ParameterIndex(String* name); | 3950 int ParameterIndex(String* name); |
3954 | 3951 |
3955 // Lookup support for serialized scope info. Returns the function context | 3952 // Lookup support for serialized scope info. Returns the function context |
3956 // slot index if the function name is present and context-allocated (named | 3953 // slot index if the function name is present and context-allocated (named |
(...skipping 24 matching lines...) Expand all Loading... |
3981 // 2. The number of parameters. This only applies to function scopes. For | 3978 // 2. The number of parameters. This only applies to function scopes. For |
3982 // non-function scopes this is 0. | 3979 // non-function scopes this is 0. |
3983 // 3. The number of non-parameter variables allocated on the stack. | 3980 // 3. The number of non-parameter variables allocated on the stack. |
3984 // 4. The number of non-parameter and parameter variables allocated in the | 3981 // 4. The number of non-parameter and parameter variables allocated in the |
3985 // context. | 3982 // context. |
3986 #define FOR_EACH_NUMERIC_FIELD(V) \ | 3983 #define FOR_EACH_NUMERIC_FIELD(V) \ |
3987 V(Flags) \ | 3984 V(Flags) \ |
3988 V(ParameterCount) \ | 3985 V(ParameterCount) \ |
3989 V(StackLocalCount) \ | 3986 V(StackLocalCount) \ |
3990 V(ContextLocalCount) \ | 3987 V(ContextLocalCount) \ |
3991 V(LexicalContextLocalCount) \ | |
3992 V(ContextGlobalCount) \ | 3988 V(ContextGlobalCount) \ |
3993 V(StrongModeFreeVariableCount) | 3989 V(StrongModeFreeVariableCount) |
3994 | 3990 |
3995 #define FIELD_ACCESSORS(name) \ | 3991 #define FIELD_ACCESSORS(name) \ |
3996 void Set##name(int value) { \ | 3992 void Set##name(int value) { \ |
3997 set(k##name, Smi::FromInt(value)); \ | 3993 set(k##name, Smi::FromInt(value)); \ |
3998 } \ | 3994 } \ |
3999 int name() { \ | 3995 int name() { \ |
4000 if (length() > 0) { \ | 3996 if (length() > 0) { \ |
4001 return Smi::cast(get(k##name))->value(); \ | 3997 return Smi::cast(get(k##name))->value(); \ |
(...skipping 6547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10549 } else { | 10545 } else { |
10550 value &= ~(1 << bit_position); | 10546 value &= ~(1 << bit_position); |
10551 } | 10547 } |
10552 return value; | 10548 return value; |
10553 } | 10549 } |
10554 }; | 10550 }; |
10555 | 10551 |
10556 } } // namespace v8::internal | 10552 } } // namespace v8::internal |
10557 | 10553 |
10558 #endif // V8_OBJECTS_H_ | 10554 #endif // V8_OBJECTS_H_ |
OLD | NEW |