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

Side by Side Diff: src/full-codegen/full-codegen.cc

Issue 2233923003: Desugar async/await to create the resulting Promise upfront (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: format Created 4 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
« no previous file with comments | « src/contexts.h ('k') | src/js/harmony-async-await.js » ('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/full-codegen/full-codegen.h" 5 #include "src/full-codegen/full-codegen.h"
6 6
7 #include "src/ast/ast-numbering.h" 7 #include "src/ast/ast-numbering.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/prettyprinter.h" 9 #include "src/ast/prettyprinter.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 912
913 void FullCodeGenerator::EmitContinue(Statement* target) { 913 void FullCodeGenerator::EmitContinue(Statement* target) {
914 NestedStatement* current = nesting_stack_; 914 NestedStatement* current = nesting_stack_;
915 int context_length = 0; 915 int context_length = 0;
916 // When continuing, we clobber the unpredictable value in the accumulator 916 // When continuing, we clobber the unpredictable value in the accumulator
917 // with one that's safe for GC. If we hit an exit from the try block of 917 // with one that's safe for GC. If we hit an exit from the try block of
918 // try...finally on our way out, we will unconditionally preserve the 918 // try...finally on our way out, we will unconditionally preserve the
919 // accumulator on the stack. 919 // accumulator on the stack.
920 ClearAccumulator(); 920 ClearAccumulator();
921 while (!current->IsContinueTarget(target)) { 921 while (!current->IsContinueTarget(target)) {
922 if (HasStackOverflow()) return;
922 if (current->IsTryFinally()) { 923 if (current->IsTryFinally()) {
923 Comment cmnt(masm(), "[ Deferred continue through finally"); 924 Comment cmnt(masm(), "[ Deferred continue through finally");
924 current->Exit(&context_length); 925 current->Exit(&context_length);
925 DCHECK_EQ(-1, context_length); 926 DCHECK_EQ(-1, context_length);
926 current->AsTryFinally()->deferred_commands()->RecordContinue(target); 927 current->AsTryFinally()->deferred_commands()->RecordContinue(target);
927 return; 928 return;
928 } 929 }
929 current = current->Exit(&context_length); 930 current = current->Exit(&context_length);
930 } 931 }
931 int stack_depth = current->GetStackDepthAtTarget(); 932 int stack_depth = current->GetStackDepthAtTarget();
(...skipping 20 matching lines...) Expand all
952 953
953 void FullCodeGenerator::EmitBreak(Statement* target) { 954 void FullCodeGenerator::EmitBreak(Statement* target) {
954 NestedStatement* current = nesting_stack_; 955 NestedStatement* current = nesting_stack_;
955 int context_length = 0; 956 int context_length = 0;
956 // When breaking, we clobber the unpredictable value in the accumulator 957 // When breaking, we clobber the unpredictable value in the accumulator
957 // with one that's safe for GC. If we hit an exit from the try block of 958 // with one that's safe for GC. If we hit an exit from the try block of
958 // try...finally on our way out, we will unconditionally preserve the 959 // try...finally on our way out, we will unconditionally preserve the
959 // accumulator on the stack. 960 // accumulator on the stack.
960 ClearAccumulator(); 961 ClearAccumulator();
961 while (!current->IsBreakTarget(target)) { 962 while (!current->IsBreakTarget(target)) {
963 if (HasStackOverflow()) return;
962 if (current->IsTryFinally()) { 964 if (current->IsTryFinally()) {
963 Comment cmnt(masm(), "[ Deferred break through finally"); 965 Comment cmnt(masm(), "[ Deferred break through finally");
964 current->Exit(&context_length); 966 current->Exit(&context_length);
965 DCHECK_EQ(-1, context_length); 967 DCHECK_EQ(-1, context_length);
966 current->AsTryFinally()->deferred_commands()->RecordBreak(target); 968 current->AsTryFinally()->deferred_commands()->RecordBreak(target);
967 return; 969 return;
968 } 970 }
969 current = current->Exit(&context_length); 971 current = current->Exit(&context_length);
970 } 972 }
971 int stack_depth = current->GetStackDepthAtTarget(); 973 int stack_depth = current->GetStackDepthAtTarget();
(...skipping 15 matching lines...) Expand all
987 void FullCodeGenerator::VisitBreakStatement(BreakStatement* stmt) { 989 void FullCodeGenerator::VisitBreakStatement(BreakStatement* stmt) {
988 Comment cmnt(masm_, "[ BreakStatement"); 990 Comment cmnt(masm_, "[ BreakStatement");
989 SetStatementPosition(stmt); 991 SetStatementPosition(stmt);
990 EmitBreak(stmt->target()); 992 EmitBreak(stmt->target());
991 } 993 }
992 994
993 void FullCodeGenerator::EmitUnwindAndReturn() { 995 void FullCodeGenerator::EmitUnwindAndReturn() {
994 NestedStatement* current = nesting_stack_; 996 NestedStatement* current = nesting_stack_;
995 int context_length = 0; 997 int context_length = 0;
996 while (current != NULL) { 998 while (current != NULL) {
999 if (HasStackOverflow()) return;
997 if (current->IsTryFinally()) { 1000 if (current->IsTryFinally()) {
998 Comment cmnt(masm(), "[ Deferred return through finally"); 1001 Comment cmnt(masm(), "[ Deferred return through finally");
999 current->Exit(&context_length); 1002 current->Exit(&context_length);
1000 DCHECK_EQ(-1, context_length); 1003 DCHECK_EQ(-1, context_length);
1001 current->AsTryFinally()->deferred_commands()->RecordReturn(); 1004 current->AsTryFinally()->deferred_commands()->RecordReturn();
1002 return; 1005 return;
1003 } 1006 }
1004 current = current->Exit(&context_length); 1007 current = current->Exit(&context_length);
1005 } 1008 }
1006 EmitReturnSequence(); 1009 EmitReturnSequence();
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1961 return var->scope()->is_nonlinear() || 1964 return var->scope()->is_nonlinear() ||
1962 var->initializer_position() >= proxy->position(); 1965 var->initializer_position() >= proxy->position();
1963 } 1966 }
1964 1967
1965 1968
1966 #undef __ 1969 #undef __
1967 1970
1968 1971
1969 } // namespace internal 1972 } // namespace internal
1970 } // namespace v8 1973 } // namespace v8
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/js/harmony-async-await.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698