OLD | NEW |
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/compiler/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/compiler-source-position-table.h" | 10 #include "src/compiler/compiler-source-position-table.h" |
11 #include "src/compiler/linkage.h" | 11 #include "src/compiler/linkage.h" |
12 #include "src/compiler/operator-properties.h" | 12 #include "src/compiler/operator-properties.h" |
| 13 #include "src/compiler/simplified-operator.h" |
13 #include "src/interpreter/bytecodes.h" | 14 #include "src/interpreter/bytecodes.h" |
14 #include "src/objects-inl.h" | 15 #include "src/objects-inl.h" |
15 | 16 |
16 namespace v8 { | 17 namespace v8 { |
17 namespace internal { | 18 namespace internal { |
18 namespace compiler { | 19 namespace compiler { |
19 | 20 |
20 // The abstract execution environment simulates the content of the interpreter | 21 // The abstract execution environment simulates the content of the interpreter |
21 // register file. The environment performs SSA-renaming of all tracked nodes at | 22 // register file. The environment performs SSA-renaming of all tracked nodes at |
22 // split and merge points in the control flow. | 23 // split and merge points in the control flow. |
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstant() { | 1690 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstant() { |
1690 BuildJumpIfToBooleanFalse(); | 1691 BuildJumpIfToBooleanFalse(); |
1691 } | 1692 } |
1692 | 1693 |
1693 void BytecodeGraphBuilder::VisitJumpIfNotHole() { BuildJumpIfNotHole(); } | 1694 void BytecodeGraphBuilder::VisitJumpIfNotHole() { BuildJumpIfNotHole(); } |
1694 | 1695 |
1695 void BytecodeGraphBuilder::VisitJumpIfNotHoleConstant() { | 1696 void BytecodeGraphBuilder::VisitJumpIfNotHoleConstant() { |
1696 BuildJumpIfNotHole(); | 1697 BuildJumpIfNotHole(); |
1697 } | 1698 } |
1698 | 1699 |
| 1700 void BytecodeGraphBuilder::VisitJumpIfJSReceiver() { BuildJumpIfJSReceiver(); } |
| 1701 |
| 1702 void BytecodeGraphBuilder::VisitJumpIfJSReceiverConstant() { |
| 1703 BuildJumpIfJSReceiver(); |
| 1704 } |
| 1705 |
1699 void BytecodeGraphBuilder::VisitJumpIfNull() { | 1706 void BytecodeGraphBuilder::VisitJumpIfNull() { |
1700 BuildJumpIfEqual(jsgraph()->NullConstant()); | 1707 BuildJumpIfEqual(jsgraph()->NullConstant()); |
1701 } | 1708 } |
1702 | 1709 |
1703 void BytecodeGraphBuilder::VisitJumpIfNullConstant() { | 1710 void BytecodeGraphBuilder::VisitJumpIfNullConstant() { |
1704 BuildJumpIfEqual(jsgraph()->NullConstant()); | 1711 BuildJumpIfEqual(jsgraph()->NullConstant()); |
1705 } | 1712 } |
1706 | 1713 |
1707 void BytecodeGraphBuilder::VisitJumpIfUndefined() { | 1714 void BytecodeGraphBuilder::VisitJumpIfUndefined() { |
1708 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); | 1715 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2000 } | 2007 } |
2001 | 2008 |
2002 void BytecodeGraphBuilder::BuildJumpIfNotHole() { | 2009 void BytecodeGraphBuilder::BuildJumpIfNotHole() { |
2003 Node* accumulator = environment()->LookupAccumulator(); | 2010 Node* accumulator = environment()->LookupAccumulator(); |
2004 Node* condition = | 2011 Node* condition = |
2005 NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), | 2012 NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), |
2006 accumulator, jsgraph()->TheHoleConstant()); | 2013 accumulator, jsgraph()->TheHoleConstant()); |
2007 BuildJumpIfNot(condition); | 2014 BuildJumpIfNot(condition); |
2008 } | 2015 } |
2009 | 2016 |
| 2017 void BytecodeGraphBuilder::BuildJumpIfJSReceiver() { |
| 2018 Node* accumulator = environment()->LookupAccumulator(); |
| 2019 Node* condition = NewNode(simplified()->ObjectIsReceiver(), accumulator); |
| 2020 BuildJumpIf(condition); |
| 2021 } |
| 2022 |
2010 Node** BytecodeGraphBuilder::EnsureInputBufferSize(int size) { | 2023 Node** BytecodeGraphBuilder::EnsureInputBufferSize(int size) { |
2011 if (size > input_buffer_size_) { | 2024 if (size > input_buffer_size_) { |
2012 size = size + kInputBufferSizeIncrement + input_buffer_size_; | 2025 size = size + kInputBufferSizeIncrement + input_buffer_size_; |
2013 input_buffer_ = local_zone()->NewArray<Node*>(size); | 2026 input_buffer_ = local_zone()->NewArray<Node*>(size); |
2014 input_buffer_size_ = size; | 2027 input_buffer_size_ = size; |
2015 } | 2028 } |
2016 return input_buffer_; | 2029 return input_buffer_; |
2017 } | 2030 } |
2018 | 2031 |
2019 void BytecodeGraphBuilder::EnterAndExitExceptionHandlers(int current_offset) { | 2032 void BytecodeGraphBuilder::EnterAndExitExceptionHandlers(int current_offset) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2215 it->source_position().ScriptOffset(), start_position_.InliningId())); |
2203 it->Advance(); | 2216 it->Advance(); |
2204 } else { | 2217 } else { |
2205 DCHECK_GT(it->code_offset(), offset); | 2218 DCHECK_GT(it->code_offset(), offset); |
2206 } | 2219 } |
2207 } | 2220 } |
2208 | 2221 |
2209 } // namespace compiler | 2222 } // namespace compiler |
2210 } // namespace internal | 2223 } // namespace internal |
2211 } // namespace v8 | 2224 } // namespace v8 |
OLD | NEW |