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

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

Issue 2495543002: [Interpreter] Fix logical-or/and to ensure it always visits the lhs. (Closed)
Patch Set: Cleanup test 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/ignition/regress-664146.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 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after
2832 Visit(binop->right()); 2832 Visit(binop->right());
2833 } 2833 }
2834 2834
2835 void BytecodeGenerator::VisitLogicalOrExpression(BinaryOperation* binop) { 2835 void BytecodeGenerator::VisitLogicalOrExpression(BinaryOperation* binop) {
2836 Expression* left = binop->left(); 2836 Expression* left = binop->left();
2837 Expression* right = binop->right(); 2837 Expression* right = binop->right();
2838 2838
2839 if (execution_result()->IsTest()) { 2839 if (execution_result()->IsTest()) {
2840 TestResultScope* test_result = execution_result()->AsTest(); 2840 TestResultScope* test_result = execution_result()->AsTest();
2841 2841
2842 if (left->ToBooleanIsTrue() || right->ToBooleanIsTrue()) { 2842 if (left->ToBooleanIsTrue()) {
2843 builder()->Jump(test_result->NewThenLabel()); 2843 builder()->Jump(test_result->NewThenLabel());
2844 } else if (left->ToBooleanIsFalse() && right->ToBooleanIsFalse()) { 2844 } else if (left->ToBooleanIsFalse() && right->ToBooleanIsFalse()) {
2845 builder()->Jump(test_result->NewElseLabel()); 2845 builder()->Jump(test_result->NewElseLabel());
2846 } else { 2846 } else {
2847 BytecodeLabels test_right(zone()); 2847 BytecodeLabels test_right(zone());
2848 VisitForTest(left, test_result->then_labels(), &test_right, 2848 VisitForTest(left, test_result->then_labels(), &test_right,
2849 TestFallthrough::kElse); 2849 TestFallthrough::kElse);
2850 test_right.Bind(builder()); 2850 test_right.Bind(builder());
2851 VisitForTest(right, test_result->then_labels(), 2851 VisitForTest(right, test_result->then_labels(),
2852 test_result->else_labels(), test_result->fallthrough()); 2852 test_result->else_labels(), test_result->fallthrough());
(...skipping 14 matching lines...) Expand all
2867 } 2867 }
2868 } 2868 }
2869 2869
2870 void BytecodeGenerator::VisitLogicalAndExpression(BinaryOperation* binop) { 2870 void BytecodeGenerator::VisitLogicalAndExpression(BinaryOperation* binop) {
2871 Expression* left = binop->left(); 2871 Expression* left = binop->left();
2872 Expression* right = binop->right(); 2872 Expression* right = binop->right();
2873 2873
2874 if (execution_result()->IsTest()) { 2874 if (execution_result()->IsTest()) {
2875 TestResultScope* test_result = execution_result()->AsTest(); 2875 TestResultScope* test_result = execution_result()->AsTest();
2876 2876
2877 if (left->ToBooleanIsFalse() || right->ToBooleanIsFalse()) { 2877 if (left->ToBooleanIsFalse()) {
2878 builder()->Jump(test_result->NewElseLabel()); 2878 builder()->Jump(test_result->NewElseLabel());
2879 } else if (left->ToBooleanIsTrue() && right->ToBooleanIsTrue()) { 2879 } else if (left->ToBooleanIsTrue() && right->ToBooleanIsTrue()) {
2880 builder()->Jump(test_result->NewThenLabel()); 2880 builder()->Jump(test_result->NewThenLabel());
2881 } else { 2881 } else {
2882 BytecodeLabels test_right(zone()); 2882 BytecodeLabels test_right(zone());
2883 VisitForTest(left, &test_right, test_result->else_labels(), 2883 VisitForTest(left, &test_right, test_result->else_labels(),
2884 TestFallthrough::kThen); 2884 TestFallthrough::kThen);
2885 test_right.Bind(builder()); 2885 test_right.Bind(builder());
2886 VisitForTest(right, test_result->then_labels(), 2886 VisitForTest(right, test_result->then_labels(),
2887 test_result->else_labels(), test_result->fallthrough()); 2887 test_result->else_labels(), test_result->fallthrough());
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 } 3192 }
3193 3193
3194 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3194 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3195 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3195 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3196 : Runtime::kStoreKeyedToSuper_Sloppy; 3196 : Runtime::kStoreKeyedToSuper_Sloppy;
3197 } 3197 }
3198 3198
3199 } // namespace interpreter 3199 } // namespace interpreter
3200 } // namespace internal 3200 } // namespace internal
3201 } // namespace v8 3201 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/ignition/regress-664146.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698