Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index d6cbd4c44190eb4b3fc273b9728849816e2f6f90..9aec541d7e04b901cb0822e0dc872ed5d0012170 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -4269,6 +4269,13 @@ class ScopeInfo : public FixedArray { |
// no contexts are allocated for this scope ContextLength returns 0. |
int ContextLength(); |
+ // Does this scope declare a "this" binding? |
+ bool HasReceiver(); |
+ |
+ // Does this scope declare a "this" binding, and the "this" binding is stack- |
+ // or context-allocated? |
+ bool HasAllocatedReceiver(); |
+ |
// Is this scope the scope of a named function expression? |
bool HasFunctionName(); |
@@ -4349,6 +4356,11 @@ class ScopeInfo : public FixedArray { |
// must be an internalized string. |
int FunctionContextSlotIndex(String* name, VariableMode* mode); |
+ // Lookup support for serialized scope info. Returns the receiver context |
+ // slot index if scope has a "this" binding, and the binding is |
+ // context-allocated. Otherwise returns a value < 0. |
+ int ReceiverContextSlotIndex(); |
+ |
bool block_scope_is_class_scope(); |
FunctionKind function_kind(); |
@@ -4436,7 +4448,10 @@ class ScopeInfo : public FixedArray { |
// 7. StrongModeFreeVariablePositionEntries: |
// Stores the locations (start and end position) of strong mode free |
// variables. |
- // 8. FunctionNameEntryIndex: |
+ // 8. RecieverEntryIndex: |
+ // If the scope binds a "this" value, one slot is reserved to hold the |
+ // context or stack slot index for the variable. |
+ // 9. FunctionNameEntryIndex: |
// If the scope belongs to a named function expression this part contains |
// information about the function variable. It always occupies two array |
// slots: a. The name of the function variable. |
@@ -4448,25 +4463,29 @@ class ScopeInfo : public FixedArray { |
int ContextLocalInfoEntriesIndex(); |
int StrongModeFreeVariableNameEntriesIndex(); |
int StrongModeFreeVariablePositionEntriesIndex(); |
+ int ReceiverEntryIndex(); |
int FunctionNameEntryIndex(); |
- // Location of the function variable for named function expressions. |
- enum FunctionVariableInfo { |
- NONE, // No function name present. |
- STACK, // Function |
- CONTEXT, |
- UNUSED |
- }; |
+ // Used for the function name variable for named function expressions, and for |
+ // the receiver. |
+ enum VariableAllocationInfo { NONE, STACK, CONTEXT, UNUSED }; |
// Properties of scopes. |
class ScopeTypeField : public BitField<ScopeType, 0, 4> {}; |
- class CallsEvalField : public BitField<bool, 4, 1> {}; |
+ class CallsEvalField : public BitField<bool, ScopeTypeField::kNext, 1> {}; |
STATIC_ASSERT(LANGUAGE_END == 3); |
- class LanguageModeField : public BitField<LanguageMode, 5, 2> {}; |
- class FunctionVariableField : public BitField<FunctionVariableInfo, 7, 2> {}; |
- class FunctionVariableMode : public BitField<VariableMode, 9, 3> {}; |
- class AsmModuleField : public BitField<bool, 12, 1> {}; |
- class AsmFunctionField : public BitField<bool, 13, 1> {}; |
+ class LanguageModeField |
+ : public BitField<LanguageMode, CallsEvalField::kNext, 2> {}; |
+ class ReceiverVariableField |
+ : public BitField<VariableAllocationInfo, LanguageModeField::kNext, 2> {}; |
+ class FunctionVariableField |
+ : public BitField<VariableAllocationInfo, ReceiverVariableField::kNext, |
+ 2> {}; |
+ class FunctionVariableMode |
+ : public BitField<VariableMode, FunctionVariableField::kNext, 3> {}; |
+ class AsmModuleField : public BitField<bool, FunctionVariableMode::kNext, 1> { |
+ }; |
+ class AsmFunctionField : public BitField<bool, AsmModuleField::kNext, 1> {}; |
class IsSimpleParameterListField |
: public BitField<bool, AsmFunctionField::kNext, 1> {}; |
class BlockScopeIsClassScopeField |