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

Side by Side Diff: src/scopes.cc

Issue 582703002: Widen the intake valve for TurboFan. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/scopes.h ('k') | no next file » | 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/scopes.h" 7 #include "src/scopes.h"
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 scope_type_ = scope_type; 153 scope_type_ = scope_type;
154 scope_name_ = ast_value_factory_->empty_string(); 154 scope_name_ = ast_value_factory_->empty_string();
155 dynamics_ = NULL; 155 dynamics_ = NULL;
156 receiver_ = NULL; 156 receiver_ = NULL;
157 function_ = NULL; 157 function_ = NULL;
158 arguments_ = NULL; 158 arguments_ = NULL;
159 illegal_redecl_ = NULL; 159 illegal_redecl_ = NULL;
160 scope_inside_with_ = false; 160 scope_inside_with_ = false;
161 scope_contains_with_ = false; 161 scope_contains_with_ = false;
162 scope_calls_eval_ = false; 162 scope_calls_eval_ = false;
163 asm_module_ = false;
164 asm_function_ = outer_scope != NULL && outer_scope->asm_module_;
163 // Inherit the strict mode from the parent scope. 165 // Inherit the strict mode from the parent scope.
164 strict_mode_ = outer_scope != NULL ? outer_scope->strict_mode_ : SLOPPY; 166 strict_mode_ = outer_scope != NULL ? outer_scope->strict_mode_ : SLOPPY;
165 outer_scope_calls_sloppy_eval_ = false; 167 outer_scope_calls_sloppy_eval_ = false;
166 inner_scope_calls_eval_ = false; 168 inner_scope_calls_eval_ = false;
167 force_eager_compilation_ = false; 169 force_eager_compilation_ = false;
168 force_context_allocation_ = (outer_scope != NULL && !is_function_scope()) 170 force_context_allocation_ = (outer_scope != NULL && !is_function_scope())
169 ? outer_scope->has_forced_context_allocation() : false; 171 ? outer_scope->has_forced_context_allocation() : false;
170 num_var_or_const_ = 0; 172 num_var_or_const_ = 0;
171 num_stack_slots_ = 0; 173 num_stack_slots_ = 0;
172 num_heap_slots_ = 0; 174 num_heap_slots_ = 0;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 Handle<ScopeInfo>(scope_info), 217 Handle<ScopeInfo>(scope_info),
216 global_scope->ast_value_factory_, 218 global_scope->ast_value_factory_,
217 zone); 219 zone);
218 } else if (context->IsFunctionContext()) { 220 } else if (context->IsFunctionContext()) {
219 ScopeInfo* scope_info = context->closure()->shared()->scope_info(); 221 ScopeInfo* scope_info = context->closure()->shared()->scope_info();
220 current_scope = new(zone) Scope(current_scope, 222 current_scope = new(zone) Scope(current_scope,
221 FUNCTION_SCOPE, 223 FUNCTION_SCOPE,
222 Handle<ScopeInfo>(scope_info), 224 Handle<ScopeInfo>(scope_info),
223 global_scope->ast_value_factory_, 225 global_scope->ast_value_factory_,
224 zone); 226 zone);
227 if (scope_info->IsAsmFunction()) current_scope->asm_function_ = true;
228 if (scope_info->IsAsmModule()) current_scope->asm_module_ = true;
225 } else if (context->IsBlockContext()) { 229 } else if (context->IsBlockContext()) {
226 ScopeInfo* scope_info = ScopeInfo::cast(context->extension()); 230 ScopeInfo* scope_info = ScopeInfo::cast(context->extension());
227 current_scope = new(zone) Scope(current_scope, 231 current_scope = new(zone) Scope(current_scope,
228 BLOCK_SCOPE, 232 BLOCK_SCOPE,
229 Handle<ScopeInfo>(scope_info), 233 Handle<ScopeInfo>(scope_info),
230 global_scope->ast_value_factory_, 234 global_scope->ast_value_factory_,
231 zone); 235 zone);
232 } else { 236 } else {
233 DCHECK(context->IsCatchContext()); 237 DCHECK(context->IsCatchContext());
234 String* name = String::cast(context->extension()); 238 String* name = String::cast(context->extension());
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 this->calls_sloppy_eval() || outer_scope_calls_sloppy_eval_; 1162 this->calls_sloppy_eval() || outer_scope_calls_sloppy_eval_;
1159 for (int i = 0; i < inner_scopes_.length(); i++) { 1163 for (int i = 0; i < inner_scopes_.length(); i++) {
1160 Scope* inner = inner_scopes_[i]; 1164 Scope* inner = inner_scopes_[i];
1161 inner->PropagateScopeInfo(calls_sloppy_eval); 1165 inner->PropagateScopeInfo(calls_sloppy_eval);
1162 if (inner->scope_calls_eval_ || inner->inner_scope_calls_eval_) { 1166 if (inner->scope_calls_eval_ || inner->inner_scope_calls_eval_) {
1163 inner_scope_calls_eval_ = true; 1167 inner_scope_calls_eval_ = true;
1164 } 1168 }
1165 if (inner->force_eager_compilation_) { 1169 if (inner->force_eager_compilation_) {
1166 force_eager_compilation_ = true; 1170 force_eager_compilation_ = true;
1167 } 1171 }
1172 if (asm_module_ && inner->scope_type() == FUNCTION_SCOPE) {
1173 inner->asm_function_ = true;
1174 }
1168 } 1175 }
1169 } 1176 }
1170 1177
1171 1178
1172 bool Scope::MustAllocate(Variable* var) { 1179 bool Scope::MustAllocate(Variable* var) {
1173 // Give var a read/write use if there is a chance it might be accessed 1180 // Give var a read/write use if there is a chance it might be accessed
1174 // via an eval() call. This is only possible if the variable has a 1181 // via an eval() call. This is only possible if the variable has a
1175 // visible name. 1182 // visible name.
1176 if ((var->is_this() || !var->raw_name()->IsEmpty()) && 1183 if ((var->is_this() || !var->raw_name()->IsEmpty()) &&
1177 (var->has_forced_context_allocation() || 1184 (var->has_forced_context_allocation() ||
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 } 1402 }
1396 1403
1397 1404
1398 int Scope::ContextLocalCount() const { 1405 int Scope::ContextLocalCount() const {
1399 if (num_heap_slots() == 0) return 0; 1406 if (num_heap_slots() == 0) return 0;
1400 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1407 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1401 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); 1408 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0);
1402 } 1409 }
1403 1410
1404 } } // namespace v8::internal 1411 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/scopes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698