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

Side by Side Diff: src/compiler/ia32/instruction-selector-ia32.cc

Issue 2814753003: [SAB] Validate index before value conversion (Closed)
Patch Set: feedback Created 3 years, 8 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/compiler/ia32/code-generator-ia32.cc ('k') | test/mjsunit/harmony/atomics.js » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/compiler/instruction-selector-impl.h" 6 #include "src/compiler/instruction-selector-impl.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 } else if (type == MachineType::Int32() || type == MachineType::Uint32()) { 1857 } else if (type == MachineType::Int32() || type == MachineType::Uint32()) {
1858 opcode = word32_op; 1858 opcode = word32_op;
1859 } else { 1859 } else {
1860 UNREACHABLE(); 1860 UNREACHABLE();
1861 return; 1861 return;
1862 } 1862 }
1863 InstructionOperand outputs[1]; 1863 InstructionOperand outputs[1];
1864 AddressingMode addressing_mode; 1864 AddressingMode addressing_mode;
1865 InstructionOperand inputs[3]; 1865 InstructionOperand inputs[3];
1866 size_t input_count = 0; 1866 size_t input_count = 0;
1867 if (type == MachineType::Int8() || type == MachineType::Uint8()) { 1867 inputs[input_count++] = g.UseUniqueRegister(value);
1868 inputs[input_count++] = g.UseByteRegister(value);
1869 } else {
1870 inputs[input_count++] = g.UseUniqueRegister(value);
1871 }
1872 inputs[input_count++] = g.UseUniqueRegister(base); 1868 inputs[input_count++] = g.UseUniqueRegister(base);
1873 if (g.CanBeImmediate(index)) { 1869 if (g.CanBeImmediate(index)) {
1874 inputs[input_count++] = g.UseImmediate(index); 1870 inputs[input_count++] = g.UseImmediate(index);
1875 addressing_mode = kMode_MRI; 1871 addressing_mode = kMode_MRI;
1876 } else { 1872 } else {
1877 inputs[input_count++] = g.UseUniqueRegister(index); 1873 inputs[input_count++] = g.UseUniqueRegister(index);
1878 addressing_mode = kMode_MR1; 1874 addressing_mode = kMode_MR1;
1879 } 1875 }
1880 outputs[0] = g.DefineAsFixed(node, eax); 1876 outputs[0] = g.DefineAsFixed(node, eax);
1881 InstructionOperand temp[1]; 1877 InstructionOperand temp[1];
1882 temp[0] = g.TempRegister(); 1878 if (type == MachineType::Int8() || type == MachineType::Uint8()) {
1879 temp[0] = g.UseByteRegister(node);
1880 } else {
1881 temp[0] = g.TempRegister();
1882 }
1883 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); 1883 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
1884 Emit(code, 1, outputs, input_count, inputs, 1, temp); 1884 Emit(code, 1, outputs, input_count, inputs, 1, temp);
1885 } 1885 }
1886 1886
1887 #define VISIT_ATOMIC_BINOP(op) \ 1887 #define VISIT_ATOMIC_BINOP(op) \
1888 void InstructionSelector::VisitAtomic##op(Node* node) { \ 1888 void InstructionSelector::VisitAtomic##op(Node* node) { \
1889 VisitAtomicBinaryOperation(node, kAtomic##op##Int8, kAtomic##op##Uint8, \ 1889 VisitAtomicBinaryOperation(node, kAtomic##op##Int8, kAtomic##op##Uint8, \
1890 kAtomic##op##Int16, kAtomic##op##Uint16, \ 1890 kAtomic##op##Int16, kAtomic##op##Uint16, \
1891 kAtomic##op##Word32); \ 1891 kAtomic##op##Word32); \
1892 } 1892 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 // static 1949 // static
1950 MachineOperatorBuilder::AlignmentRequirements 1950 MachineOperatorBuilder::AlignmentRequirements
1951 InstructionSelector::AlignmentRequirements() { 1951 InstructionSelector::AlignmentRequirements() {
1952 return MachineOperatorBuilder::AlignmentRequirements:: 1952 return MachineOperatorBuilder::AlignmentRequirements::
1953 FullUnalignedAccessSupport(); 1953 FullUnalignedAccessSupport();
1954 } 1954 }
1955 1955
1956 } // namespace compiler 1956 } // namespace compiler
1957 } // namespace internal 1957 } // namespace internal
1958 } // namespace v8 1958 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ia32/code-generator-ia32.cc ('k') | test/mjsunit/harmony/atomics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698