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

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

Issue 2398023002: [wasm] asm.js - Parse and convert asm.js to wasm a function at a time. (Closed)
Patch Set: git cl try Created 4 years 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 | « src/ast/scopes.h ('k') | src/compiler.cc » ('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 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/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 DCHECK_EQ(outer_scope_info->scope_type(), SCRIPT_SCOPE); 535 DCHECK_EQ(outer_scope_info->scope_type(), SCRIPT_SCOPE);
536 scope->SetScriptScopeInfo(outer_scope_info); 536 scope->SetScriptScopeInfo(outer_scope_info);
537 } 537 }
538 } 538 }
539 539
540 if (scope->is_eval_scope() && is_sloppy(scope->language_mode())) { 540 if (scope->is_eval_scope() && is_sloppy(scope->language_mode())) {
541 AstNodeFactory factory(info->ast_value_factory()); 541 AstNodeFactory factory(info->ast_value_factory());
542 scope->HoistSloppyBlockFunctions(&factory); 542 scope->HoistSloppyBlockFunctions(&factory);
543 } 543 }
544 544
545 // We are compiling one of three cases: 545 // We are compiling one of four cases:
546 // 1) top-level code, 546 // 1) top-level code,
547 // 2) a function/eval/module on the top-level 547 // 2) a function/eval/module on the top-level
548 // 3) a function/eval in a scope that was already resolved. 548 // 3) a function/eval in a scope that was already resolved.
549 // 4) an asm.js function
549 DCHECK(scope->scope_type() == SCRIPT_SCOPE || 550 DCHECK(scope->scope_type() == SCRIPT_SCOPE ||
550 scope->outer_scope()->scope_type() == SCRIPT_SCOPE || 551 scope->outer_scope()->scope_type() == SCRIPT_SCOPE ||
551 scope->outer_scope()->already_resolved_); 552 scope->outer_scope()->already_resolved_ ||
553 (info->asm_function_scope() && scope->scope_type() == FUNCTION_SCOPE));
552 554
553 // The outer scope is never lazy. 555 // The outer scope is never lazy.
554 scope->set_should_eager_compile(); 556 scope->set_should_eager_compile();
555 557
556 scope->AllocateVariables(info, mode); 558 scope->AllocateVariables(info, mode);
557 559
558 // Ensuring that the outer script scope has a scope info avoids having 560 // Ensuring that the outer script scope has a scope info avoids having
559 // special case for native contexts vs other contexts. 561 // special case for native contexts vs other contexts.
560 if (info->script_scope()->scope_info_.is_null()) { 562 if (info->script_scope()->scope_info_.is_null()) {
561 info->script_scope()->scope_info_ = 563 info->script_scope()->scope_info_ =
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 return var; 1001 return var;
1000 } 1002 }
1001 1003
1002 VariableProxy* Scope::NewUnresolved(AstNodeFactory* factory, 1004 VariableProxy* Scope::NewUnresolved(AstNodeFactory* factory,
1003 const AstRawString* name, 1005 const AstRawString* name,
1004 int start_position, VariableKind kind) { 1006 int start_position, VariableKind kind) {
1005 // Note that we must not share the unresolved variables with 1007 // Note that we must not share the unresolved variables with
1006 // the same name because they may be removed selectively via 1008 // the same name because they may be removed selectively via
1007 // RemoveUnresolved(). 1009 // RemoveUnresolved().
1008 DCHECK(!already_resolved_); 1010 DCHECK(!already_resolved_);
1009 DCHECK_EQ(factory->zone(), zone()); 1011 DCHECK(factory->zone() == zone() || outer_scope()->IsAsmFunction());
marja 2016/11/29 07:39:46 I think this DCHECK should be left as is and you s
bradn 2016/11/29 09:54:09 Done.
1010 VariableProxy* proxy = factory->NewVariableProxy(name, kind, start_position); 1012 VariableProxy* proxy = factory->NewVariableProxy(name, kind, start_position);
1011 proxy->set_next_unresolved(unresolved_); 1013 proxy->set_next_unresolved(unresolved_);
1012 unresolved_ = proxy; 1014 unresolved_ = proxy;
1013 return proxy; 1015 return proxy;
1014 } 1016 }
1015 1017
1016 void Scope::AddUnresolved(VariableProxy* proxy) { 1018 void Scope::AddUnresolved(VariableProxy* proxy) {
1017 DCHECK(!already_resolved_); 1019 DCHECK(!already_resolved_);
1018 DCHECK(!proxy->is_resolved()); 1020 DCHECK(!proxy->is_resolved());
1019 proxy->set_next_unresolved(unresolved_); 1021 proxy->set_next_unresolved(unresolved_);
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 Variable* function = 2073 Variable* function =
2072 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 2074 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
2073 bool is_function_var_in_context = 2075 bool is_function_var_in_context =
2074 function != nullptr && function->IsContextSlot(); 2076 function != nullptr && function->IsContextSlot();
2075 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 2077 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
2076 (is_function_var_in_context ? 1 : 0); 2078 (is_function_var_in_context ? 1 : 0);
2077 } 2079 }
2078 2080
2079 } // namespace internal 2081 } // namespace internal
2080 } // namespace v8 2082 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698