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 4288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
4309 // Lookup support for serialized scope info. Returns the | 4311 // Lookup support for serialized scope info. Returns the |
4310 // the stack slot index for a given slot name if the slot is | 4312 // 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 | 4313 // present; otherwise returns a value < 0. The name must be an internalized |
4312 // string. | 4314 // string. |
4313 int StackSlotIndex(String* name); | 4315 int StackSlotIndex(String* name); |
4314 | 4316 |
4315 // Lookup support for serialized scope info. Returns the | 4317 // Lookup support for serialized scope info. Returns the |
4316 // context slot index for a given slot name if the slot is present; otherwise | 4318 // 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. | 4319 // 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 | 4320 // 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 Loading... |
4351 #endif | 4353 #endif |
4352 | 4354 |
4353 // The layout of the static part of a ScopeInfo is as follows. Each entry is | 4355 // The layout of the static part of a ScopeInfo is as follows. Each entry is |
4354 // numeric and occupies one array slot. | 4356 // numeric and occupies one array slot. |
4355 // 1. A set of properties of the scope | 4357 // 1. A set of properties of the scope |
4356 // 2. The number of parameters. This only applies to function scopes. For | 4358 // 2. The number of parameters. This only applies to function scopes. For |
4357 // non-function scopes this is 0. | 4359 // non-function scopes this is 0. |
4358 // 3. The number of non-parameter variables allocated on the stack. | 4360 // 3. The number of non-parameter variables allocated on the stack. |
4359 // 4. The number of non-parameter and parameter variables allocated in the | 4361 // 4. The number of non-parameter and parameter variables allocated in the |
4360 // context. | 4362 // context. |
4361 #define FOR_EACH_NUMERIC_FIELD(V) \ | 4363 #define FOR_EACH_NUMERIC_FIELD(V) \ |
4362 V(Flags) \ | 4364 V(Flags) \ |
4363 V(ParameterCount) \ | 4365 V(ParameterCount) \ |
4364 V(StackLocalCount) \ | 4366 V(StackLocalCount) \ |
4365 V(ContextLocalCount) | 4367 V(ContextLocalCount) \ |
| 4368 V(StrongModeFreeVariableCount) |
4366 | 4369 |
4367 #define FIELD_ACCESSORS(name) \ | 4370 #define FIELD_ACCESSORS(name) \ |
4368 void Set##name(int value) { \ | 4371 void Set##name(int value) { \ |
4369 set(k##name, Smi::FromInt(value)); \ | 4372 set(k##name, Smi::FromInt(value)); \ |
4370 } \ | 4373 } \ |
4371 int name() { \ | 4374 int name() { \ |
4372 if (length() > 0) { \ | 4375 if (length() > 0) { \ |
4373 return Smi::cast(get(k##name))->value(); \ | 4376 return Smi::cast(get(k##name))->value(); \ |
4374 } else { \ | 4377 } else { \ |
4375 return 0; \ | 4378 return 0; \ |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4407 // 4. ContextLocalInfoEntries: | 4410 // 4. ContextLocalInfoEntries: |
4408 // Contains the variable modes and initialization flags corresponding to | 4411 // Contains the variable modes and initialization flags corresponding to |
4409 // the context locals in ContextLocalNameEntries. One slot is used per | 4412 // the context locals in ContextLocalNameEntries. One slot is used per |
4410 // context local, so in total this part occupies ContextLocalCount() | 4413 // context local, so in total this part occupies ContextLocalCount() |
4411 // slots in the array. | 4414 // slots in the array. |
4412 // 5. FunctionNameEntryIndex: | 4415 // 5. FunctionNameEntryIndex: |
4413 // If the scope belongs to a named function expression this part contains | 4416 // If the scope belongs to a named function expression this part contains |
4414 // information about the function variable. It always occupies two array | 4417 // information about the function variable. It always occupies two array |
4415 // slots: a. The name of the function variable. | 4418 // slots: a. The name of the function variable. |
4416 // b. The context or stack slot index for the variable. | 4419 // b. The context or stack slot index for the variable. |
| 4420 // FIXME: update the comment |
4417 int ParameterEntriesIndex(); | 4421 int ParameterEntriesIndex(); |
4418 int StackLocalEntriesIndex(); | 4422 int StackLocalEntriesIndex(); |
4419 int ContextLocalNameEntriesIndex(); | 4423 int ContextLocalNameEntriesIndex(); |
4420 int ContextLocalInfoEntriesIndex(); | 4424 int ContextLocalInfoEntriesIndex(); |
| 4425 int StrongModeFreeVariableEntriesIndex(); |
4421 int FunctionNameEntryIndex(); | 4426 int FunctionNameEntryIndex(); |
4422 | 4427 |
4423 // Location of the function variable for named function expressions. | 4428 // Location of the function variable for named function expressions. |
4424 enum FunctionVariableInfo { | 4429 enum FunctionVariableInfo { |
4425 NONE, // No function name present. | 4430 NONE, // No function name present. |
4426 STACK, // Function | 4431 STACK, // Function |
4427 CONTEXT, | 4432 CONTEXT, |
4428 UNUSED | 4433 UNUSED |
4429 }; | 4434 }; |
4430 | 4435 |
(...skipping 6561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10992 } else { | 10997 } else { |
10993 value &= ~(1 << bit_position); | 10998 value &= ~(1 << bit_position); |
10994 } | 10999 } |
10995 return value; | 11000 return value; |
10996 } | 11001 } |
10997 }; | 11002 }; |
10998 | 11003 |
10999 } } // namespace v8::internal | 11004 } } // namespace v8::internal |
11000 | 11005 |
11001 #endif // V8_OBJECTS_H_ | 11006 #endif // V8_OBJECTS_H_ |
OLD | NEW |