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 Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); | 1180 Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); |
1181 int literal_index = bytecode_iterator().GetIndexOperand(1); | 1181 int literal_index = bytecode_iterator().GetIndexOperand(1); |
1182 int literal_flags = bytecode_iterator().GetFlagOperand(2); | 1182 int literal_flags = bytecode_iterator().GetFlagOperand(2); |
1183 Node* literal = NewNode(javascript()->CreateLiteralRegExp( | 1183 Node* literal = NewNode(javascript()->CreateLiteralRegExp( |
1184 constant_pattern, literal_flags, literal_index), | 1184 constant_pattern, literal_flags, literal_index), |
1185 GetFunctionClosure()); | 1185 GetFunctionClosure()); |
1186 environment()->BindAccumulator(literal, Environment::kAttachFrameState); | 1186 environment()->BindAccumulator(literal, Environment::kAttachFrameState); |
1187 } | 1187 } |
1188 | 1188 |
1189 void BytecodeGraphBuilder::VisitCreateArrayLiteral() { | 1189 void BytecodeGraphBuilder::VisitCreateArrayLiteral() { |
1190 Handle<FixedArray> constant_elements = Handle<FixedArray>::cast( | 1190 Handle<ConstantElementsPair> constant_elements = |
1191 bytecode_iterator().GetConstantForIndexOperand(0)); | 1191 Handle<ConstantElementsPair>::cast( |
| 1192 bytecode_iterator().GetConstantForIndexOperand(0)); |
1192 int literal_index = bytecode_iterator().GetIndexOperand(1); | 1193 int literal_index = bytecode_iterator().GetIndexOperand(1); |
1193 int bytecode_flags = bytecode_iterator().GetFlagOperand(2); | 1194 int bytecode_flags = bytecode_iterator().GetFlagOperand(2); |
1194 int literal_flags = | 1195 int literal_flags = |
1195 interpreter::CreateArrayLiteralFlags::FlagsBits::decode(bytecode_flags); | 1196 interpreter::CreateArrayLiteralFlags::FlagsBits::decode(bytecode_flags); |
1196 // Disable allocation site mementos. Only unoptimized code will collect | 1197 // Disable allocation site mementos. Only unoptimized code will collect |
1197 // feedback about allocation site. Once the code is optimized we expect the | 1198 // feedback about allocation site. Once the code is optimized we expect the |
1198 // data to converge. So, we disable allocation site mementos in optimized | 1199 // data to converge. So, we disable allocation site mementos in optimized |
1199 // code. We can revisit this when we have data to the contrary. | 1200 // code. We can revisit this when we have data to the contrary. |
1200 literal_flags |= ArrayLiteral::kDisableMementos; | 1201 literal_flags |= ArrayLiteral::kDisableMementos; |
1201 // TODO(mstarzinger): Thread through number of elements. The below number is | 1202 // TODO(mstarzinger): Thread through number of elements. The below number is |
1202 // only an estimate and does not match {ArrayLiteral::values::length}. | 1203 // only an estimate and does not match {ArrayLiteral::values::length}. |
1203 int number_of_elements = | 1204 int number_of_elements = constant_elements->constant_values()->length(); |
1204 FixedArrayBase::cast(constant_elements->get(1))->length(); | |
1205 Node* literal = NewNode( | 1205 Node* literal = NewNode( |
1206 javascript()->CreateLiteralArray(constant_elements, literal_flags, | 1206 javascript()->CreateLiteralArray(constant_elements, literal_flags, |
1207 literal_index, number_of_elements), | 1207 literal_index, number_of_elements), |
1208 GetFunctionClosure()); | 1208 GetFunctionClosure()); |
1209 environment()->BindAccumulator(literal, Environment::kAttachFrameState); | 1209 environment()->BindAccumulator(literal, Environment::kAttachFrameState); |
1210 } | 1210 } |
1211 | 1211 |
1212 void BytecodeGraphBuilder::VisitCreateObjectLiteral() { | 1212 void BytecodeGraphBuilder::VisitCreateObjectLiteral() { |
1213 PrepareEagerCheckpoint(); | 1213 PrepareEagerCheckpoint(); |
1214 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast( | 1214 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast( |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2236 it->source_position().ScriptOffset(), start_position_.InliningId())); |
2237 it->Advance(); | 2237 it->Advance(); |
2238 } else { | 2238 } else { |
2239 DCHECK_GT(it->code_offset(), offset); | 2239 DCHECK_GT(it->code_offset(), offset); |
2240 } | 2240 } |
2241 } | 2241 } |
2242 | 2242 |
2243 } // namespace compiler | 2243 } // namespace compiler |
2244 } // namespace internal | 2244 } // namespace internal |
2245 } // namespace v8 | 2245 } // namespace v8 |
OLD | NEW |