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

Side by Side Diff: src/objects.h

Issue 1005063002: Strawman: check strong mode free variables against the global object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: arrow func param fix Created 5 years, 9 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.js ('k') | src/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 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 4288 matching lines...) Expand 10 before | Expand all | Expand 10 after
4299 // Return the initialization flag of the given context local. 4299 // Return the initialization flag of the given context local.
4300 InitializationFlag ContextLocalInitFlag(int var); 4300 InitializationFlag ContextLocalInitFlag(int var);
4301 4301
4302 // Return the initialization flag of the given context local. 4302 // Return the initialization flag of the given context local.
4303 MaybeAssignedFlag ContextLocalMaybeAssignedFlag(int var); 4303 MaybeAssignedFlag ContextLocalMaybeAssignedFlag(int var);
4304 4304
4305 // Return true if this local was introduced by the compiler, and should not be 4305 // Return true if this local was introduced by the compiler, and should not be
4306 // exposed to the user in a debugger. 4306 // exposed to the user in a debugger.
4307 bool LocalIsSynthetic(int var); 4307 bool LocalIsSynthetic(int var);
4308 4308
4309 String* StrongModeFreeVariableName(int var);
4310 int StrongModeFreeVariableStartPosition(int var);
4311 int StrongModeFreeVariableEndPosition(int var);
4312
4309 // Lookup support for serialized scope info. Returns the 4313 // Lookup support for serialized scope info. Returns the
4310 // the stack slot index for a given slot name if the slot is 4314 // the stack slot index for a given slot name if the slot is
4311 // present; otherwise returns a value < 0. The name must be an internalized 4315 // present; otherwise returns a value < 0. The name must be an internalized
4312 // string. 4316 // string.
4313 int StackSlotIndex(String* name); 4317 int StackSlotIndex(String* name);
4314 4318
4315 // Lookup support for serialized scope info. Returns the 4319 // Lookup support for serialized scope info. Returns the
4316 // context slot index for a given slot name if the slot is present; otherwise 4320 // context slot index for a given slot name if the slot is present; otherwise
4317 // returns a value < 0. The name must be an internalized string. 4321 // returns a value < 0. The name must be an internalized string.
4318 // If the slot is present and mode != NULL, sets *mode to the corresponding 4322 // If the slot is present and mode != NULL, sets *mode to the corresponding
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4351 #endif 4355 #endif
4352 4356
4353 // The layout of the static part of a ScopeInfo is as follows. Each entry is 4357 // The layout of the static part of a ScopeInfo is as follows. Each entry is
4354 // numeric and occupies one array slot. 4358 // numeric and occupies one array slot.
4355 // 1. A set of properties of the scope 4359 // 1. A set of properties of the scope
4356 // 2. The number of parameters. This only applies to function scopes. For 4360 // 2. The number of parameters. This only applies to function scopes. For
4357 // non-function scopes this is 0. 4361 // non-function scopes this is 0.
4358 // 3. The number of non-parameter variables allocated on the stack. 4362 // 3. The number of non-parameter variables allocated on the stack.
4359 // 4. The number of non-parameter and parameter variables allocated in the 4363 // 4. The number of non-parameter and parameter variables allocated in the
4360 // context. 4364 // context.
4361 #define FOR_EACH_NUMERIC_FIELD(V) \ 4365 #define FOR_EACH_NUMERIC_FIELD(V) \
4362 V(Flags) \ 4366 V(Flags) \
4363 V(ParameterCount) \ 4367 V(ParameterCount) \
4364 V(StackLocalCount) \ 4368 V(StackLocalCount) \
4365 V(ContextLocalCount) 4369 V(ContextLocalCount) \
4370 V(StrongModeFreeVariableCount)
4366 4371
4367 #define FIELD_ACCESSORS(name) \ 4372 #define FIELD_ACCESSORS(name) \
4368 void Set##name(int value) { \ 4373 void Set##name(int value) { \
4369 set(k##name, Smi::FromInt(value)); \ 4374 set(k##name, Smi::FromInt(value)); \
4370 } \ 4375 } \
4371 int name() { \ 4376 int name() { \
4372 if (length() > 0) { \ 4377 if (length() > 0) { \
4373 return Smi::cast(get(k##name))->value(); \ 4378 return Smi::cast(get(k##name))->value(); \
4374 } else { \ 4379 } else { \
4375 return 0; \ 4380 return 0; \
(...skipping 26 matching lines...) Expand all
4402 // Contains the names of local variables and parameters that are allocated 4407 // Contains the names of local variables and parameters that are allocated
4403 // in the context. They are stored in increasing order of the context slot 4408 // in the context. They are stored in increasing order of the context slot
4404 // index starting with Context::MIN_CONTEXT_SLOTS. One slot is used per 4409 // index starting with Context::MIN_CONTEXT_SLOTS. One slot is used per
4405 // context local, so in total this part occupies ContextLocalCount() slots 4410 // context local, so in total this part occupies ContextLocalCount() slots
4406 // in the array. 4411 // in the array.
4407 // 4. ContextLocalInfoEntries: 4412 // 4. ContextLocalInfoEntries:
4408 // Contains the variable modes and initialization flags corresponding to 4413 // Contains the variable modes and initialization flags corresponding to
4409 // the context locals in ContextLocalNameEntries. One slot is used per 4414 // the context locals in ContextLocalNameEntries. One slot is used per
4410 // context local, so in total this part occupies ContextLocalCount() 4415 // context local, so in total this part occupies ContextLocalCount()
4411 // slots in the array. 4416 // slots in the array.
4412 // 5. FunctionNameEntryIndex: 4417 // 5. StrongModeFreeVariableNameEntries:
4418 // Stores the names of strong mode free variables.
4419 // 6. StrongModeFreeVariablePositionEntries:
4420 // Stores the locations (start and end position) of strong mode free
4421 // variables.
4422 // 7. FunctionNameEntryIndex:
4413 // If the scope belongs to a named function expression this part contains 4423 // If the scope belongs to a named function expression this part contains
4414 // information about the function variable. It always occupies two array 4424 // information about the function variable. It always occupies two array
4415 // slots: a. The name of the function variable. 4425 // slots: a. The name of the function variable.
4416 // b. The context or stack slot index for the variable. 4426 // b. The context or stack slot index for the variable.
4417 int ParameterEntriesIndex(); 4427 int ParameterEntriesIndex();
4418 int StackLocalEntriesIndex(); 4428 int StackLocalEntriesIndex();
4419 int ContextLocalNameEntriesIndex(); 4429 int ContextLocalNameEntriesIndex();
4420 int ContextLocalInfoEntriesIndex(); 4430 int ContextLocalInfoEntriesIndex();
4431 int StrongModeFreeVariableNameEntriesIndex();
4432 int StrongModeFreeVariablePositionEntriesIndex();
4421 int FunctionNameEntryIndex(); 4433 int FunctionNameEntryIndex();
4422 4434
4423 // Location of the function variable for named function expressions. 4435 // Location of the function variable for named function expressions.
4424 enum FunctionVariableInfo { 4436 enum FunctionVariableInfo {
4425 NONE, // No function name present. 4437 NONE, // No function name present.
4426 STACK, // Function 4438 STACK, // Function
4427 CONTEXT, 4439 CONTEXT,
4428 UNUSED 4440 UNUSED
4429 }; 4441 };
4430 4442
(...skipping 6561 matching lines...) Expand 10 before | Expand all | Expand 10 after
10992 } else { 11004 } else {
10993 value &= ~(1 << bit_position); 11005 value &= ~(1 << bit_position);
10994 } 11006 }
10995 return value; 11007 return value;
10996 } 11008 }
10997 }; 11009 };
10998 11010
10999 } } // namespace v8::internal 11011 } } // namespace v8::internal
11000 11012
11001 #endif // V8_OBJECTS_H_ 11013 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698