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

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

Issue 1997653002: [interpreter] Bytecode register optimizer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Decouple a test from implementation. Created 4 years, 6 months 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/bytecode-pipeline.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-writer.h" 5 #include "src/interpreter/bytecode-array-writer.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 #include "src/interpreter/source-position-table.h" 8 #include "src/interpreter/source-position-table.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 if (operand_scale != OperandScale::kSingle) { 47 if (operand_scale != OperandScale::kSingle) {
48 Bytecode prefix = Bytecodes::OperandScaleToPrefixBytecode(operand_scale); 48 Bytecode prefix = Bytecodes::OperandScaleToPrefixBytecode(operand_scale);
49 bytecodes()->push_back(Bytecodes::ToByte(prefix)); 49 bytecodes()->push_back(Bytecodes::ToByte(prefix));
50 } 50 }
51 51
52 Bytecode bytecode = node->bytecode(); 52 Bytecode bytecode = node->bytecode();
53 bytecodes()->push_back(Bytecodes::ToByte(bytecode)); 53 bytecodes()->push_back(Bytecodes::ToByte(bytecode));
54 54
55 int register_operand_bitmap = Bytecodes::GetRegisterOperandBitmap(bytecode); 55 int register_operand_bitmap = Bytecodes::GetRegisterOperandBitmap(bytecode);
56 const uint32_t* const operands = node->operands(); 56 const uint32_t* const operands = node->operands();
57 const OperandSize* operand_sizes =
58 Bytecodes::GetOperandSizes(bytecode, operand_scale);
57 const OperandType* operand_types = Bytecodes::GetOperandTypes(bytecode); 59 const OperandType* operand_types = Bytecodes::GetOperandTypes(bytecode);
58 for (int i = 0; operand_types[i] != OperandType::kNone; ++i) { 60 for (int i = 0; operand_types[i] != OperandType::kNone; ++i) {
59 OperandType operand_type = operand_types[i]; 61 OperandType operand_type = operand_types[i];
60 switch (Bytecodes::SizeOfOperand(operand_type, operand_scale)) { 62 switch (operand_sizes[i]) {
61 case OperandSize::kNone: 63 case OperandSize::kNone:
62 UNREACHABLE(); 64 UNREACHABLE();
63 break; 65 break;
64 case OperandSize::kByte: 66 case OperandSize::kByte:
65 bytecodes()->push_back(static_cast<uint8_t>(operands[i])); 67 bytecodes()->push_back(static_cast<uint8_t>(operands[i]));
66 break; 68 break;
67 case OperandSize::kShort: { 69 case OperandSize::kShort: {
68 uint8_t operand_bytes[2]; 70 uint8_t operand_bytes[2];
69 WriteUnalignedUInt16(operand_bytes, operands[i]); 71 WriteUnalignedUInt16(operand_bytes, operands[i]);
70 bytecodes()->insert(bytecodes()->end(), operand_bytes, 72 bytecodes()->insert(bytecodes()->end(), operand_bytes,
(...skipping 25 matching lines...) Expand all
96 // override 98 // override
97 void BytecodeArrayWriter::FlushBasicBlock() {} 99 void BytecodeArrayWriter::FlushBasicBlock() {}
98 100
99 int BytecodeArrayWriter::GetMaximumFrameSizeUsed() { 101 int BytecodeArrayWriter::GetMaximumFrameSizeUsed() {
100 return max_register_count_ * kPointerSize; 102 return max_register_count_ * kPointerSize;
101 } 103 }
102 104
103 } // namespace interpreter 105 } // namespace interpreter
104 } // namespace internal 106 } // namespace internal
105 } // namespace v8 107 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecode-pipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698