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

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

Issue 2362453003: Fix Endian issue in interpreter in EmitBytecode (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | no next file » | 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 "src/api.h" 7 #include "src/api.h"
8 #include "src/interpreter/bytecode-label.h" 8 #include "src/interpreter/bytecode-label.h"
9 #include "src/interpreter/bytecode-register.h" 9 #include "src/interpreter/bytecode-register.h"
10 #include "src/interpreter/constant-array-builder.h" 10 #include "src/interpreter/constant-array-builder.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 Bytecodes::GetOperandSizes(bytecode, operand_scale); 118 Bytecodes::GetOperandSizes(bytecode, operand_scale);
119 for (int i = 0; i < operand_count; ++i) { 119 for (int i = 0; i < operand_count; ++i) {
120 switch (operand_sizes[i]) { 120 switch (operand_sizes[i]) {
121 case OperandSize::kNone: 121 case OperandSize::kNone:
122 UNREACHABLE(); 122 UNREACHABLE();
123 break; 123 break;
124 case OperandSize::kByte: 124 case OperandSize::kByte:
125 bytecodes()->push_back(static_cast<uint8_t>(operands[i])); 125 bytecodes()->push_back(static_cast<uint8_t>(operands[i]));
126 break; 126 break;
127 case OperandSize::kShort: { 127 case OperandSize::kShort: {
128 const uint8_t* raw_operand = 128 uint16_t operand = static_cast<uint16_t>(operands[i]);
129 reinterpret_cast<const uint8_t*>(&operands[i]); 129 const uint8_t* raw_operand = reinterpret_cast<const uint8_t*>(&operand);
130 bytecodes()->push_back(raw_operand[0]); 130 bytecodes()->push_back(raw_operand[0]);
131 bytecodes()->push_back(raw_operand[1]); 131 bytecodes()->push_back(raw_operand[1]);
132 break; 132 break;
133 } 133 }
134 case OperandSize::kQuad: { 134 case OperandSize::kQuad: {
135 const uint8_t* raw_operand = 135 const uint8_t* raw_operand =
136 reinterpret_cast<const uint8_t*>(&operands[i]); 136 reinterpret_cast<const uint8_t*>(&operands[i]);
137 bytecodes()->push_back(raw_operand[0]); 137 bytecodes()->push_back(raw_operand[0]);
138 bytecodes()->push_back(raw_operand[1]); 138 bytecodes()->push_back(raw_operand[1]);
139 bytecodes()->push_back(raw_operand[2]); 139 bytecodes()->push_back(raw_operand[2]);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder); 319 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder);
320 break; 320 break;
321 } 321 }
322 } 322 }
323 EmitBytecode(node); 323 EmitBytecode(node);
324 } 324 }
325 325
326 } // namespace interpreter 326 } // namespace interpreter
327 } // namespace internal 327 } // namespace internal
328 } // namespace v8 328 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698