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 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 Node* literal = NewNode(javascript()->CreateLiteralRegExp( | 1180 Node* literal = NewNode(javascript()->CreateLiteralRegExp( |
1181 constant_pattern, literal_flags, literal_index), | 1181 constant_pattern, literal_flags, literal_index), |
1182 GetFunctionClosure()); | 1182 GetFunctionClosure()); |
1183 environment()->BindAccumulator(literal, Environment::kAttachFrameState); | 1183 environment()->BindAccumulator(literal, Environment::kAttachFrameState); |
1184 } | 1184 } |
1185 | 1185 |
1186 void BytecodeGraphBuilder::VisitCreateArrayLiteral() { | 1186 void BytecodeGraphBuilder::VisitCreateArrayLiteral() { |
1187 Handle<FixedArray> constant_elements = Handle<FixedArray>::cast( | 1187 Handle<FixedArray> constant_elements = Handle<FixedArray>::cast( |
1188 bytecode_iterator().GetConstantForIndexOperand(0)); | 1188 bytecode_iterator().GetConstantForIndexOperand(0)); |
1189 int literal_index = bytecode_iterator().GetIndexOperand(1); | 1189 int literal_index = bytecode_iterator().GetIndexOperand(1); |
1190 int literal_flags = bytecode_iterator().GetFlagOperand(2); | 1190 int bytecode_flags = bytecode_iterator().GetFlagOperand(2); |
| 1191 int literal_flags = |
| 1192 interpreter::CreateArrayLiteralFlags::FlagsBits::decode(bytecode_flags); |
1191 // Disable allocation site mementos. Only unoptimized code will collect | 1193 // Disable allocation site mementos. Only unoptimized code will collect |
1192 // feedback about allocation site. Once the code is optimized we expect the | 1194 // feedback about allocation site. Once the code is optimized we expect the |
1193 // data to converge. So, we disable allocation site mementos in optimized | 1195 // data to converge. So, we disable allocation site mementos in optimized |
1194 // code. We can revisit this when we have data to the contrary. | 1196 // code. We can revisit this when we have data to the contrary. |
1195 literal_flags |= ArrayLiteral::kDisableMementos; | 1197 literal_flags |= ArrayLiteral::kDisableMementos; |
1196 int number_of_elements = constant_elements->length(); | 1198 // TODO(mstarzinger): Thread through number of elements. The below number is |
| 1199 // only an estimate and does not match {ArrayLiteral::values::length}. |
| 1200 int number_of_elements = |
| 1201 FixedArrayBase::cast(constant_elements->get(1))->length(); |
1197 Node* literal = NewNode( | 1202 Node* literal = NewNode( |
1198 javascript()->CreateLiteralArray(constant_elements, literal_flags, | 1203 javascript()->CreateLiteralArray(constant_elements, literal_flags, |
1199 literal_index, number_of_elements), | 1204 literal_index, number_of_elements), |
1200 GetFunctionClosure()); | 1205 GetFunctionClosure()); |
1201 environment()->BindAccumulator(literal, Environment::kAttachFrameState); | 1206 environment()->BindAccumulator(literal, Environment::kAttachFrameState); |
1202 } | 1207 } |
1203 | 1208 |
1204 void BytecodeGraphBuilder::VisitCreateObjectLiteral() { | 1209 void BytecodeGraphBuilder::VisitCreateObjectLiteral() { |
1205 PrepareEagerCheckpoint(); | 1210 PrepareEagerCheckpoint(); |
1206 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast( | 1211 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast( |
1207 bytecode_iterator().GetConstantForIndexOperand(0)); | 1212 bytecode_iterator().GetConstantForIndexOperand(0)); |
1208 int literal_index = bytecode_iterator().GetIndexOperand(1); | 1213 int literal_index = bytecode_iterator().GetIndexOperand(1); |
1209 int bytecode_flags = bytecode_iterator().GetFlagOperand(2); | 1214 int bytecode_flags = bytecode_iterator().GetFlagOperand(2); |
1210 int literal_flags = | 1215 int literal_flags = |
1211 interpreter::CreateObjectLiteralFlags::FlagsBits::decode(bytecode_flags); | 1216 interpreter::CreateObjectLiteralFlags::FlagsBits::decode(bytecode_flags); |
1212 // TODO(mstarzinger): Thread through number of properties. | 1217 // TODO(mstarzinger): Thread through number of properties. The below number is |
| 1218 // only an estimate and does not match {ObjectLiteral::properties_count}. |
1213 int number_of_properties = constant_properties->length() / 2; | 1219 int number_of_properties = constant_properties->length() / 2; |
1214 Node* literal = NewNode( | 1220 Node* literal = NewNode( |
1215 javascript()->CreateLiteralObject(constant_properties, literal_flags, | 1221 javascript()->CreateLiteralObject(constant_properties, literal_flags, |
1216 literal_index, number_of_properties), | 1222 literal_index, number_of_properties), |
1217 GetFunctionClosure()); | 1223 GetFunctionClosure()); |
1218 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(3), | 1224 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(3), |
1219 literal, Environment::kAttachFrameState); | 1225 literal, Environment::kAttachFrameState); |
1220 } | 1226 } |
1221 | 1227 |
1222 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, | 1228 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2198 it->source_position().ScriptOffset(), start_position_.InliningId())); |
2193 it->Advance(); | 2199 it->Advance(); |
2194 } else { | 2200 } else { |
2195 DCHECK_GT(it->code_offset(), offset); | 2201 DCHECK_GT(it->code_offset(), offset); |
2196 } | 2202 } |
2197 } | 2203 } |
2198 | 2204 |
2199 } // namespace compiler | 2205 } // namespace compiler |
2200 } // namespace internal | 2206 } // namespace internal |
2201 } // namespace v8 | 2207 } // namespace v8 |
OLD | NEW |