Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2379)

Side by Side Diff: src/compiler/bytecode-graph-builder.cc

Issue 2581683003: Introduce {ConstantElementsPair} struct for type safety. (Closed)
Patch Set: Rebased. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/compile-time-value.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); 1193 Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
1194 int literal_index = bytecode_iterator().GetIndexOperand(1); 1194 int literal_index = bytecode_iterator().GetIndexOperand(1);
1195 int literal_flags = bytecode_iterator().GetFlagOperand(2); 1195 int literal_flags = bytecode_iterator().GetFlagOperand(2);
1196 Node* literal = NewNode(javascript()->CreateLiteralRegExp( 1196 Node* literal = NewNode(javascript()->CreateLiteralRegExp(
1197 constant_pattern, literal_flags, literal_index), 1197 constant_pattern, literal_flags, literal_index),
1198 GetFunctionClosure()); 1198 GetFunctionClosure());
1199 environment()->BindAccumulator(literal, Environment::kAttachFrameState); 1199 environment()->BindAccumulator(literal, Environment::kAttachFrameState);
1200 } 1200 }
1201 1201
1202 void BytecodeGraphBuilder::VisitCreateArrayLiteral() { 1202 void BytecodeGraphBuilder::VisitCreateArrayLiteral() {
1203 Handle<FixedArray> constant_elements = Handle<FixedArray>::cast( 1203 Handle<ConstantElementsPair> constant_elements =
1204 bytecode_iterator().GetConstantForIndexOperand(0)); 1204 Handle<ConstantElementsPair>::cast(
1205 bytecode_iterator().GetConstantForIndexOperand(0));
1205 int literal_index = bytecode_iterator().GetIndexOperand(1); 1206 int literal_index = bytecode_iterator().GetIndexOperand(1);
1206 int bytecode_flags = bytecode_iterator().GetFlagOperand(2); 1207 int bytecode_flags = bytecode_iterator().GetFlagOperand(2);
1207 int literal_flags = 1208 int literal_flags =
1208 interpreter::CreateArrayLiteralFlags::FlagsBits::decode(bytecode_flags); 1209 interpreter::CreateArrayLiteralFlags::FlagsBits::decode(bytecode_flags);
1209 // Disable allocation site mementos. Only unoptimized code will collect 1210 // Disable allocation site mementos. Only unoptimized code will collect
1210 // feedback about allocation site. Once the code is optimized we expect the 1211 // feedback about allocation site. Once the code is optimized we expect the
1211 // data to converge. So, we disable allocation site mementos in optimized 1212 // data to converge. So, we disable allocation site mementos in optimized
1212 // code. We can revisit this when we have data to the contrary. 1213 // code. We can revisit this when we have data to the contrary.
1213 literal_flags |= ArrayLiteral::kDisableMementos; 1214 literal_flags |= ArrayLiteral::kDisableMementos;
1214 // TODO(mstarzinger): Thread through number of elements. The below number is 1215 // TODO(mstarzinger): Thread through number of elements. The below number is
1215 // only an estimate and does not match {ArrayLiteral::values::length}. 1216 // only an estimate and does not match {ArrayLiteral::values::length}.
1216 int number_of_elements = 1217 int number_of_elements = constant_elements->constant_values()->length();
1217 FixedArrayBase::cast(constant_elements->get(1))->length();
1218 Node* literal = NewNode( 1218 Node* literal = NewNode(
1219 javascript()->CreateLiteralArray(constant_elements, literal_flags, 1219 javascript()->CreateLiteralArray(constant_elements, literal_flags,
1220 literal_index, number_of_elements), 1220 literal_index, number_of_elements),
1221 GetFunctionClosure()); 1221 GetFunctionClosure());
1222 environment()->BindAccumulator(literal, Environment::kAttachFrameState); 1222 environment()->BindAccumulator(literal, Environment::kAttachFrameState);
1223 } 1223 }
1224 1224
1225 void BytecodeGraphBuilder::VisitCreateObjectLiteral() { 1225 void BytecodeGraphBuilder::VisitCreateObjectLiteral() {
1226 PrepareEagerCheckpoint(); 1226 PrepareEagerCheckpoint();
1227 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast( 1227 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast(
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
2260 it->source_position().ScriptOffset(), start_position_.InliningId())); 2260 it->source_position().ScriptOffset(), start_position_.InliningId()));
2261 it->Advance(); 2261 it->Advance();
2262 } else { 2262 } else {
2263 DCHECK_GT(it->code_offset(), offset); 2263 DCHECK_GT(it->code_offset(), offset);
2264 } 2264 }
2265 } 2265 }
2266 2266
2267 } // namespace compiler 2267 } // namespace compiler
2268 } // namespace internal 2268 } // namespace internal
2269 } // namespace v8 2269 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/compile-time-value.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698