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

Side by Side Diff: runtime/vm/jit_optimizer.cc

Issue 2896903002: Shuffle around deopt id allocation to give the flow graph builder a chance to record other data as … (Closed)
Patch Set: format Created 3 years, 7 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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 #ifndef DART_PRECOMPILED_RUNTIME 4 #ifndef DART_PRECOMPILED_RUNTIME
5 #include "vm/jit_optimizer.h" 5 #include "vm/jit_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/branch_optimizer.h" 8 #include "vm/branch_optimizer.h"
9 #include "vm/cha.h" 9 #include "vm/cha.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 smi_or_null)) { 597 smi_or_null)) {
598 AddChecksForArgNr(call, left, 0); 598 AddChecksForArgNr(call, left, 0);
599 AddChecksForArgNr(call, right, 0); 599 AddChecksForArgNr(call, right, 0);
600 cid = kSmiCid; 600 cid = kSmiCid;
601 } else { 601 } else {
602 // Shortcut for equality with null. 602 // Shortcut for equality with null.
603 ConstantInstr* right_const = right->AsConstant(); 603 ConstantInstr* right_const = right->AsConstant();
604 ConstantInstr* left_const = left->AsConstant(); 604 ConstantInstr* left_const = left->AsConstant();
605 if ((right_const != NULL && right_const->value().IsNull()) || 605 if ((right_const != NULL && right_const->value().IsNull()) ||
606 (left_const != NULL && left_const->value().IsNull())) { 606 (left_const != NULL && left_const->value().IsNull())) {
607 StrictCompareInstr* comp = new (Z) 607 StrictCompareInstr* comp = new (Z) StrictCompareInstr(
608 StrictCompareInstr(call->token_pos(), Token::kEQ_STRICT, 608 call->token_pos(), Token::kEQ_STRICT, new (Z) Value(left),
609 new (Z) Value(left), new (Z) Value(right), 609 new (Z) Value(right), false, // No number check.
610 false); // No number check. 610 Thread::Current()->GetNextDeoptId());
Vyacheslav Egorov (Google) 2017/05/23 12:00:03 kNoDeoptId (because we are in the optimizer and st
611 ReplaceCall(call, comp); 611 ReplaceCall(call, comp);
612 return true; 612 return true;
613 } 613 }
614 return false; 614 return false;
615 } 615 }
616 } 616 }
617 ASSERT(cid != kIllegalCid); 617 ASSERT(cid != kIllegalCid);
618 EqualityCompareInstr* comp = new (Z) 618 EqualityCompareInstr* comp = new (Z)
619 EqualityCompareInstr(call->token_pos(), op_kind, new (Z) Value(left), 619 EqualityCompareInstr(call->token_pos(), op_kind, new (Z) Value(left),
620 new (Z) Value(right), cid, call->deopt_id()); 620 new (Z) Value(right), cid, call->deopt_id());
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 } 1354 }
1355 } 1355 }
1356 1356
1357 if (TypeCheckAsClassEquality(type)) { 1357 if (TypeCheckAsClassEquality(type)) {
1358 LoadClassIdInstr* left_cid = new (Z) LoadClassIdInstr(new (Z) Value(left)); 1358 LoadClassIdInstr* left_cid = new (Z) LoadClassIdInstr(new (Z) Value(left));
1359 InsertBefore(call, left_cid, NULL, FlowGraph::kValue); 1359 InsertBefore(call, left_cid, NULL, FlowGraph::kValue);
1360 const intptr_t type_cid = Class::Handle(Z, type.type_class()).id(); 1360 const intptr_t type_cid = Class::Handle(Z, type.type_class()).id();
1361 ConstantInstr* cid = 1361 ConstantInstr* cid =
1362 flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(type_cid))); 1362 flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(type_cid)));
1363 1363
1364 StrictCompareInstr* check_cid = 1364 StrictCompareInstr* check_cid = new (Z) StrictCompareInstr(
1365 new (Z) StrictCompareInstr(call->token_pos(), Token::kEQ_STRICT, 1365 call->token_pos(), Token::kEQ_STRICT, new (Z) Value(left_cid),
1366 new (Z) Value(left_cid), new (Z) Value(cid), 1366 new (Z) Value(cid), false, // No number check.
Vyacheslav Egorov (Google) 2017/05/23 12:00:03 maybe better /* number_check = */ false
1367 false); // No number check. 1367 Thread::Current()->GetNextDeoptId());
Vyacheslav Egorov (Google) 2017/05/23 12:00:03 ditto
1368 ReplaceCall(call, check_cid); 1368 ReplaceCall(call, check_cid);
1369 return; 1369 return;
1370 } 1370 }
1371 1371
1372 InstanceOfInstr* instance_of = new (Z) InstanceOfInstr( 1372 InstanceOfInstr* instance_of = new (Z) InstanceOfInstr(
1373 call->token_pos(), new (Z) Value(left), 1373 call->token_pos(), new (Z) Value(left),
1374 new (Z) Value(instantiator_type_args), new (Z) Value(function_type_args), 1374 new (Z) Value(instantiator_type_args), new (Z) Value(function_type_args),
1375 type, call->deopt_id()); 1375 type, call->deopt_id());
1376 ReplaceCall(call, instance_of); 1376 ReplaceCall(call, instance_of);
1377 } 1377 }
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 // Discard the environment from the original instruction because the store 1778 // Discard the environment from the original instruction because the store
1779 // can't deoptimize. 1779 // can't deoptimize.
1780 instr->RemoveEnvironment(); 1780 instr->RemoveEnvironment();
1781 ReplaceCall(instr, store); 1781 ReplaceCall(instr, store);
1782 return true; 1782 return true;
1783 } 1783 }
1784 1784
1785 1785
1786 } // namespace dart 1786 } // namespace dart
1787 #endif // DART_PRECOMPILED_RUNTIME 1787 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698