| 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 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1936 | 1936 |
| 1937 void BytecodeGraphBuilder::VisitTestIn() { | 1937 void BytecodeGraphBuilder::VisitTestIn() { |
| 1938 BuildTestingOp(javascript()->HasProperty()); | 1938 BuildTestingOp(javascript()->HasProperty()); |
| 1939 } | 1939 } |
| 1940 | 1940 |
| 1941 void BytecodeGraphBuilder::VisitTestInstanceOf() { | 1941 void BytecodeGraphBuilder::VisitTestInstanceOf() { |
| 1942 BuildTestingOp(javascript()->InstanceOf()); | 1942 BuildTestingOp(javascript()->InstanceOf()); |
| 1943 } | 1943 } |
| 1944 | 1944 |
| 1945 void BytecodeGraphBuilder::VisitTestUndetectable() { | 1945 void BytecodeGraphBuilder::VisitTestUndetectable() { |
| 1946 Node* object = | 1946 Node* object = environment()->LookupAccumulator(); |
| 1947 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | |
| 1948 Node* node = NewNode(jsgraph()->simplified()->ObjectIsUndetectable(), object); | 1947 Node* node = NewNode(jsgraph()->simplified()->ObjectIsUndetectable(), object); |
| 1949 environment()->BindAccumulator(node); | 1948 environment()->BindAccumulator(node); |
| 1950 } | 1949 } |
| 1951 | 1950 |
| 1952 void BytecodeGraphBuilder::VisitTestNull() { | 1951 void BytecodeGraphBuilder::VisitTestNull() { |
| 1953 Node* object = | 1952 Node* object = environment()->LookupAccumulator(); |
| 1954 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | |
| 1955 Node* result = NewNode(simplified()->ReferenceEqual(), object, | 1953 Node* result = NewNode(simplified()->ReferenceEqual(), object, |
| 1956 jsgraph()->NullConstant()); | 1954 jsgraph()->NullConstant()); |
| 1957 environment()->BindAccumulator(result); | 1955 environment()->BindAccumulator(result); |
| 1958 } | 1956 } |
| 1959 | 1957 |
| 1960 void BytecodeGraphBuilder::VisitTestUndefined() { | 1958 void BytecodeGraphBuilder::VisitTestUndefined() { |
| 1961 Node* object = | 1959 Node* object = environment()->LookupAccumulator(); |
| 1962 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | |
| 1963 Node* result = NewNode(simplified()->ReferenceEqual(), object, | 1960 Node* result = NewNode(simplified()->ReferenceEqual(), object, |
| 1964 jsgraph()->UndefinedConstant()); | 1961 jsgraph()->UndefinedConstant()); |
| 1965 environment()->BindAccumulator(result); | 1962 environment()->BindAccumulator(result); |
| 1966 } | 1963 } |
| 1967 | 1964 |
| 1968 void BytecodeGraphBuilder::VisitTestTypeOf() { | 1965 void BytecodeGraphBuilder::VisitTestTypeOf() { |
| 1969 Node* object = environment()->LookupAccumulator(); | 1966 Node* object = environment()->LookupAccumulator(); |
| 1970 auto literal_flag = interpreter::TestTypeOfFlags::Decode( | 1967 auto literal_flag = interpreter::TestTypeOfFlags::Decode( |
| 1971 bytecode_iterator().GetFlagOperand(0)); | 1968 bytecode_iterator().GetFlagOperand(0)); |
| 1972 Node* result; | 1969 Node* result; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2075 } | 2072 } |
| 2076 | 2073 |
| 2077 void BytecodeGraphBuilder::VisitJumpIfNull() { | 2074 void BytecodeGraphBuilder::VisitJumpIfNull() { |
| 2078 BuildJumpIfEqual(jsgraph()->NullConstant()); | 2075 BuildJumpIfEqual(jsgraph()->NullConstant()); |
| 2079 } | 2076 } |
| 2080 | 2077 |
| 2081 void BytecodeGraphBuilder::VisitJumpIfNullConstant() { | 2078 void BytecodeGraphBuilder::VisitJumpIfNullConstant() { |
| 2082 BuildJumpIfEqual(jsgraph()->NullConstant()); | 2079 BuildJumpIfEqual(jsgraph()->NullConstant()); |
| 2083 } | 2080 } |
| 2084 | 2081 |
| 2082 void BytecodeGraphBuilder::VisitJumpIfNotNull() { |
| 2083 BuildJumpIfNotEqual(jsgraph()->NullConstant()); |
| 2084 } |
| 2085 |
| 2086 void BytecodeGraphBuilder::VisitJumpIfNotNullConstant() { |
| 2087 BuildJumpIfNotEqual(jsgraph()->NullConstant()); |
| 2088 } |
| 2089 |
| 2085 void BytecodeGraphBuilder::VisitJumpIfUndefined() { | 2090 void BytecodeGraphBuilder::VisitJumpIfUndefined() { |
| 2086 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); | 2091 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); |
| 2087 } | 2092 } |
| 2088 | 2093 |
| 2089 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstant() { | 2094 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstant() { |
| 2090 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); | 2095 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); |
| 2091 } | 2096 } |
| 2092 | 2097 |
| 2098 void BytecodeGraphBuilder::VisitJumpIfNotUndefined() { |
| 2099 BuildJumpIfNotEqual(jsgraph()->UndefinedConstant()); |
| 2100 } |
| 2101 |
| 2102 void BytecodeGraphBuilder::VisitJumpIfNotUndefinedConstant() { |
| 2103 BuildJumpIfNotEqual(jsgraph()->UndefinedConstant()); |
| 2104 } |
| 2105 |
| 2093 void BytecodeGraphBuilder::VisitJumpLoop() { BuildJump(); } | 2106 void BytecodeGraphBuilder::VisitJumpLoop() { BuildJump(); } |
| 2094 | 2107 |
| 2095 void BytecodeGraphBuilder::VisitStackCheck() { | 2108 void BytecodeGraphBuilder::VisitStackCheck() { |
| 2096 PrepareEagerCheckpoint(); | 2109 PrepareEagerCheckpoint(); |
| 2097 Node* node = NewNode(javascript()->StackCheck()); | 2110 Node* node = NewNode(javascript()->StackCheck()); |
| 2098 environment()->RecordAfterState(node, Environment::kAttachFrameState); | 2111 environment()->RecordAfterState(node, Environment::kAttachFrameState); |
| 2099 } | 2112 } |
| 2100 | 2113 |
| 2101 void BytecodeGraphBuilder::VisitSetPendingMessage() { | 2114 void BytecodeGraphBuilder::VisitSetPendingMessage() { |
| 2102 Node* previous_message = NewNode(javascript()->LoadMessage()); | 2115 Node* previous_message = NewNode(javascript()->LoadMessage()); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2358 NewIfTrue(); | 2371 NewIfTrue(); |
| 2359 } | 2372 } |
| 2360 | 2373 |
| 2361 void BytecodeGraphBuilder::BuildJumpIfEqual(Node* comperand) { | 2374 void BytecodeGraphBuilder::BuildJumpIfEqual(Node* comperand) { |
| 2362 Node* accumulator = environment()->LookupAccumulator(); | 2375 Node* accumulator = environment()->LookupAccumulator(); |
| 2363 Node* condition = | 2376 Node* condition = |
| 2364 NewNode(simplified()->ReferenceEqual(), accumulator, comperand); | 2377 NewNode(simplified()->ReferenceEqual(), accumulator, comperand); |
| 2365 BuildJumpIf(condition); | 2378 BuildJumpIf(condition); |
| 2366 } | 2379 } |
| 2367 | 2380 |
| 2381 void BytecodeGraphBuilder::BuildJumpIfNotEqual(Node* comperand) { |
| 2382 Node* accumulator = environment()->LookupAccumulator(); |
| 2383 Node* condition = |
| 2384 NewNode(simplified()->ReferenceEqual(), accumulator, comperand); |
| 2385 BuildJumpIfNot(condition); |
| 2386 } |
| 2387 |
| 2368 void BytecodeGraphBuilder::BuildJumpIfFalse() { | 2388 void BytecodeGraphBuilder::BuildJumpIfFalse() { |
| 2369 NewBranch(environment()->LookupAccumulator()); | 2389 NewBranch(environment()->LookupAccumulator()); |
| 2370 Environment* if_true_environment = environment()->Copy(); | 2390 Environment* if_true_environment = environment()->Copy(); |
| 2371 environment()->BindAccumulator(jsgraph()->FalseConstant()); | 2391 environment()->BindAccumulator(jsgraph()->FalseConstant()); |
| 2372 NewIfFalse(); | 2392 NewIfFalse(); |
| 2373 MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset()); | 2393 MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset()); |
| 2374 if_true_environment->BindAccumulator(jsgraph()->TrueConstant()); | 2394 if_true_environment->BindAccumulator(jsgraph()->TrueConstant()); |
| 2375 set_environment(if_true_environment); | 2395 set_environment(if_true_environment); |
| 2376 NewIfTrue(); | 2396 NewIfTrue(); |
| 2377 } | 2397 } |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2714 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2734 it->source_position().ScriptOffset(), start_position_.InliningId())); |
| 2715 it->Advance(); | 2735 it->Advance(); |
| 2716 } else { | 2736 } else { |
| 2717 DCHECK_GT(it->code_offset(), offset); | 2737 DCHECK_GT(it->code_offset(), offset); |
| 2718 } | 2738 } |
| 2719 } | 2739 } |
| 2720 | 2740 |
| 2721 } // namespace compiler | 2741 } // namespace compiler |
| 2722 } // namespace internal | 2742 } // namespace internal |
| 2723 } // namespace v8 | 2743 } // namespace v8 |
| OLD | NEW |