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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 1503963002: [Interpreter] Adds wide variant of CreateLiterals. Adds CreateLiterals to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: renamed BuildLiteral to BuildCreateLiteral. Created 5 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/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.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/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/interpreter/control-flow-builders.h" 9 #include "src/interpreter/control-flow-builders.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 builder()->LoadLiteral(value); 1033 builder()->LoadLiteral(value);
1034 } 1034 }
1035 execution_result()->SetResultInAccumulator(); 1035 execution_result()->SetResultInAccumulator();
1036 } 1036 }
1037 } 1037 }
1038 1038
1039 1039
1040 void BytecodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { 1040 void BytecodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
1041 // Materialize a regular expression literal. 1041 // Materialize a regular expression literal.
1042 TemporaryRegisterScope temporary_register_scope(builder()); 1042 TemporaryRegisterScope temporary_register_scope(builder());
1043 builder() 1043 builder()->CreateRegExpLiteral(expr->pattern(), expr->literal_index(),
1044 ->LoadLiteral(expr->pattern()) 1044 expr->flags());
1045 .CreateRegExpLiteral(expr->literal_index(), expr->flags());
1046 execution_result()->SetResultInAccumulator(); 1045 execution_result()->SetResultInAccumulator();
1047 } 1046 }
1048 1047
1049 1048
1050 void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { 1049 void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
1051 // Deep-copy the literal boilerplate. 1050 // Deep-copy the literal boilerplate.
1052 builder() 1051 builder()->CreateObjectLiteral(expr->constant_properties(),
1053 ->LoadLiteral(expr->constant_properties()) 1052 expr->literal_index(),
1054 .CreateObjectLiteral(expr->literal_index(), expr->ComputeFlags(true)); 1053 expr->ComputeFlags(true));
1055 1054
1056 TemporaryRegisterScope temporary_register_scope(builder()); 1055 TemporaryRegisterScope temporary_register_scope(builder());
1057 Register literal; 1056 Register literal;
1058 1057
1059 // Store computed values into the literal. 1058 // Store computed values into the literal.
1060 bool literal_in_accumulator = true; 1059 bool literal_in_accumulator = true;
1061 int property_index = 0; 1060 int property_index = 0;
1062 AccessorTable accessor_table(zone()); 1061 AccessorTable accessor_table(zone());
1063 for (; property_index < expr->properties()->length(); property_index++) { 1062 for (; property_index < expr->properties()->length(); property_index++) {
1064 TemporaryRegisterScope inner_temporary_register_scope(builder()); 1063 TemporaryRegisterScope inner_temporary_register_scope(builder());
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 if (!literal_in_accumulator) { 1235 if (!literal_in_accumulator) {
1237 // Restore literal array into accumulator. 1236 // Restore literal array into accumulator.
1238 builder()->LoadAccumulatorWithRegister(literal); 1237 builder()->LoadAccumulatorWithRegister(literal);
1239 } 1238 }
1240 execution_result()->SetResultInAccumulator(); 1239 execution_result()->SetResultInAccumulator();
1241 } 1240 }
1242 1241
1243 1242
1244 void BytecodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1243 void BytecodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1245 // Deep-copy the literal boilerplate. 1244 // Deep-copy the literal boilerplate.
1246 builder() 1245 builder()->CreateArrayLiteral(expr->constant_elements(),
1247 ->LoadLiteral(expr->constant_elements()) 1246 expr->literal_index(),
1248 .CreateArrayLiteral(expr->literal_index(), expr->ComputeFlags(true)); 1247 expr->ComputeFlags(true));
1249 1248
1250 TemporaryRegisterScope temporary_register_scope(builder()); 1249 TemporaryRegisterScope temporary_register_scope(builder());
1251 Register index, literal; 1250 Register index, literal;
1252 1251
1253 // Evaluate all the non-constant subexpressions and store them into the 1252 // Evaluate all the non-constant subexpressions and store them into the
1254 // newly cloned array. 1253 // newly cloned array.
1255 bool literal_in_accumulator = true; 1254 bool literal_in_accumulator = true;
1256 for (int array_index = 0; array_index < expr->values()->length(); 1255 for (int array_index = 0; array_index < expr->values()->length();
1257 array_index++) { 1256 array_index++) {
1258 Expression* subexpr = expr->values()->at(array_index); 1257 Expression* subexpr = expr->values()->at(array_index);
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 } 2231 }
2233 2232
2234 2233
2235 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 2234 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
2236 return info()->feedback_vector()->GetIndex(slot); 2235 return info()->feedback_vector()->GetIndex(slot);
2237 } 2236 }
2238 2237
2239 } // namespace interpreter 2238 } // namespace interpreter
2240 } // namespace internal 2239 } // namespace internal
2241 } // namespace v8 2240 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698