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

Unified Diff: src/compiler/instruction.cc

Issue 884503002: store InstructionOperands directly in Instruction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction.h ('k') | test/cctest/compiler/test-instruction.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction.cc
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc
index 7d1851a94d579af844f1c0273e064c4bd724ab7f..ce2c076615cc612c87328950497de2f7cf81c591 100644
--- a/src/compiler/instruction.cc
+++ b/src/compiler/instruction.cc
@@ -117,6 +117,47 @@ bool ParallelMove::IsRedundant() const {
}
+static void SetOperand(UnallocatedOperand* loc, InstructionOperand* value) {
+ if (value->IsUnallocated()) {
+ loc[0] = *UnallocatedOperand::cast(value);
+ } else {
+ InstructionOperand* casted = static_cast<InstructionOperand*>(loc);
+ casted[0] = *value;
+ }
+}
+
+
+Instruction::Instruction(InstructionCode opcode)
+ : opcode_(opcode),
+ bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) |
+ TempCountField::encode(0) | IsCallField::encode(false) |
+ IsControlField::encode(false)),
+ pointer_map_(NULL) {}
+
+
+Instruction::Instruction(InstructionCode opcode, size_t output_count,
+ InstructionOperand** outputs, size_t input_count,
+ InstructionOperand** inputs, size_t temp_count,
+ InstructionOperand** temps)
+ : opcode_(opcode),
+ bit_field_(OutputCountField::encode(output_count) |
+ InputCountField::encode(input_count) |
+ TempCountField::encode(temp_count) |
+ IsCallField::encode(false) | IsControlField::encode(false)),
+ pointer_map_(NULL) {
+ size_t offset = 0;
+ for (size_t i = 0; i < output_count; ++i) {
+ SetOperand(&operands_[offset++], outputs[i]);
+ }
+ for (size_t i = 0; i < input_count; ++i) {
+ SetOperand(&operands_[offset++], inputs[i]);
+ }
+ for (size_t i = 0; i < temp_count; ++i) {
+ SetOperand(&operands_[offset++], temps[i]);
+ }
+}
+
+
bool GapInstruction::IsRedundant() const {
for (int i = GapInstruction::FIRST_INNER_POSITION;
i <= GapInstruction::LAST_INNER_POSITION; i++) {
« no previous file with comments | « src/compiler/instruction.h ('k') | test/cctest/compiler/test-instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698