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

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

Issue 2649703002: [Atomics] Make Atomics.compareExchange a builtin using TF (Closed)
Patch Set: rebase and move cmpxchg to builtins-sharedarraybuffer-gen.cc Created 3 years, 9 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
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 <algorithm> 5 #include <algorithm>
6 6
7 #include "src/base/adapters.h" 7 #include "src/base/adapters.h"
8 #include "src/compiler/instruction-selector-impl.h" 8 #include "src/compiler/instruction-selector-impl.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 addressing_mode = kMode_MRI; 2332 addressing_mode = kMode_MRI;
2333 } else { 2333 } else {
2334 inputs[input_count++] = g.UseUniqueRegister(index); 2334 inputs[input_count++] = g.UseUniqueRegister(index);
2335 addressing_mode = kMode_MR1; 2335 addressing_mode = kMode_MR1;
2336 } 2336 }
2337 outputs[0] = g.DefineSameAsFirst(node); 2337 outputs[0] = g.DefineSameAsFirst(node);
2338 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); 2338 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
2339 Emit(code, 1, outputs, input_count, inputs); 2339 Emit(code, 1, outputs, input_count, inputs);
2340 } 2340 }
2341 2341
2342 void InstructionSelector::VisitAtomicCompareExchange(Node* node) {
2343 X64OperandGenerator g(this);
2344 Node* base = node->InputAt(0);
2345 Node* index = node->InputAt(1);
2346 Node* old_value = node->InputAt(2);
2347 Node* new_value = node->InputAt(3);
2348
2349 MachineType type = AtomicCompareExchangeRepresentationOf(node->op());
2350 ArchOpcode opcode = kArchNop;
2351 if (type == MachineType::Int8()) {
2352 opcode = kAtomicCompareExchangeInt8;
2353 } else if (type == MachineType::Uint8()) {
2354 opcode = kAtomicCompareExchangeUint8;
2355 } else if (type == MachineType::Int16()) {
2356 opcode = kAtomicCompareExchangeInt16;
2357 } else if (type == MachineType::Uint16()) {
2358 opcode = kAtomicCompareExchangeUint16;
2359 } else if (type == MachineType::Int32() || type == MachineType::Uint32()) {
2360 opcode = kAtomicCompareExchangeWord32;
2361 } else {
2362 UNREACHABLE();
2363 return;
2364 }
2365 InstructionOperand outputs[1];
2366 AddressingMode addressing_mode;
2367 InstructionOperand inputs[4];
2368 size_t input_count = 0;
2369 inputs[input_count++] = g.UseFixed(old_value, rax);
2370 inputs[input_count++] = g.UseUniqueRegister(new_value);
2371 inputs[input_count++] = g.UseUniqueRegister(base);
2372 if (g.CanBeImmediate(index)) {
2373 inputs[input_count++] = g.UseImmediate(index);
2374 addressing_mode = kMode_MRI;
2375 } else {
2376 inputs[input_count++] = g.UseUniqueRegister(index);
2377 addressing_mode = kMode_MR1;
2378 }
2379 outputs[0] = g.DefineAsFixed(node, rax);
2380 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
2381 Emit(code, 1, outputs, input_count, inputs);
2382 }
2383
2342 #define SIMD_TYPES(V) V(Int32x4) 2384 #define SIMD_TYPES(V) V(Int32x4)
2343 2385
2344 #define SIMD_ZERO_OP_LIST(V) \ 2386 #define SIMD_ZERO_OP_LIST(V) \
2345 V(Simd128Zero) \ 2387 V(Simd128Zero) \
2346 V(Simd1x4Zero) \ 2388 V(Simd1x4Zero) \
2347 V(Simd1x8Zero) \ 2389 V(Simd1x8Zero) \
2348 V(Simd1x16Zero) 2390 V(Simd1x16Zero)
2349 2391
2350 #define SIMD_BINOP_LIST(V) \ 2392 #define SIMD_BINOP_LIST(V) \
2351 V(Int32x4Add) \ 2393 V(Int32x4Add) \
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 // static 2495 // static
2454 MachineOperatorBuilder::AlignmentRequirements 2496 MachineOperatorBuilder::AlignmentRequirements
2455 InstructionSelector::AlignmentRequirements() { 2497 InstructionSelector::AlignmentRequirements() {
2456 return MachineOperatorBuilder::AlignmentRequirements:: 2498 return MachineOperatorBuilder::AlignmentRequirements::
2457 FullUnalignedAccessSupport(); 2499 FullUnalignedAccessSupport();
2458 } 2500 }
2459 2501
2460 } // namespace compiler 2502 } // namespace compiler
2461 } // namespace internal 2503 } // namespace internal
2462 } // namespace v8 2504 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698