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

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

Issue 2161543002: [turbofan] Add support for eager/soft deoptimization reasons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do the ports properly Created 4 years, 5 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/arm64/code-generator-arm64.cc ('k') | src/compiler/branch-elimination.cc » ('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/compiler/instruction-selector-impl.h" 5 #include "src/compiler/instruction-selector-impl.h"
6 #include "src/compiler/node-matchers.h" 6 #include "src/compiler/node-matchers.h"
7 #include "src/compiler/node-properties.h" 7 #include "src/compiler/node-properties.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 402 }
403 403
404 DCHECK_NE(0u, input_count); 404 DCHECK_NE(0u, input_count);
405 DCHECK((output_count != 0) || IsComparisonField::decode(properties)); 405 DCHECK((output_count != 0) || IsComparisonField::decode(properties));
406 DCHECK_GE(arraysize(inputs), input_count); 406 DCHECK_GE(arraysize(inputs), input_count);
407 DCHECK_GE(arraysize(outputs), output_count); 407 DCHECK_GE(arraysize(outputs), output_count);
408 408
409 opcode = cont->Encode(opcode); 409 opcode = cont->Encode(opcode);
410 if (cont->IsDeoptimize()) { 410 if (cont->IsDeoptimize()) {
411 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs, 411 selector->EmitDeoptimize(opcode, output_count, outputs, input_count, inputs,
412 cont->frame_state()); 412 cont->reason(), cont->frame_state());
413 } else { 413 } else {
414 selector->Emit(opcode, output_count, outputs, input_count, inputs); 414 selector->Emit(opcode, output_count, outputs, input_count, inputs);
415 } 415 }
416 } 416 }
417 417
418 418
419 // Shared routine for multiple binary operations. 419 // Shared routine for multiple binary operations.
420 template <typename Matcher> 420 template <typename Matcher>
421 void VisitBinop(InstructionSelector* selector, Node* node, ArchOpcode opcode, 421 void VisitBinop(InstructionSelector* selector, Node* node, ArchOpcode opcode,
422 ImmediateMode operand_mode) { 422 ImmediateMode operand_mode) {
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 InstructionOperand right = g.UseRegister(m.right().node()); 1281 InstructionOperand right = g.UseRegister(m.right().node());
1282 selector->Emit(kArm64Smull, result, left, right); 1282 selector->Emit(kArm64Smull, result, left, right);
1283 1283
1284 InstructionCode opcode = cont->Encode(kArm64Cmp) | 1284 InstructionCode opcode = cont->Encode(kArm64Cmp) |
1285 AddressingModeField::encode(kMode_Operand2_R_SXTW); 1285 AddressingModeField::encode(kMode_Operand2_R_SXTW);
1286 if (cont->IsBranch()) { 1286 if (cont->IsBranch()) {
1287 selector->Emit(opcode, g.NoOutput(), result, result, 1287 selector->Emit(opcode, g.NoOutput(), result, result,
1288 g.Label(cont->true_block()), g.Label(cont->false_block())); 1288 g.Label(cont->true_block()), g.Label(cont->false_block()));
1289 } else if (cont->IsDeoptimize()) { 1289 } else if (cont->IsDeoptimize()) {
1290 InstructionOperand in[] = {result, result}; 1290 InstructionOperand in[] = {result, result};
1291 selector->EmitDeoptimize(opcode, 0, nullptr, 2, in, cont->frame_state()); 1291 selector->EmitDeoptimize(opcode, 0, nullptr, 2, in, cont->reason(),
1292 cont->frame_state());
1292 } else { 1293 } else {
1293 DCHECK(cont->IsSet()); 1294 DCHECK(cont->IsSet());
1294 selector->Emit(opcode, g.DefineAsRegister(cont->result()), result, result); 1295 selector->Emit(opcode, g.DefineAsRegister(cont->result()), result, result);
1295 } 1296 }
1296 } 1297 }
1297 1298
1298 } // namespace 1299 } // namespace
1299 1300
1300 void InstructionSelector::VisitInt32Mul(Node* node) { 1301 void InstructionSelector::VisitInt32Mul(Node* node) {
1301 Arm64OperandGenerator g(this); 1302 Arm64OperandGenerator g(this);
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 // Shared routine for multiple compare operations. 1909 // Shared routine for multiple compare operations.
1909 void VisitCompare(InstructionSelector* selector, InstructionCode opcode, 1910 void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
1910 InstructionOperand left, InstructionOperand right, 1911 InstructionOperand left, InstructionOperand right,
1911 FlagsContinuation* cont) { 1912 FlagsContinuation* cont) {
1912 Arm64OperandGenerator g(selector); 1913 Arm64OperandGenerator g(selector);
1913 opcode = cont->Encode(opcode); 1914 opcode = cont->Encode(opcode);
1914 if (cont->IsBranch()) { 1915 if (cont->IsBranch()) {
1915 selector->Emit(opcode, g.NoOutput(), left, right, 1916 selector->Emit(opcode, g.NoOutput(), left, right,
1916 g.Label(cont->true_block()), g.Label(cont->false_block())); 1917 g.Label(cont->true_block()), g.Label(cont->false_block()));
1917 } else if (cont->IsDeoptimize()) { 1918 } else if (cont->IsDeoptimize()) {
1918 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, 1919 selector->EmitDeoptimize(opcode, g.NoOutput(), left, right, cont->reason(),
1919 cont->frame_state()); 1920 cont->frame_state());
1920 } else { 1921 } else {
1921 DCHECK(cont->IsSet()); 1922 DCHECK(cont->IsSet());
1922 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); 1923 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right);
1923 } 1924 }
1924 } 1925 }
1925 1926
1926 1927
1927 // Shared routine for multiple word compare operations. 1928 // Shared routine for multiple word compare operations.
1928 void VisitWordCompare(InstructionSelector* selector, Node* node, 1929 void VisitWordCompare(InstructionSelector* selector, Node* node,
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 2322
2322 // Branch could not be combined with a compare, compare against 0 and branch. 2323 // Branch could not be combined with a compare, compare against 0 and branch.
2323 if (cont->IsBranch()) { 2324 if (cont->IsBranch()) {
2324 selector->Emit(cont->Encode(kArm64CompareAndBranch32), g.NoOutput(), 2325 selector->Emit(cont->Encode(kArm64CompareAndBranch32), g.NoOutput(),
2325 g.UseRegister(value), g.Label(cont->true_block()), 2326 g.UseRegister(value), g.Label(cont->true_block()),
2326 g.Label(cont->false_block())); 2327 g.Label(cont->false_block()));
2327 } else { 2328 } else {
2328 DCHECK(cont->IsDeoptimize()); 2329 DCHECK(cont->IsDeoptimize());
2329 selector->EmitDeoptimize(cont->Encode(kArm64Tst32), g.NoOutput(), 2330 selector->EmitDeoptimize(cont->Encode(kArm64Tst32), g.NoOutput(),
2330 g.UseRegister(value), g.UseRegister(value), 2331 g.UseRegister(value), g.UseRegister(value),
2331 cont->frame_state()); 2332 cont->reason(), cont->frame_state());
2332 } 2333 }
2333 } 2334 }
2334 2335
2335 } // namespace 2336 } // namespace
2336 2337
2337 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, 2338 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
2338 BasicBlock* fbranch) { 2339 BasicBlock* fbranch) {
2339 FlagsContinuation cont(kNotEqual, tbranch, fbranch); 2340 FlagsContinuation cont(kNotEqual, tbranch, fbranch);
2340 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont); 2341 VisitWordCompareZero(this, branch, branch->InputAt(0), &cont);
2341 } 2342 }
2342 2343
2343 void InstructionSelector::VisitDeoptimizeIf(Node* node) { 2344 void InstructionSelector::VisitDeoptimizeIf(Node* node) {
2344 FlagsContinuation cont = 2345 FlagsContinuation cont = FlagsContinuation::ForDeoptimize(
2345 FlagsContinuation::ForDeoptimize(kNotEqual, node->InputAt(1)); 2346 kNotEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1));
2346 VisitWordCompareZero(this, node, node->InputAt(0), &cont); 2347 VisitWordCompareZero(this, node, node->InputAt(0), &cont);
2347 } 2348 }
2348 2349
2349 void InstructionSelector::VisitDeoptimizeUnless(Node* node) { 2350 void InstructionSelector::VisitDeoptimizeUnless(Node* node) {
2350 FlagsContinuation cont = 2351 FlagsContinuation cont = FlagsContinuation::ForDeoptimize(
2351 FlagsContinuation::ForDeoptimize(kEqual, node->InputAt(1)); 2352 kEqual, DeoptimizeReasonOf(node->op()), node->InputAt(1));
2352 VisitWordCompareZero(this, node, node->InputAt(0), &cont); 2353 VisitWordCompareZero(this, node, node->InputAt(0), &cont);
2353 } 2354 }
2354 2355
2355 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) { 2356 void InstructionSelector::VisitSwitch(Node* node, const SwitchInfo& sw) {
2356 Arm64OperandGenerator g(this); 2357 Arm64OperandGenerator g(this);
2357 InstructionOperand value_operand = g.UseRegister(node->InputAt(0)); 2358 InstructionOperand value_operand = g.UseRegister(node->InputAt(0));
2358 2359
2359 // Emit either ArchTableSwitch or ArchLookupSwitch. 2360 // Emit either ArchTableSwitch or ArchLookupSwitch.
2360 size_t table_space_cost = 4 + sw.value_range; 2361 size_t table_space_cost = 4 + sw.value_range;
2361 size_t table_time_cost = 3; 2362 size_t table_time_cost = 3;
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2722 // static 2723 // static
2723 MachineOperatorBuilder::AlignmentRequirements 2724 MachineOperatorBuilder::AlignmentRequirements
2724 InstructionSelector::AlignmentRequirements() { 2725 InstructionSelector::AlignmentRequirements() {
2725 return MachineOperatorBuilder::AlignmentRequirements:: 2726 return MachineOperatorBuilder::AlignmentRequirements::
2726 FullUnalignedAccessSupport(); 2727 FullUnalignedAccessSupport();
2727 } 2728 }
2728 2729
2729 } // namespace compiler 2730 } // namespace compiler
2730 } // namespace internal 2731 } // namespace internal
2731 } // namespace v8 2732 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/code-generator-arm64.cc ('k') | src/compiler/branch-elimination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698