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

Side by Side Diff: src/interpreter/interpreter.cc

Issue 2554723004: [Interpreter] Transform StrictEquality with null/undefined to special bytecodes. (Closed)
Patch Set: "Fixed a DCHECK" Created 4 years 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/interpreter/bytecodes.h ('k') | src/interpreter/mkpeephole.cc » ('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/interpreter.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 __ Bind(&not_equal); 1943 __ Bind(&not_equal);
1944 { 1944 {
1945 __ SetAccumulator(__ BooleanConstant(false)); 1945 __ SetAccumulator(__ BooleanConstant(false));
1946 __ Goto(&end); 1946 __ Goto(&end);
1947 } 1947 }
1948 1948
1949 __ Bind(&end); 1949 __ Bind(&end);
1950 __ Dispatch(); 1950 __ Dispatch();
1951 } 1951 }
1952 1952
1953 // TestNull <src>
1954 //
1955 // Test if the value in the <src> register is strictly equal to Null.
rmcilroy 2016/12/14 18:50:00 nit Null -> null
mythria 2016/12/15 09:27:39 Done.
1956 void Interpreter::DoTestNull(InterpreterAssembler* assembler) {
1957 Node* reg_index = __ BytecodeOperandReg(0);
1958 Node* object = __ LoadRegister(reg_index);
1959 Node* null_value = __ HeapConstant(isolate_->factory()->null_value());
1960
1961 Label equal(assembler), end(assembler);
1962 __ GotoIf(__ WordEqual(object, null_value), &equal);
1963 __ SetAccumulator(__ BooleanConstant(false));
1964 __ Goto(&end);
1965
1966 __ Bind(&equal);
1967 {
1968 __ SetAccumulator(__ BooleanConstant(true));
1969 __ Goto(&end);
1970 }
1971
1972 __ Bind(&end);
1973 __ Dispatch();
1974 }
1975
1976 // TestUndefined <src>
1977 //
1978 // Test if the value in the <src> register is strictly equal to Undefined.
rmcilroy 2016/12/14 18:50:00 nit - Undefined -> undefined.
mythria 2016/12/15 09:27:39 Done.
1979 void Interpreter::DoTestUndefined(InterpreterAssembler* assembler) {
1980 Node* reg_index = __ BytecodeOperandReg(0);
1981 Node* object = __ LoadRegister(reg_index);
1982 Node* undefined_value =
1983 __ HeapConstant(isolate_->factory()->undefined_value());
1984
1985 Label equal(assembler), end(assembler);
1986 __ GotoIf(__ WordEqual(object, undefined_value), &equal);
1987 __ SetAccumulator(__ BooleanConstant(false));
1988 __ Goto(&end);
1989
1990 __ Bind(&equal);
1991 {
1992 __ SetAccumulator(__ BooleanConstant(true));
1993 __ Goto(&end);
1994 }
1995
1996 __ Bind(&end);
1997 __ Dispatch();
1998 }
1999
1953 // Jump <imm> 2000 // Jump <imm>
1954 // 2001 //
1955 // Jump by number of bytes represented by the immediate operand |imm|. 2002 // Jump by number of bytes represented by the immediate operand |imm|.
1956 void Interpreter::DoJump(InterpreterAssembler* assembler) { 2003 void Interpreter::DoJump(InterpreterAssembler* assembler) {
1957 Node* relative_jump = __ BytecodeOperandImm(0); 2004 Node* relative_jump = __ BytecodeOperandImm(0);
1958 __ Jump(relative_jump); 2005 __ Jump(relative_jump);
1959 } 2006 }
1960 2007
1961 // JumpConstant <idx> 2008 // JumpConstant <idx>
1962 // 2009 //
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 2850 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
2804 __ SmiTag(new_state)); 2851 __ SmiTag(new_state));
2805 __ SetAccumulator(old_state); 2852 __ SetAccumulator(old_state);
2806 2853
2807 __ Dispatch(); 2854 __ Dispatch();
2808 } 2855 }
2809 2856
2810 } // namespace interpreter 2857 } // namespace interpreter
2811 } // namespace internal 2858 } // namespace internal
2812 } // namespace v8 2859 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/interpreter/mkpeephole.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698