Commit 4fb60b21 authored by marja's avatar marja Committed by Commit bot

objects.h splitting side work: move scopeinfo.cc to its logical place.

src/ast/scopeinfo.cc -> src/objects/scope-info.cc

BUG=v8:5402

Review-Url: https://codereview.chromium.org/2637793002
Cr-Commit-Position: refs/heads/master@{#42357}
parent c4a35ed7
......@@ -948,7 +948,6 @@ v8_source_set("v8_base") {
"src/ast/modules.h",
"src/ast/prettyprinter.cc",
"src/ast/prettyprinter.h",
"src/ast/scopeinfo.cc",
"src/ast/scopes.cc",
"src/ast/scopes.h",
"src/ast/variables.cc",
......@@ -1570,6 +1569,7 @@ v8_source_set("v8_base") {
"src/objects/module-info.h",
"src/objects/object-macros-undef.h",
"src/objects/object-macros.h",
"src/objects/scope-info.cc",
"src/objects/scope-info.h",
"src/ostreams.cc",
"src/ostreams.h",
......
......@@ -396,37 +396,28 @@ Handle<ScopeInfo> ScopeInfo::CreateGlobalThisBinding(Isolate* isolate) {
return scope_info;
}
ScopeInfo* ScopeInfo::Empty(Isolate* isolate) {
return isolate->heap()->empty_scope_info();
}
ScopeType ScopeInfo::scope_type() {
DCHECK_LT(0, length());
return ScopeTypeField::decode(Flags());
}
bool ScopeInfo::CallsEval() {
return length() > 0 && CallsEvalField::decode(Flags());
}
LanguageMode ScopeInfo::language_mode() {
return length() > 0 ? LanguageModeField::decode(Flags()) : SLOPPY;
}
bool ScopeInfo::is_declaration_scope() {
return DeclarationScopeField::decode(Flags());
}
int ScopeInfo::LocalCount() {
return StackLocalCount() + ContextLocalCount();
}
int ScopeInfo::LocalCount() { return StackLocalCount() + ContextLocalCount(); }
int ScopeInfo::StackSlotCount() {
if (length() > 0) {
......@@ -437,7 +428,6 @@ int ScopeInfo::StackSlotCount() {
return 0;
}
int ScopeInfo::ContextLength() {
if (length() > 0) {
int context_locals = ContextLocalCount();
......@@ -459,7 +449,6 @@ int ScopeInfo::ContextLength() {
return 0;
}
bool ScopeInfo::HasReceiver() {
if (length() > 0) {
return NONE != ReceiverVariableField::decode(Flags());
......@@ -468,7 +457,6 @@ bool ScopeInfo::HasReceiver() {
}
}
bool ScopeInfo::HasAllocatedReceiver() {
if (length() > 0) {
VariableAllocationInfo allocation = ReceiverVariableField::decode(Flags());
......@@ -478,10 +466,8 @@ bool ScopeInfo::HasAllocatedReceiver() {
}
}
bool ScopeInfo::HasNewTarget() { return HasNewTargetField::decode(Flags()); }
bool ScopeInfo::HasFunctionName() {
if (length() > 0) {
return NONE != FunctionVariableField::decode(Flags());
......@@ -523,11 +509,7 @@ bool ScopeInfo::HasHeapAllocatedLocals() {
}
}
bool ScopeInfo::HasContext() {
return ContextLength() > 0;
}
bool ScopeInfo::HasContext() { return ContextLength() > 0; }
String* ScopeInfo::FunctionName() {
DCHECK(HasFunctionName());
......@@ -551,7 +533,6 @@ String* ScopeInfo::ParameterName(int var) {
return String::cast(get(info_index));
}
String* ScopeInfo::LocalName(int var) {
DCHECK_LE(0, var);
DCHECK_LT(var, LocalCount());
......@@ -561,7 +542,6 @@ String* ScopeInfo::LocalName(int var) {
return String::cast(get(info_index));
}
String* ScopeInfo::StackLocalName(int var) {
DCHECK_LE(0, var);
DCHECK_LT(var, StackLocalCount());
......@@ -569,7 +549,6 @@ String* ScopeInfo::StackLocalName(int var) {
return String::cast(get(info_index));
}
int ScopeInfo::StackLocalIndex(int var) {
DCHECK_LE(0, var);
DCHECK_LT(var, StackLocalCount());
......@@ -577,7 +556,6 @@ int ScopeInfo::StackLocalIndex(int var) {
return first_slot_index + var;
}
String* ScopeInfo::ContextLocalName(int var) {
DCHECK_LE(0, var);
DCHECK_LT(var, ContextLocalCount());
......@@ -585,7 +563,6 @@ String* ScopeInfo::ContextLocalName(int var) {
return String::cast(get(info_index));
}
VariableMode ScopeInfo::ContextLocalMode(int var) {
DCHECK_LE(0, var);
DCHECK_LT(var, ContextLocalCount());
......@@ -594,7 +571,6 @@ VariableMode ScopeInfo::ContextLocalMode(int var) {
return VariableModeField::decode(value);
}
InitializationFlag ScopeInfo::ContextLocalInitFlag(int var) {
DCHECK_LE(0, var);
DCHECK_LT(var, ContextLocalCount());
......@@ -603,7 +579,6 @@ InitializationFlag ScopeInfo::ContextLocalInitFlag(int var) {
return InitFlagField::decode(value);
}
MaybeAssignedFlag ScopeInfo::ContextLocalMaybeAssignedFlag(int var) {
DCHECK_LE(0, var);
DCHECK_LT(var, ContextLocalCount());
......@@ -621,7 +596,6 @@ bool ScopeInfo::VariableIsSynthetic(String* name) {
name->Equals(name->GetHeap()->this_string());
}
int ScopeInfo::StackSlotIndex(String* name) {
DCHECK(name->IsInternalizedString());
if (length() > 0) {
......@@ -710,7 +684,6 @@ String* ScopeInfo::ContextSlotName(int slot_index) {
return ContextLocalName(var);
}
int ScopeInfo::ParameterIndex(String* name) {
DCHECK(name->IsInternalizedString());
if (length() > 0) {
......@@ -730,7 +703,6 @@ int ScopeInfo::ParameterIndex(String* name) {
return -1;
}
int ScopeInfo::ReceiverContextSlotIndex() {
if (length() > 0 && ReceiverVariableField::decode(Flags()) == CONTEXT)
return Smi::cast(get(ReceiverInfoIndex()))->value();
......@@ -748,7 +720,6 @@ int ScopeInfo::FunctionContextSlotIndex(String* name) {
return -1;
}
FunctionKind ScopeInfo::function_kind() {
return FunctionKindField::decode(Flags());
}
......@@ -758,7 +729,6 @@ int ScopeInfo::ParameterNamesIndex() {
return kVariablePartIndex;
}
int ScopeInfo::StackLocalFirstSlotIndex() {
return ParameterNamesIndex() + ParameterCount();
}
......@@ -824,15 +794,12 @@ void ScopeInfo::ModuleVariable(int i, String** name, int* index,
#ifdef DEBUG
static void PrintList(const char* list_name,
int nof_internal_slots,
int start,
int end,
ScopeInfo* scope_info) {
static void PrintList(const char* list_name, int nof_internal_slots, int start,
int end, ScopeInfo* scope_info) {
if (start < end) {
PrintF("\n // %s\n", list_name);
if (nof_internal_slots > 0) {
PrintF(" %2d - %2d [internal slots]\n", 0 , nof_internal_slots - 1);
PrintF(" %2d - %2d [internal slots]\n", 0, nof_internal_slots - 1);
}
for (int i = nof_internal_slots; start < end; ++i, ++start) {
PrintF(" %2d ", i);
......@@ -842,7 +809,6 @@ static void PrintList(const char* list_name,
}
}
void ScopeInfo::Print() {
PrintF("ScopeInfo ");
if (HasFunctionName()) {
......
......@@ -459,7 +459,6 @@
'ast/modules.h',
'ast/prettyprinter.cc',
'ast/prettyprinter.h',
'ast/scopeinfo.cc',
'ast/scopes.cc',
'ast/scopes.h',
'ast/variables.cc',
......@@ -1079,6 +1078,7 @@
'objects/module-info.h',
'objects/object-macros.h',
'objects/object-macros-undef.h',
'objects/scope-info.cc',
'objects/scope-info.h',
'ostreams.cc',
'ostreams.h',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment