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

Side by Side Diff: src/interpreter/bytecode-array-builder.cc

Issue 1412683011: [Interpreter] Enable assignments in expressions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Sync test bytecode sequences to avoid unnecessary Ldar/Star instructions. Created 5 years, 1 month 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.h ('k') | src/interpreter/bytecode-generator.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-array-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace interpreter { 9 namespace interpreter {
10 10
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 Register reg) { 281 Register reg) {
282 if (!IsRegisterInAccumulator(reg)) { 282 if (!IsRegisterInAccumulator(reg)) {
283 Output(Bytecode::kLdar, reg.ToOperand()); 283 Output(Bytecode::kLdar, reg.ToOperand());
284 } 284 }
285 return *this; 285 return *this;
286 } 286 }
287 287
288 288
289 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister( 289 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister(
290 Register reg) { 290 Register reg) {
291 // TODO(oth): Avoid storing the accumulator in the register if the
292 // previous bytecode loaded the accumulator with the same register.
293 //
294 // TODO(oth): If the previous bytecode is a MOV into this register,
295 // the previous instruction can be removed. The logic for determining
296 // these redundant MOVs appears complex.
297 Output(Bytecode::kStar, reg.ToOperand());
291 if (!IsRegisterInAccumulator(reg)) { 298 if (!IsRegisterInAccumulator(reg)) {
292 Output(Bytecode::kStar, reg.ToOperand()); 299 Output(Bytecode::kStar, reg.ToOperand());
293 } 300 }
294 return *this; 301 return *this;
295 } 302 }
296 303
297 304
305 BytecodeArrayBuilder& BytecodeArrayBuilder::MoveRegister(Register from,
306 Register to) {
307 DCHECK(from != to);
308 Output(Bytecode::kMov, from.ToOperand(), to.ToOperand());
309 return *this;
310 }
311
312
298 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal( 313 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(
299 size_t name_index, int feedback_slot, LanguageMode language_mode, 314 size_t name_index, int feedback_slot, LanguageMode language_mode,
300 TypeofMode typeof_mode) { 315 TypeofMode typeof_mode) {
301 // TODO(rmcilroy): Potentially store language and typeof information in an 316 // TODO(rmcilroy): Potentially store language and typeof information in an
302 // operand rather than having extra bytecodes. 317 // operand rather than having extra bytecodes.
303 Bytecode bytecode = BytecodeForLoadGlobal(language_mode, typeof_mode); 318 Bytecode bytecode = BytecodeForLoadGlobal(language_mode, typeof_mode);
304 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { 319 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
305 Output(bytecode, static_cast<uint8_t>(name_index), 320 Output(bytecode, static_cast<uint8_t>(name_index),
306 static_cast<uint8_t>(feedback_slot)); 321 static_cast<uint8_t>(feedback_slot));
307 } else if (FitsInIdx16Operand(name_index) && 322 } else if (FitsInIdx16Operand(name_index) &&
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 DCHECK_GT(next_consecutive_count_, 0); 1330 DCHECK_GT(next_consecutive_count_, 0);
1316 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); 1331 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_);
1317 allocated_.push_back(next_consecutive_register_); 1332 allocated_.push_back(next_consecutive_register_);
1318 next_consecutive_count_--; 1333 next_consecutive_count_--;
1319 return Register(next_consecutive_register_++); 1334 return Register(next_consecutive_register_++);
1320 } 1335 }
1321 1336
1322 } // namespace interpreter 1337 } // namespace interpreter
1323 } // namespace internal 1338 } // namespace internal
1324 } // namespace v8 1339 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698