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" |
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 } | 2065 } |
2066 | 2066 |
2067 void BytecodeGraphBuilder::BuildJumpIfEqual(Node* comperand) { | 2067 void BytecodeGraphBuilder::BuildJumpIfEqual(Node* comperand) { |
2068 Node* accumulator = environment()->LookupAccumulator(); | 2068 Node* accumulator = environment()->LookupAccumulator(); |
2069 Node* condition = | 2069 Node* condition = |
2070 NewNode(simplified()->ReferenceEqual(), accumulator, comperand); | 2070 NewNode(simplified()->ReferenceEqual(), accumulator, comperand); |
2071 BuildJumpIf(condition); | 2071 BuildJumpIf(condition); |
2072 } | 2072 } |
2073 | 2073 |
2074 void BytecodeGraphBuilder::BuildJumpIfFalse() { | 2074 void BytecodeGraphBuilder::BuildJumpIfFalse() { |
2075 BuildJumpIfNot(environment()->LookupAccumulator()); | 2075 NewBranch(environment()->LookupAccumulator()); |
| 2076 Environment* if_true_environment = environment()->Copy(); |
| 2077 environment()->BindAccumulator(jsgraph()->FalseConstant()); |
| 2078 NewIfFalse(); |
| 2079 MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset()); |
| 2080 if_true_environment->BindAccumulator(jsgraph()->TrueConstant()); |
| 2081 set_environment(if_true_environment); |
| 2082 NewIfTrue(); |
2076 } | 2083 } |
2077 | 2084 |
2078 void BytecodeGraphBuilder::BuildJumpIfTrue() { | 2085 void BytecodeGraphBuilder::BuildJumpIfTrue() { |
2079 BuildJumpIf(environment()->LookupAccumulator()); | 2086 NewBranch(environment()->LookupAccumulator()); |
| 2087 Environment* if_false_environment = environment()->Copy(); |
| 2088 environment()->BindAccumulator(jsgraph()->TrueConstant()); |
| 2089 NewIfTrue(); |
| 2090 MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset()); |
| 2091 if_false_environment->BindAccumulator(jsgraph()->FalseConstant()); |
| 2092 set_environment(if_false_environment); |
| 2093 NewIfFalse(); |
2080 } | 2094 } |
2081 | 2095 |
2082 void BytecodeGraphBuilder::BuildJumpIfToBooleanTrue() { | 2096 void BytecodeGraphBuilder::BuildJumpIfToBooleanTrue() { |
2083 Node* accumulator = environment()->LookupAccumulator(); | 2097 Node* accumulator = environment()->LookupAccumulator(); |
2084 Node* condition = | 2098 Node* condition = |
2085 NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), accumulator); | 2099 NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), accumulator); |
2086 BuildJumpIf(condition); | 2100 BuildJumpIf(condition); |
2087 } | 2101 } |
2088 | 2102 |
2089 void BytecodeGraphBuilder::BuildJumpIfToBooleanFalse() { | 2103 void BytecodeGraphBuilder::BuildJumpIfToBooleanFalse() { |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2315 it->source_position().ScriptOffset(), start_position_.InliningId())); |
2302 it->Advance(); | 2316 it->Advance(); |
2303 } else { | 2317 } else { |
2304 DCHECK_GT(it->code_offset(), offset); | 2318 DCHECK_GT(it->code_offset(), offset); |
2305 } | 2319 } |
2306 } | 2320 } |
2307 | 2321 |
2308 } // namespace compiler | 2322 } // namespace compiler |
2309 } // namespace internal | 2323 } // namespace internal |
2310 } // namespace v8 | 2324 } // namespace v8 |
OLD | NEW |