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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2447783002: [ignition] Use more-targeted check for CONST-this-initialization hole check (Closed)
Patch Set: Fix the interpreter instead of the parser Created 4 years, 1 month 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 | « no previous file | test/mjsunit/regress/regress-crbug-658528.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-info.h" 10 #include "src/compilation-info.h"
(...skipping 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 builder() 1938 builder()
1939 ->JumpIfNotHole(&reference_error) 1939 ->JumpIfNotHole(&reference_error)
1940 .Jump(&no_reference_error) 1940 .Jump(&no_reference_error)
1941 .Bind(&reference_error); 1941 .Bind(&reference_error);
1942 BuildThrowReferenceError(name); 1942 BuildThrowReferenceError(name);
1943 builder()->Bind(&no_reference_error); 1943 builder()->Bind(&no_reference_error);
1944 } 1944 }
1945 1945
1946 void BytecodeGenerator::BuildHoleCheckForVariableAssignment(Variable* variable, 1946 void BytecodeGenerator::BuildHoleCheckForVariableAssignment(Variable* variable,
1947 Token::Value op) { 1947 Token::Value op) {
1948 if (op != Token::INIT) { 1948 if (variable->is_this() && variable->mode() == CONST && op == Token::INIT) {
1949 // Perform an initialization check for let/const declared variables.
1950 // E.g. let x = (x = 20); is not allowed.
1951 BuildThrowIfHole(variable->name());
1952 } else {
1953 DCHECK(variable->is_this() && variable->mode() == CONST &&
1954 op == Token::INIT);
1955 // Perform an initialization check for 'this'. 'this' variable is the 1949 // Perform an initialization check for 'this'. 'this' variable is the
1956 // only variable able to trigger bind operations outside the TDZ 1950 // only variable able to trigger bind operations outside the TDZ
1957 // via 'super' calls. 1951 // via 'super' calls.
1958 BuildThrowIfNotHole(variable->name()); 1952 BuildThrowIfNotHole(variable->name());
1953 } else {
1954 // Perform an initialization check for let/const declared variables.
1955 // E.g. let x = (x = 20); is not allowed.
1956 DCHECK(IsLexicalVariableMode(variable->mode()));
1957 BuildThrowIfHole(variable->name());
1959 } 1958 }
1960 } 1959 }
1961 1960
1962 void BytecodeGenerator::BuildVariableAssignment(Variable* variable, 1961 void BytecodeGenerator::BuildVariableAssignment(Variable* variable,
1963 Token::Value op, 1962 Token::Value op,
1964 FeedbackVectorSlot slot, 1963 FeedbackVectorSlot slot,
1965 HoleCheckMode hole_check_mode) { 1964 HoleCheckMode hole_check_mode) {
1966 VariableMode mode = variable->mode(); 1965 VariableMode mode = variable->mode();
1967 RegisterAllocationScope assignment_register_scope(this); 1966 RegisterAllocationScope assignment_register_scope(this);
1968 BytecodeLabel end_label; 1967 BytecodeLabel end_label;
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
3204 } 3203 }
3205 3204
3206 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3205 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3207 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3206 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3208 : Runtime::kStoreKeyedToSuper_Sloppy; 3207 : Runtime::kStoreKeyedToSuper_Sloppy;
3209 } 3208 }
3210 3209
3211 } // namespace interpreter 3210 } // namespace interpreter
3212 } // namespace internal 3211 } // namespace internal
3213 } // namespace v8 3212 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-658528.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698