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

Side by Side Diff: src/runtime/runtime-debug.cc

Issue 2902423002: Revert of Make non-Module generators only context allocate parameters. (Closed)
Patch Set: Created 3 years, 6 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/parsing/parser.cc ('k') | test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/debug/debug-coverage.h" 9 #include "src/debug/debug-coverage.h"
10 #include "src/debug/debug-evaluate.h" 10 #include "src/debug/debug-evaluate.h"
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 914
915 RUNTIME_FUNCTION(Runtime_GetGeneratorScopeCount) { 915 RUNTIME_FUNCTION(Runtime_GetGeneratorScopeCount) {
916 HandleScope scope(isolate); 916 HandleScope scope(isolate);
917 DCHECK_EQ(1, args.length()); 917 DCHECK_EQ(1, args.length());
918 918
919 if (!args[0]->IsJSGeneratorObject()) return Smi::kZero; 919 if (!args[0]->IsJSGeneratorObject()) return Smi::kZero;
920 920
921 // Check arguments. 921 // Check arguments.
922 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, gen, 0); 922 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, gen, 0);
923 923
924 // Only inspect suspended generator scopes.
925 if (!gen->is_suspended()) {
926 return Smi::kZero;
927 }
928
929 // Count the visible scopes. 924 // Count the visible scopes.
930 int n = 0; 925 int n = 0;
931 for (ScopeIterator it(isolate, gen); !it.Done(); it.Next()) { 926 for (ScopeIterator it(isolate, gen); !it.Done(); it.Next()) {
932 n++; 927 n++;
933 } 928 }
934 929
935 return Smi::FromInt(n); 930 return Smi::FromInt(n);
936 } 931 }
937 932
938 RUNTIME_FUNCTION(Runtime_GetGeneratorScopeDetails) { 933 RUNTIME_FUNCTION(Runtime_GetGeneratorScopeDetails) {
939 HandleScope scope(isolate); 934 HandleScope scope(isolate);
940 DCHECK_EQ(2, args.length()); 935 DCHECK_EQ(2, args.length());
941 936
942 if (!args[0]->IsJSGeneratorObject()) { 937 if (!args[0]->IsJSGeneratorObject()) {
943 return isolate->heap()->undefined_value(); 938 return isolate->heap()->undefined_value();
944 } 939 }
945 940
946 // Check arguments. 941 // Check arguments.
947 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, gen, 0); 942 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, gen, 0);
948 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); 943 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
949 944
950 // Only inspect suspended generator scopes.
951 if (!gen->is_suspended()) {
952 return isolate->heap()->undefined_value();
953 }
954
955 // Find the requested scope. 945 // Find the requested scope.
956 int n = 0; 946 int n = 0;
957 ScopeIterator it(isolate, gen); 947 ScopeIterator it(isolate, gen);
958 for (; !it.Done() && n < index; it.Next()) { 948 for (; !it.Done() && n < index; it.Next()) {
959 n++; 949 n++;
960 } 950 }
961 if (it.Done()) { 951 if (it.Done()) {
962 return isolate->heap()->undefined_value(); 952 return isolate->heap()->undefined_value();
963 } 953 }
964 954
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1970 RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) { 1960 RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) {
1971 SealHandleScope shs(isolate); 1961 SealHandleScope shs(isolate);
1972 CONVERT_BOOLEAN_ARG_CHECKED(enable, 0); 1962 CONVERT_BOOLEAN_ARG_CHECKED(enable, 0);
1973 Coverage::SelectMode(isolate, enable ? debug::Coverage::kPreciseCount 1963 Coverage::SelectMode(isolate, enable ? debug::Coverage::kPreciseCount
1974 : debug::Coverage::kBestEffort); 1964 : debug::Coverage::kBestEffort);
1975 return isolate->heap()->undefined_value(); 1965 return isolate->heap()->undefined_value();
1976 } 1966 }
1977 1967
1978 } // namespace internal 1968 } // namespace internal
1979 } // namespace v8 1969 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698