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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 | 937 |
938 void BytecodeGraphBuilder::VisitCreateRegExpLiteralWide() { | 938 void BytecodeGraphBuilder::VisitCreateRegExpLiteralWide() { |
939 BuildCreateRegExpLiteral(); | 939 BuildCreateRegExpLiteral(); |
940 } | 940 } |
941 | 941 |
942 void BytecodeGraphBuilder::BuildCreateArrayLiteral() { | 942 void BytecodeGraphBuilder::BuildCreateArrayLiteral() { |
943 Handle<FixedArray> constant_elements = Handle<FixedArray>::cast( | 943 Handle<FixedArray> constant_elements = Handle<FixedArray>::cast( |
944 bytecode_iterator().GetConstantForIndexOperand(0)); | 944 bytecode_iterator().GetConstantForIndexOperand(0)); |
945 int literal_index = bytecode_iterator().GetIndexOperand(1); | 945 int literal_index = bytecode_iterator().GetIndexOperand(1); |
946 int literal_flags = bytecode_iterator().GetImmediateOperand(2); | 946 int literal_flags = bytecode_iterator().GetImmediateOperand(2); |
| 947 int number_of_elements = constant_elements->length(); |
947 const Operator* op = javascript()->CreateLiteralArray( | 948 const Operator* op = javascript()->CreateLiteralArray( |
948 constant_elements, literal_flags, literal_index); | 949 constant_elements, literal_flags, literal_index, number_of_elements); |
949 BuildCreateLiteral(op); | 950 BuildCreateLiteral(op); |
950 } | 951 } |
951 | 952 |
952 void BytecodeGraphBuilder::VisitCreateArrayLiteral() { | 953 void BytecodeGraphBuilder::VisitCreateArrayLiteral() { |
953 BuildCreateArrayLiteral(); | 954 BuildCreateArrayLiteral(); |
954 } | 955 } |
955 | 956 |
956 void BytecodeGraphBuilder::VisitCreateArrayLiteralWide() { | 957 void BytecodeGraphBuilder::VisitCreateArrayLiteralWide() { |
957 BuildCreateArrayLiteral(); | 958 BuildCreateArrayLiteral(); |
958 } | 959 } |
959 | 960 |
960 void BytecodeGraphBuilder::BuildCreateObjectLiteral() { | 961 void BytecodeGraphBuilder::BuildCreateObjectLiteral() { |
961 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast( | 962 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast( |
962 bytecode_iterator().GetConstantForIndexOperand(0)); | 963 bytecode_iterator().GetConstantForIndexOperand(0)); |
963 int literal_index = bytecode_iterator().GetIndexOperand(1); | 964 int literal_index = bytecode_iterator().GetIndexOperand(1); |
964 int literal_flags = bytecode_iterator().GetImmediateOperand(2); | 965 int literal_flags = bytecode_iterator().GetImmediateOperand(2); |
| 966 // TODO(mstarzinger): Thread through number of properties. |
| 967 int number_of_properties = constant_properties->length() / 2; |
965 const Operator* op = javascript()->CreateLiteralObject( | 968 const Operator* op = javascript()->CreateLiteralObject( |
966 constant_properties, literal_flags, literal_index); | 969 constant_properties, literal_flags, literal_index, number_of_properties); |
967 BuildCreateLiteral(op); | 970 BuildCreateLiteral(op); |
968 } | 971 } |
969 | 972 |
970 void BytecodeGraphBuilder::VisitCreateObjectLiteral() { | 973 void BytecodeGraphBuilder::VisitCreateObjectLiteral() { |
971 BuildCreateObjectLiteral(); | 974 BuildCreateObjectLiteral(); |
972 } | 975 } |
973 | 976 |
974 void BytecodeGraphBuilder::VisitCreateObjectLiteralWide() { | 977 void BytecodeGraphBuilder::VisitCreateObjectLiteralWide() { |
975 BuildCreateObjectLiteral(); | 978 BuildCreateObjectLiteral(); |
976 } | 979 } |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1753 // Phi does not exist yet, introduce one. | 1756 // Phi does not exist yet, introduce one. |
1754 value = NewPhi(inputs, value, control); | 1757 value = NewPhi(inputs, value, control); |
1755 value->ReplaceInput(inputs - 1, other); | 1758 value->ReplaceInput(inputs - 1, other); |
1756 } | 1759 } |
1757 return value; | 1760 return value; |
1758 } | 1761 } |
1759 | 1762 |
1760 } // namespace compiler | 1763 } // namespace compiler |
1761 } // namespace internal | 1764 } // namespace internal |
1762 } // namespace v8 | 1765 } // namespace v8 |
OLD | NEW |