Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: src/objects.h

Issue 1281883002: Group lexical context variables for faster look up. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: added comments and TODOs Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/contexts.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
3944 // Lookup the name of a certain context slot by its index. 3947 // Lookup the name of a certain context slot by its index.
3945 String* ContextSlotName(int slot_index); 3948 String* ContextSlotName(int slot_index);
3946 3949
3947 // Lookup support for serialized scope info. Returns the 3950 // Lookup support for serialized scope info. Returns the
3948 // parameter index for a given parameter name if the parameter is present; 3951 // parameter index for a given parameter name if the parameter is present;
3949 // otherwise returns a value < 0. The name must be an internalized string. 3952 // otherwise returns a value < 0. The name must be an internalized string.
3950 int ParameterIndex(String* name); 3953 int ParameterIndex(String* name);
3951 3954
3952 // Lookup support for serialized scope info. Returns the function context 3955 // Lookup support for serialized scope info. Returns the function context
3953 // slot index if the function name is present and context-allocated (named 3956 // slot index if the function name is present and context-allocated (named
(...skipping 24 matching lines...) Expand all
3978 // 2. The number of parameters. This only applies to function scopes. For 3981 // 2. The number of parameters. This only applies to function scopes. For
3979 // non-function scopes this is 0. 3982 // non-function scopes this is 0.
3980 // 3. The number of non-parameter variables allocated on the stack. 3983 // 3. The number of non-parameter variables allocated on the stack.
3981 // 4. The number of non-parameter and parameter variables allocated in the 3984 // 4. The number of non-parameter and parameter variables allocated in the
3982 // context. 3985 // context.
3983 #define FOR_EACH_NUMERIC_FIELD(V) \ 3986 #define FOR_EACH_NUMERIC_FIELD(V) \
3984 V(Flags) \ 3987 V(Flags) \
3985 V(ParameterCount) \ 3988 V(ParameterCount) \
3986 V(StackLocalCount) \ 3989 V(StackLocalCount) \
3987 V(ContextLocalCount) \ 3990 V(ContextLocalCount) \
3991 V(LexicalContextLocalCount) \
3988 V(ContextGlobalCount) \ 3992 V(ContextGlobalCount) \
3989 V(StrongModeFreeVariableCount) 3993 V(StrongModeFreeVariableCount)
3990 3994
3991 #define FIELD_ACCESSORS(name) \ 3995 #define FIELD_ACCESSORS(name) \
3992 void Set##name(int value) { \ 3996 void Set##name(int value) { \
3993 set(k##name, Smi::FromInt(value)); \ 3997 set(k##name, Smi::FromInt(value)); \
3994 } \ 3998 } \
3995 int name() { \ 3999 int name() { \
3996 if (length() > 0) { \ 4000 if (length() > 0) { \
3997 return Smi::cast(get(k##name))->value(); \ 4001 return Smi::cast(get(k##name))->value(); \
(...skipping 6547 matching lines...) Expand 10 before | Expand all | Expand 10 after
10545 } else { 10549 } else {
10546 value &= ~(1 << bit_position); 10550 value &= ~(1 << bit_position);
10547 } 10551 }
10548 return value; 10552 return value;
10549 } 10553 }
10550 }; 10554 };
10551 10555
10552 } } // namespace v8::internal 10556 } } // namespace v8::internal
10553 10557
10554 #endif // V8_OBJECTS_H_ 10558 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/contexts.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698