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

Side by Side Diff: src/ast/scopeinfo.cc

Issue 2253913002: Move asm_module_ and asm_function_ down to DeclarationScope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test Created 4 years, 4 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 | « no previous file | src/ast/scopes.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #include "src/ast/scopeinfo.h" 5 #include "src/ast/scopeinfo.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "src/ast/context-slot-cache.h" 9 #include "src/ast/context-slot-cache.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 const bool has_receiver = receiver_info == STACK || receiver_info == CONTEXT; 76 const bool has_receiver = receiver_info == STACK || receiver_info == CONTEXT;
77 const int parameter_count = scope->num_parameters(); 77 const int parameter_count = scope->num_parameters();
78 const int length = kVariablePartIndex + parameter_count + 78 const int length = kVariablePartIndex + parameter_count +
79 (1 + stack_local_count) + 2 * context_local_count + 79 (1 + stack_local_count) + 2 * context_local_count +
80 2 * context_global_count + 80 2 * context_global_count +
81 (has_receiver ? 1 : 0) + (has_function_name ? 2 : 0); 81 (has_receiver ? 1 : 0) + (has_function_name ? 2 : 0);
82 82
83 Factory* factory = isolate->factory(); 83 Factory* factory = isolate->factory();
84 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); 84 Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length);
85 85
86 bool has_simple_parameters = 86 bool has_simple_parameters = false;
87 scope->is_function_scope() && 87 bool asm_module = false;
88 scope->AsDeclarationScope()->has_simple_parameters(); 88 bool asm_function = false;
89 FunctionKind function_kind = 89 FunctionKind function_kind = kNormalFunction;
90 scope->is_declaration_scope() 90 if (scope->is_function_scope()) {
91 ? scope->AsDeclarationScope()->function_kind() 91 DeclarationScope* function_scope = scope->AsDeclarationScope();
92 : kNormalFunction; 92 has_simple_parameters = function_scope->has_simple_parameters();
93 asm_module = function_scope->asm_module();
94 asm_function = function_scope->asm_function();
95 function_kind = function_scope->function_kind();
96 }
93 97
94 // Encode the flags. 98 // Encode the flags.
95 int flags = ScopeTypeField::encode(scope->scope_type()) | 99 int flags = ScopeTypeField::encode(scope->scope_type()) |
96 CallsEvalField::encode(scope->calls_eval()) | 100 CallsEvalField::encode(scope->calls_eval()) |
97 LanguageModeField::encode(scope->language_mode()) | 101 LanguageModeField::encode(scope->language_mode()) |
98 DeclarationScopeField::encode(scope->is_declaration_scope()) | 102 DeclarationScopeField::encode(scope->is_declaration_scope()) |
99 ReceiverVariableField::encode(receiver_info) | 103 ReceiverVariableField::encode(receiver_info) |
100 HasNewTargetField::encode(has_new_target) | 104 HasNewTargetField::encode(has_new_target) |
101 FunctionVariableField::encode(function_name_info) | 105 FunctionVariableField::encode(function_name_info) |
102 FunctionVariableMode::encode(function_variable_mode) | 106 FunctionVariableMode::encode(function_variable_mode) |
103 AsmModuleField::encode(scope->asm_module()) | 107 AsmModuleField::encode(asm_module) |
104 AsmFunctionField::encode(scope->asm_function()) | 108 AsmFunctionField::encode(asm_function) |
105 HasSimpleParametersField::encode(has_simple_parameters) | 109 HasSimpleParametersField::encode(has_simple_parameters) |
106 FunctionKindField::encode(function_kind); 110 FunctionKindField::encode(function_kind);
107 scope_info->SetFlags(flags); 111 scope_info->SetFlags(flags);
108 scope_info->SetParameterCount(parameter_count); 112 scope_info->SetParameterCount(parameter_count);
109 scope_info->SetStackLocalCount(stack_local_count); 113 scope_info->SetStackLocalCount(stack_local_count);
110 scope_info->SetContextLocalCount(context_local_count); 114 scope_info->SetContextLocalCount(context_local_count);
111 scope_info->SetContextGlobalCount(context_global_count); 115 scope_info->SetContextGlobalCount(context_global_count);
112 116
113 int index = kVariablePartIndex; 117 int index = kVariablePartIndex;
114 // Add parameters. 118 // Add parameters.
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 ContextLocalNameEntriesIndex() + ContextLocalCount(), this); 695 ContextLocalNameEntriesIndex() + ContextLocalCount(), this);
692 } 696 }
693 697
694 PrintF("}\n"); 698 PrintF("}\n");
695 } 699 }
696 #endif // DEBUG 700 #endif // DEBUG
697 701
698 702
699 } // namespace internal 703 } // namespace internal
700 } // namespace v8 704 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/ast/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698