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

Side by Side Diff: src/objects.h

Issue 1704223002: Remove strong mode support from Scope and Variable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove test-parsing test Created 4 years, 10 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/messages.h ('k') | src/parsing/parser.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 4152 matching lines...) Expand 10 before | Expand all | Expand 10 after
4163 // Return the initialization flag of the given context local. 4163 // Return the initialization flag of the given context local.
4164 InitializationFlag ContextLocalInitFlag(int var); 4164 InitializationFlag ContextLocalInitFlag(int var);
4165 4165
4166 // Return the initialization flag of the given context local. 4166 // Return the initialization flag of the given context local.
4167 MaybeAssignedFlag ContextLocalMaybeAssignedFlag(int var); 4167 MaybeAssignedFlag ContextLocalMaybeAssignedFlag(int var);
4168 4168
4169 // Return true if this local was introduced by the compiler, and should not be 4169 // Return true if this local was introduced by the compiler, and should not be
4170 // exposed to the user in a debugger. 4170 // exposed to the user in a debugger.
4171 bool LocalIsSynthetic(int var); 4171 bool LocalIsSynthetic(int var);
4172 4172
4173 String* StrongModeFreeVariableName(int var);
4174 int StrongModeFreeVariableStartPosition(int var);
4175 int StrongModeFreeVariableEndPosition(int var);
4176
4177 // Lookup support for serialized scope info. Returns the 4173 // Lookup support for serialized scope info. Returns the
4178 // the stack slot index for a given slot name if the slot is 4174 // the stack slot index for a given slot name if the slot is
4179 // present; otherwise returns a value < 0. The name must be an internalized 4175 // present; otherwise returns a value < 0. The name must be an internalized
4180 // string. 4176 // string.
4181 int StackSlotIndex(String* name); 4177 int StackSlotIndex(String* name);
4182 4178
4183 // Lookup support for serialized scope info. Returns the local context slot 4179 // Lookup support for serialized scope info. Returns the local context slot
4184 // index for a given slot name if the slot is present; otherwise 4180 // index for a given slot name if the slot is present; otherwise
4185 // returns a value < 0. The name must be an internalized string. 4181 // returns a value < 0. The name must be an internalized string.
4186 // If the slot is present and mode != NULL, sets *mode to the corresponding 4182 // If the slot is present and mode != NULL, sets *mode to the corresponding
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
4236 // 2. The number of parameters. This only applies to function scopes. For 4232 // 2. The number of parameters. This only applies to function scopes. For
4237 // non-function scopes this is 0. 4233 // non-function scopes this is 0.
4238 // 3. The number of non-parameter variables allocated on the stack. 4234 // 3. The number of non-parameter variables allocated on the stack.
4239 // 4. The number of non-parameter and parameter variables allocated in the 4235 // 4. The number of non-parameter and parameter variables allocated in the
4240 // context. 4236 // context.
4241 #define FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(V) \ 4237 #define FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(V) \
4242 V(Flags) \ 4238 V(Flags) \
4243 V(ParameterCount) \ 4239 V(ParameterCount) \
4244 V(StackLocalCount) \ 4240 V(StackLocalCount) \
4245 V(ContextLocalCount) \ 4241 V(ContextLocalCount) \
4246 V(ContextGlobalCount) \ 4242 V(ContextGlobalCount)
4247 V(StrongModeFreeVariableCount)
4248 4243
4249 #define FIELD_ACCESSORS(name) \ 4244 #define FIELD_ACCESSORS(name) \
4250 inline void Set##name(int value); \ 4245 inline void Set##name(int value); \
4251 inline int name(); 4246 inline int name();
4252 FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(FIELD_ACCESSORS) 4247 FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(FIELD_ACCESSORS)
4253 #undef FIELD_ACCESSORS 4248 #undef FIELD_ACCESSORS
4254 4249
4255 enum { 4250 enum {
4256 #define DECL_INDEX(name) k##name, 4251 #define DECL_INDEX(name) k##name,
4257 FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(DECL_INDEX) 4252 FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(DECL_INDEX)
(...skipping 21 matching lines...) Expand all
4279 // Contains the names of local variables and parameters that are allocated 4274 // Contains the names of local variables and parameters that are allocated
4280 // in the context. They are stored in increasing order of the context slot 4275 // in the context. They are stored in increasing order of the context slot
4281 // index starting with Context::MIN_CONTEXT_SLOTS. One slot is used per 4276 // index starting with Context::MIN_CONTEXT_SLOTS. One slot is used per
4282 // context local, so in total this part occupies ContextLocalCount() slots 4277 // context local, so in total this part occupies ContextLocalCount() slots
4283 // in the array. 4278 // in the array.
4284 // 5. ContextLocalInfoEntries: 4279 // 5. ContextLocalInfoEntries:
4285 // Contains the variable modes and initialization flags corresponding to 4280 // Contains the variable modes and initialization flags corresponding to
4286 // the context locals in ContextLocalNameEntries. One slot is used per 4281 // the context locals in ContextLocalNameEntries. One slot is used per
4287 // context local, so in total this part occupies ContextLocalCount() 4282 // context local, so in total this part occupies ContextLocalCount()
4288 // slots in the array. 4283 // slots in the array.
4289 // 6. StrongModeFreeVariableNameEntries: 4284 // 6. RecieverEntryIndex:
4290 // Stores the names of strong mode free variables.
4291 // 7. StrongModeFreeVariablePositionEntries:
4292 // Stores the locations (start and end position) of strong mode free
4293 // variables.
4294 // 8. RecieverEntryIndex:
4295 // If the scope binds a "this" value, one slot is reserved to hold the 4285 // If the scope binds a "this" value, one slot is reserved to hold the
4296 // context or stack slot index for the variable. 4286 // context or stack slot index for the variable.
4297 // 9. FunctionNameEntryIndex: 4287 // 7. FunctionNameEntryIndex:
4298 // If the scope belongs to a named function expression this part contains 4288 // If the scope belongs to a named function expression this part contains
4299 // information about the function variable. It always occupies two array 4289 // information about the function variable. It always occupies two array
4300 // slots: a. The name of the function variable. 4290 // slots: a. The name of the function variable.
4301 // b. The context or stack slot index for the variable. 4291 // b. The context or stack slot index for the variable.
4302 int ParameterEntriesIndex(); 4292 int ParameterEntriesIndex();
4303 int StackLocalFirstSlotIndex(); 4293 int StackLocalFirstSlotIndex();
4304 int StackLocalEntriesIndex(); 4294 int StackLocalEntriesIndex();
4305 int ContextLocalNameEntriesIndex(); 4295 int ContextLocalNameEntriesIndex();
4306 int ContextGlobalNameEntriesIndex(); 4296 int ContextGlobalNameEntriesIndex();
4307 int ContextLocalInfoEntriesIndex(); 4297 int ContextLocalInfoEntriesIndex();
4308 int ContextGlobalInfoEntriesIndex(); 4298 int ContextGlobalInfoEntriesIndex();
4309 int StrongModeFreeVariableNameEntriesIndex();
4310 int StrongModeFreeVariablePositionEntriesIndex();
4311 int ReceiverEntryIndex(); 4299 int ReceiverEntryIndex();
4312 int FunctionNameEntryIndex(); 4300 int FunctionNameEntryIndex();
4313 4301
4314 int Lookup(Handle<String> name, int start, int end, VariableMode* mode, 4302 int Lookup(Handle<String> name, int start, int end, VariableMode* mode,
4315 VariableLocation* location, InitializationFlag* init_flag, 4303 VariableLocation* location, InitializationFlag* init_flag,
4316 MaybeAssignedFlag* maybe_assigned_flag); 4304 MaybeAssignedFlag* maybe_assigned_flag);
4317 4305
4318 // Used for the function name variable for named function expressions, and for 4306 // Used for the function name variable for named function expressions, and for
4319 // the receiver. 4307 // the receiver.
4320 enum VariableAllocationInfo { NONE, STACK, CONTEXT, UNUSED }; 4308 enum VariableAllocationInfo { NONE, STACK, CONTEXT, UNUSED };
(...skipping 2831 matching lines...) Expand 10 before | Expand all | Expand 10 after
7152 kDontFlush, 7140 kDontFlush,
7153 // byte 2 7141 // byte 2
7154 kFunctionKind, 7142 kFunctionKind,
7155 kIsArrow = kFunctionKind, 7143 kIsArrow = kFunctionKind,
7156 kIsGenerator, 7144 kIsGenerator,
7157 kIsConciseMethod, 7145 kIsConciseMethod,
7158 kIsAccessorFunction, 7146 kIsAccessorFunction,
7159 kIsDefaultConstructor, 7147 kIsDefaultConstructor,
7160 kIsSubclassConstructor, 7148 kIsSubclassConstructor,
7161 kIsBaseConstructor, 7149 kIsBaseConstructor,
7162 kIsInObjectLiteral,
7163 // byte 3 7150 // byte 3
7164 kDeserialized, 7151 kDeserialized,
7165 kNeverCompiled, 7152 kNeverCompiled,
7166 kCompilerHintsCount, // Pseudo entry 7153 kCompilerHintsCount, // Pseudo entry
7167 }; 7154 };
7168 // Add hints for other modes when they're added. 7155 // Add hints for other modes when they're added.
7169 STATIC_ASSERT(LANGUAGE_END == 3); 7156 STATIC_ASSERT(LANGUAGE_END == 3);
7170 // kFunctionKind has to be byte-aligned 7157 // kFunctionKind has to be byte-aligned
7171 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); 7158 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0);
7172 // Make sure that FunctionKind and byte 2 are in sync: 7159 // Make sure that FunctionKind and byte 2 are in sync:
7173 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \ 7160 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \
7174 STATIC_ASSERT(FunctionKind::functionKind == \ 7161 STATIC_ASSERT(FunctionKind::functionKind == \
7175 1 << (compilerFunctionKind - kFunctionKind)) 7162 1 << (compilerFunctionKind - kFunctionKind))
7176 ASSERT_FUNCTION_KIND_ORDER(kArrowFunction, kIsArrow); 7163 ASSERT_FUNCTION_KIND_ORDER(kArrowFunction, kIsArrow);
7177 ASSERT_FUNCTION_KIND_ORDER(kGeneratorFunction, kIsGenerator); 7164 ASSERT_FUNCTION_KIND_ORDER(kGeneratorFunction, kIsGenerator);
7178 ASSERT_FUNCTION_KIND_ORDER(kConciseMethod, kIsConciseMethod); 7165 ASSERT_FUNCTION_KIND_ORDER(kConciseMethod, kIsConciseMethod);
7179 ASSERT_FUNCTION_KIND_ORDER(kAccessorFunction, kIsAccessorFunction); 7166 ASSERT_FUNCTION_KIND_ORDER(kAccessorFunction, kIsAccessorFunction);
7180 ASSERT_FUNCTION_KIND_ORDER(kDefaultConstructor, kIsDefaultConstructor); 7167 ASSERT_FUNCTION_KIND_ORDER(kDefaultConstructor, kIsDefaultConstructor);
7181 ASSERT_FUNCTION_KIND_ORDER(kSubclassConstructor, kIsSubclassConstructor); 7168 ASSERT_FUNCTION_KIND_ORDER(kSubclassConstructor, kIsSubclassConstructor);
7182 ASSERT_FUNCTION_KIND_ORDER(kBaseConstructor, kIsBaseConstructor); 7169 ASSERT_FUNCTION_KIND_ORDER(kBaseConstructor, kIsBaseConstructor);
7183 ASSERT_FUNCTION_KIND_ORDER(kInObjectLiteral, kIsInObjectLiteral);
7184 #undef ASSERT_FUNCTION_KIND_ORDER 7170 #undef ASSERT_FUNCTION_KIND_ORDER
7185 7171
7186 class FunctionKindBits : public BitField<FunctionKind, kIsArrow, 8> {}; 7172 class FunctionKindBits : public BitField<FunctionKind, kIsArrow, 7> {};
7187 7173
7188 class DeoptCountBits : public BitField<int, 0, 4> {}; 7174 class DeoptCountBits : public BitField<int, 0, 4> {};
7189 class OptReenableTriesBits : public BitField<int, 4, 18> {}; 7175 class OptReenableTriesBits : public BitField<int, 4, 18> {};
7190 class ICAgeBits : public BitField<int, 22, 8> {}; 7176 class ICAgeBits : public BitField<int, 22, 8> {};
7191 7177
7192 class OptCountBits : public BitField<int, 0, 22> {}; 7178 class OptCountBits : public BitField<int, 0, 22> {};
7193 class DisabledOptimizationReasonBits : public BitField<int, 22, 8> {}; 7179 class DisabledOptimizationReasonBits : public BitField<int, 22, 8> {};
7194 7180
7195 private: 7181 private:
7196 #if V8_HOST_ARCH_32_BIT 7182 #if V8_HOST_ARCH_32_BIT
(...skipping 3640 matching lines...) Expand 10 before | Expand all | Expand 10 after
10837 } 10823 }
10838 return value; 10824 return value;
10839 } 10825 }
10840 }; 10826 };
10841 10827
10842 10828
10843 } // NOLINT, false-positive due to second-order macros. 10829 } // NOLINT, false-positive due to second-order macros.
10844 } // NOLINT, false-positive due to second-order macros. 10830 } // NOLINT, false-positive due to second-order macros.
10845 10831
10846 #endif // V8_OBJECTS_H_ 10832 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/messages.h ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698