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

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: Fix polarity of async function rejections 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
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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 889
890 void FullCodeGenerator::EmitContinue(Statement* target) { 890 void FullCodeGenerator::EmitContinue(Statement* target) {
891 NestedStatement* current = nesting_stack_; 891 NestedStatement* current = nesting_stack_;
892 int context_length = 0; 892 int context_length = 0;
893 // When continuing, we clobber the unpredictable value in the accumulator 893 // When continuing, we clobber the unpredictable value in the accumulator
894 // with one that's safe for GC. If we hit an exit from the try block of 894 // with one that's safe for GC. If we hit an exit from the try block of
895 // try...finally on our way out, we will unconditionally preserve the 895 // try...finally on our way out, we will unconditionally preserve the
896 // accumulator on the stack. 896 // accumulator on the stack.
897 ClearAccumulator(); 897 ClearAccumulator();
898 while (!current->IsContinueTarget(target)) { 898 while (!current->IsContinueTarget(target)) {
899 if (HasStackOverflow()) return;
899 if (current->IsTryFinally()) { 900 if (current->IsTryFinally()) {
900 Comment cmnt(masm(), "[ Deferred continue through finally"); 901 Comment cmnt(masm(), "[ Deferred continue through finally");
901 current->Exit(&context_length); 902 current->Exit(&context_length);
902 DCHECK_EQ(-1, context_length); 903 DCHECK_EQ(-1, context_length);
903 current->AsTryFinally()->deferred_commands()->RecordContinue(target); 904 current->AsTryFinally()->deferred_commands()->RecordContinue(target);
904 return; 905 return;
905 } 906 }
906 current = current->Exit(&context_length); 907 current = current->Exit(&context_length);
907 } 908 }
908 int stack_depth = current->GetStackDepthAtTarget(); 909 int stack_depth = current->GetStackDepthAtTarget();
(...skipping 20 matching lines...) Expand all
929 930
930 void FullCodeGenerator::EmitBreak(Statement* target) { 931 void FullCodeGenerator::EmitBreak(Statement* target) {
931 NestedStatement* current = nesting_stack_; 932 NestedStatement* current = nesting_stack_;
932 int context_length = 0; 933 int context_length = 0;
933 // When breaking, we clobber the unpredictable value in the accumulator 934 // When breaking, we clobber the unpredictable value in the accumulator
934 // with one that's safe for GC. If we hit an exit from the try block of 935 // with one that's safe for GC. If we hit an exit from the try block of
935 // try...finally on our way out, we will unconditionally preserve the 936 // try...finally on our way out, we will unconditionally preserve the
936 // accumulator on the stack. 937 // accumulator on the stack.
937 ClearAccumulator(); 938 ClearAccumulator();
938 while (!current->IsBreakTarget(target)) { 939 while (!current->IsBreakTarget(target)) {
940 if (HasStackOverflow()) return;
939 if (current->IsTryFinally()) { 941 if (current->IsTryFinally()) {
940 Comment cmnt(masm(), "[ Deferred break through finally"); 942 Comment cmnt(masm(), "[ Deferred break through finally");
941 current->Exit(&context_length); 943 current->Exit(&context_length);
942 DCHECK_EQ(-1, context_length); 944 DCHECK_EQ(-1, context_length);
943 current->AsTryFinally()->deferred_commands()->RecordBreak(target); 945 current->AsTryFinally()->deferred_commands()->RecordBreak(target);
944 return; 946 return;
945 } 947 }
946 current = current->Exit(&context_length); 948 current = current->Exit(&context_length);
947 } 949 }
948 int stack_depth = current->GetStackDepthAtTarget(); 950 int stack_depth = current->GetStackDepthAtTarget();
(...skipping 15 matching lines...) Expand all
964 void FullCodeGenerator::VisitBreakStatement(BreakStatement* stmt) { 966 void FullCodeGenerator::VisitBreakStatement(BreakStatement* stmt) {
965 Comment cmnt(masm_, "[ BreakStatement"); 967 Comment cmnt(masm_, "[ BreakStatement");
966 SetStatementPosition(stmt); 968 SetStatementPosition(stmt);
967 EmitBreak(stmt->target()); 969 EmitBreak(stmt->target());
968 } 970 }
969 971
970 void FullCodeGenerator::EmitUnwindAndReturn() { 972 void FullCodeGenerator::EmitUnwindAndReturn() {
971 NestedStatement* current = nesting_stack_; 973 NestedStatement* current = nesting_stack_;
972 int context_length = 0; 974 int context_length = 0;
973 while (current != NULL) { 975 while (current != NULL) {
976 if (HasStackOverflow()) return;
974 if (current->IsTryFinally()) { 977 if (current->IsTryFinally()) {
975 Comment cmnt(masm(), "[ Deferred return through finally"); 978 Comment cmnt(masm(), "[ Deferred return through finally");
976 current->Exit(&context_length); 979 current->Exit(&context_length);
977 DCHECK_EQ(-1, context_length); 980 DCHECK_EQ(-1, context_length);
978 current->AsTryFinally()->deferred_commands()->RecordReturn(); 981 current->AsTryFinally()->deferred_commands()->RecordReturn();
979 return; 982 return;
980 } 983 }
981 current = current->Exit(&context_length); 984 current = current->Exit(&context_length);
982 } 985 }
983 EmitReturnSequence(); 986 EmitReturnSequence();
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 return var->scope()->is_nonlinear() || 1941 return var->scope()->is_nonlinear() ||
1939 var->initializer_position() >= proxy->position(); 1942 var->initializer_position() >= proxy->position();
1940 } 1943 }
1941 1944
1942 1945
1943 #undef __ 1946 #undef __
1944 1947
1945 1948
1946 } // namespace internal 1949 } // namespace internal
1947 } // namespace v8 1950 } // namespace v8
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/js/harmony-async-await.js » ('j') | src/js/harmony-async-await.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698