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/compiler/access-builder.h" | 9 #include "src/compiler/access-builder.h" |
10 #include "src/compiler/compiler-source-position-table.h" | 10 #include "src/compiler/compiler-source-position-table.h" |
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 | 2021 |
2022 void BytecodeGraphBuilder::VisitToName() { | 2022 void BytecodeGraphBuilder::VisitToName() { |
2023 BuildCastOperator(javascript()->ToName()); | 2023 BuildCastOperator(javascript()->ToName()); |
2024 } | 2024 } |
2025 | 2025 |
2026 void BytecodeGraphBuilder::VisitToObject() { | 2026 void BytecodeGraphBuilder::VisitToObject() { |
2027 BuildCastOperator(javascript()->ToObject()); | 2027 BuildCastOperator(javascript()->ToObject()); |
2028 } | 2028 } |
2029 | 2029 |
2030 void BytecodeGraphBuilder::VisitToNumber() { | 2030 void BytecodeGraphBuilder::VisitToNumber() { |
2031 BuildCastOperator(javascript()->ToNumber()); | 2031 PrepareEagerCheckpoint(); |
| 2032 Node* object = environment()->LookupAccumulator(); |
| 2033 |
| 2034 Node* node = nullptr; |
| 2035 FeedbackSlot slot = |
| 2036 feedback_vector()->ToSlot(bytecode_iterator().GetIndexOperand(1)); |
| 2037 if (Node* simplified = TryBuildSimplifiedBinaryOp( |
| 2038 javascript()->Multiply(), object, jsgraph()->OneConstant(), slot)) { |
| 2039 node = simplified; |
| 2040 } else { |
| 2041 node = NewNode(javascript()->ToNumber(), object); |
| 2042 } |
| 2043 |
| 2044 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), node, |
| 2045 Environment::kAttachFrameState); |
2032 } | 2046 } |
2033 | 2047 |
2034 void BytecodeGraphBuilder::VisitJump() { BuildJump(); } | 2048 void BytecodeGraphBuilder::VisitJump() { BuildJump(); } |
2035 | 2049 |
2036 void BytecodeGraphBuilder::VisitJumpConstant() { BuildJump(); } | 2050 void BytecodeGraphBuilder::VisitJumpConstant() { BuildJump(); } |
2037 | 2051 |
2038 void BytecodeGraphBuilder::VisitJumpIfTrue() { BuildJumpIfTrue(); } | 2052 void BytecodeGraphBuilder::VisitJumpIfTrue() { BuildJumpIfTrue(); } |
2039 | 2053 |
2040 void BytecodeGraphBuilder::VisitJumpIfTrueConstant() { BuildJumpIfTrue(); } | 2054 void BytecodeGraphBuilder::VisitJumpIfTrueConstant() { BuildJumpIfTrue(); } |
2041 | 2055 |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2734 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2748 it->source_position().ScriptOffset(), start_position_.InliningId())); |
2735 it->Advance(); | 2749 it->Advance(); |
2736 } else { | 2750 } else { |
2737 DCHECK_GT(it->code_offset(), offset); | 2751 DCHECK_GT(it->code_offset(), offset); |
2738 } | 2752 } |
2739 } | 2753 } |
2740 | 2754 |
2741 } // namespace compiler | 2755 } // namespace compiler |
2742 } // namespace internal | 2756 } // namespace internal |
2743 } // namespace v8 | 2757 } // namespace v8 |
OLD | NEW |