| 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/compiler/bytecode-branch-analysis.h" | 7 #include "src/compiler/bytecode-branch-analysis.h" |
| 8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
| 9 #include "src/compiler/operator-properties.h" | 9 #include "src/compiler/operator-properties.h" |
| 10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 if (!function_closure_.is_set()) { | 481 if (!function_closure_.is_set()) { |
| 482 int index = Linkage::kJSCallClosureParamIndex; | 482 int index = Linkage::kJSCallClosureParamIndex; |
| 483 const Operator* op = common()->Parameter(index, "%closure"); | 483 const Operator* op = common()->Parameter(index, "%closure"); |
| 484 Node* node = NewNode(op, graph()->start()); | 484 Node* node = NewNode(op, graph()->start()); |
| 485 function_closure_.set(node); | 485 function_closure_.set(node); |
| 486 } | 486 } |
| 487 return function_closure_.get(); | 487 return function_closure_.get(); |
| 488 } | 488 } |
| 489 | 489 |
| 490 | 490 |
| 491 Node* BytecodeGraphBuilder::BuildLoadObjectField(Node* object, int offset) { | |
| 492 return NewNode(jsgraph()->machine()->Load(MachineType::AnyTagged()), object, | |
| 493 jsgraph()->IntPtrConstant(offset - kHeapObjectTag)); | |
| 494 } | |
| 495 | |
| 496 | |
| 497 Node* BytecodeGraphBuilder::BuildLoadImmutableObjectField(Node* object, | 491 Node* BytecodeGraphBuilder::BuildLoadImmutableObjectField(Node* object, |
| 498 int offset) { | 492 int offset) { |
| 499 return graph()->NewNode(jsgraph()->machine()->Load(MachineType::AnyTagged()), | 493 return graph()->NewNode(jsgraph()->machine()->Load(MachineType::AnyTagged()), |
| 500 object, | 494 object, |
| 501 jsgraph()->IntPtrConstant(offset - kHeapObjectTag), | 495 jsgraph()->IntPtrConstant(offset - kHeapObjectTag), |
| 502 graph()->start(), graph()->start()); | 496 graph()->start(), graph()->start()); |
| 503 } | 497 } |
| 504 | 498 |
| 505 | 499 |
| 506 Node* BytecodeGraphBuilder::BuildLoadNativeContextField(int index) { | 500 Node* BytecodeGraphBuilder::BuildLoadNativeContextField(int index) { |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 void BytecodeGraphBuilder::VisitKeyedStoreICSloppyWide() { | 950 void BytecodeGraphBuilder::VisitKeyedStoreICSloppyWide() { |
| 957 DCHECK(is_sloppy(language_mode())); | 951 DCHECK(is_sloppy(language_mode())); |
| 958 BuildKeyedStore(); | 952 BuildKeyedStore(); |
| 959 } | 953 } |
| 960 | 954 |
| 961 void BytecodeGraphBuilder::VisitKeyedStoreICStrictWide() { | 955 void BytecodeGraphBuilder::VisitKeyedStoreICStrictWide() { |
| 962 DCHECK(is_strict(language_mode())); | 956 DCHECK(is_strict(language_mode())); |
| 963 BuildKeyedStore(); | 957 BuildKeyedStore(); |
| 964 } | 958 } |
| 965 | 959 |
| 966 void BytecodeGraphBuilder::VisitLdaInitialMap() { | |
| 967 Node* js_function = environment()->LookupAccumulator(); | |
| 968 Node* load = BuildLoadObjectField(js_function, | |
| 969 JSFunction::kPrototypeOrInitialMapOffset); | |
| 970 environment()->BindAccumulator(load); | |
| 971 } | |
| 972 | |
| 973 void BytecodeGraphBuilder::VisitPushContext() { | 960 void BytecodeGraphBuilder::VisitPushContext() { |
| 974 Node* new_context = environment()->LookupAccumulator(); | 961 Node* new_context = environment()->LookupAccumulator(); |
| 975 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), | 962 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), |
| 976 environment()->Context()); | 963 environment()->Context()); |
| 977 environment()->SetContext(new_context); | 964 environment()->SetContext(new_context); |
| 978 } | 965 } |
| 979 | 966 |
| 980 void BytecodeGraphBuilder::VisitPopContext() { | 967 void BytecodeGraphBuilder::VisitPopContext() { |
| 981 Node* context = | 968 Node* context = |
| 982 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 969 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 // Phi does not exist yet, introduce one. | 1819 // Phi does not exist yet, introduce one. |
| 1833 value = NewPhi(inputs, value, control); | 1820 value = NewPhi(inputs, value, control); |
| 1834 value->ReplaceInput(inputs - 1, other); | 1821 value->ReplaceInput(inputs - 1, other); |
| 1835 } | 1822 } |
| 1836 return value; | 1823 return value; |
| 1837 } | 1824 } |
| 1838 | 1825 |
| 1839 } // namespace compiler | 1826 } // namespace compiler |
| 1840 } // namespace internal | 1827 } // namespace internal |
| 1841 } // namespace v8 | 1828 } // namespace v8 |
| OLD | NEW |