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

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

Issue 12457034: Ensure that all goto instructions have deoptimization target. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Delete UNREACHABLE Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_optimizer.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 (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 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // Generate runtime call. 497 // Generate runtime call.
498 __ movq(RDX, Address(RSP, 0)); // Get instantiator type arguments. 498 __ movq(RDX, Address(RSP, 0)); // Get instantiator type arguments.
499 __ movq(RCX, Address(RSP, kWordSize)); // Get instantiator. 499 __ movq(RCX, Address(RSP, kWordSize)); // Get instantiator.
500 __ PushObject(Object::ZoneHandle()); // Make room for the result. 500 __ PushObject(Object::ZoneHandle()); // Make room for the result.
501 __ pushq(RAX); // Push the instance. 501 __ pushq(RAX); // Push the instance.
502 __ PushObject(type); // Push the type. 502 __ PushObject(type); // Push the type.
503 __ pushq(RCX); // TODO(srdjan): Pass instantiator instead of null. 503 __ pushq(RCX); // TODO(srdjan): Pass instantiator instead of null.
504 __ pushq(RDX); // Instantiator type arguments. 504 __ pushq(RDX); // Instantiator type arguments.
505 __ LoadObject(RAX, test_cache); 505 __ LoadObject(RAX, test_cache);
506 __ pushq(RAX); 506 __ pushq(RAX);
507 GenerateCallRuntime(token_pos, deopt_id, kInstanceofRuntimeEntry, locs); 507 GenerateCallRuntime(token_pos,
508 deopt_id,
509 kInstanceofRuntimeEntry,
510 locs);
508 // Pop the parameters supplied to the runtime entry. The result of the 511 // Pop the parameters supplied to the runtime entry. The result of the
509 // instanceof runtime call will be left as the result of the operation. 512 // instanceof runtime call will be left as the result of the operation.
510 __ Drop(5); 513 __ Drop(5);
511 if (negate_result) { 514 if (negate_result) {
512 __ popq(RDX); 515 __ popq(RDX);
513 __ LoadObject(RAX, Bool::True()); 516 __ LoadObject(RAX, Bool::True());
514 __ cmpq(RDX, RAX); 517 __ cmpq(RDX, RAX);
515 __ j(NOT_EQUAL, &done, Assembler::kNearJump); 518 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
516 __ LoadObject(RAX, Bool::False()); 519 __ LoadObject(RAX, Bool::False());
517 } else { 520 } else {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 __ Bind(&is_assignable); 620 __ Bind(&is_assignable);
618 __ popq(RDX); // Remove pushed instantiator type arguments. 621 __ popq(RDX); // Remove pushed instantiator type arguments.
619 __ popq(RCX); // Remove pushed instantiator. 622 __ popq(RCX); // Remove pushed instantiator.
620 } 623 }
621 624
622 625
623 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { 626 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) {
624 if (!is_optimizing()) { 627 if (!is_optimizing()) {
625 if (FLAG_enable_type_checks && instr->IsAssertAssignable()) { 628 if (FLAG_enable_type_checks && instr->IsAssertAssignable()) {
626 AssertAssignableInstr* assert = instr->AsAssertAssignable(); 629 AssertAssignableInstr* assert = instr->AsAssertAssignable();
627 AddCurrentDescriptor(PcDescriptors::kDeoptBefore, 630 AddCurrentDescriptor(PcDescriptors::kDeopt,
628 assert->deopt_id(), 631 assert->deopt_id(),
629 assert->token_pos()); 632 assert->token_pos());
630 } else if (instr->IsGuardField()) { 633 } else if (instr->IsGuardField()) {
631 GuardFieldInstr* guard = instr->AsGuardField(); 634 GuardFieldInstr* guard = instr->AsGuardField();
632 AddCurrentDescriptor(PcDescriptors::kDeoptBefore, 635 AddCurrentDescriptor(PcDescriptors::kDeopt,
633 guard->deopt_id(), 636 guard->deopt_id(),
634 Scanner::kDummyTokenIndex); 637 Scanner::kDummyTokenIndex);
638 } else if (instr->CanBeDeoptimizationTarget()) {
639 AddCurrentDescriptor(PcDescriptors::kDeopt,
640 instr->deopt_id(),
641 Scanner::kDummyTokenIndex);
635 } 642 }
636 AllocateRegistersLocally(instr); 643 AllocateRegistersLocally(instr);
637 } 644 }
638 } 645 }
639 646
640 647
641 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { 648 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) {
642 if (is_optimizing()) return; 649 if (is_optimizing()) return;
643 Definition* defn = instr->AsDefinition(); 650 Definition* defn = instr->AsDefinition();
644 if ((defn != NULL) && defn->is_used()) { 651 if ((defn != NULL) && defn->is_used()) {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, 1094 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
1088 intptr_t token_pos, 1095 intptr_t token_pos,
1089 const ExternalLabel* label, 1096 const ExternalLabel* label,
1090 PcDescriptors::Kind kind, 1097 PcDescriptors::Kind kind,
1091 LocationSummary* locs) { 1098 LocationSummary* locs) {
1092 __ call(label); 1099 __ call(label);
1093 AddCurrentDescriptor(kind, deopt_id, token_pos); 1100 AddCurrentDescriptor(kind, deopt_id, token_pos);
1094 RecordSafepoint(locs); 1101 RecordSafepoint(locs);
1095 // Marks either the continuation point in unoptimized code or the 1102 // Marks either the continuation point in unoptimized code or the
1096 // deoptimization point in optimized code, after call. 1103 // deoptimization point in optimized code, after call.
1104 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
1097 if (is_optimizing()) { 1105 if (is_optimizing()) {
1098 AddDeoptIndexAtCall(deopt_id, token_pos); 1106 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1099 } else { 1107 } else {
1100 // Add deoptimization continuation point after the call and before the 1108 // Add deoptimization continuation point after the call and before the
1101 // arguments are removed. 1109 // arguments are removed.
1102 AddCurrentDescriptor(PcDescriptors::kDeoptAfter, 1110 AddCurrentDescriptor(PcDescriptors::kDeopt, deopt_id_after, token_pos);
1103 deopt_id,
1104 token_pos);
1105 } 1111 }
1106 } 1112 }
1107 1113
1108 1114
1109 void FlowGraphCompiler::GenerateCallRuntime(intptr_t token_pos, 1115 void FlowGraphCompiler::GenerateCallRuntime(intptr_t token_pos,
1110 intptr_t deopt_id, 1116 intptr_t deopt_id,
1111 const RuntimeEntry& entry, 1117 const RuntimeEntry& entry,
1112 LocationSummary* locs) { 1118 LocationSummary* locs) {
1113 __ CallRuntime(entry); 1119 __ CallRuntime(entry);
1114 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos); 1120 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos);
1115 RecordSafepoint(locs); 1121 RecordSafepoint(locs);
1116 if (deopt_id != Isolate::kNoDeoptId) { 1122 if (deopt_id != Isolate::kNoDeoptId) {
1117 // Marks either the continuation point in unoptimized code or the 1123 // Marks either the continuation point in unoptimized code or the
1118 // deoptimization point in optimized code, after call. 1124 // deoptimization point in optimized code, after call.
1125 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
1119 if (is_optimizing()) { 1126 if (is_optimizing()) {
1120 AddDeoptIndexAtCall(deopt_id, token_pos); 1127 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1121 } else { 1128 } else {
1122 // Add deoptimization continuation point after the call and before the 1129 // Add deoptimization continuation point after the call and before the
1123 // arguments are removed. 1130 // arguments are removed.
1124 AddCurrentDescriptor(PcDescriptors::kDeoptAfter, 1131 AddCurrentDescriptor(PcDescriptors::kDeopt, deopt_id_after, token_pos);
1125 deopt_id,
1126 token_pos);
1127 } 1132 }
1128 } 1133 }
1129 } 1134 }
1130 1135
1131 1136
1132 void FlowGraphCompiler::EmitOptimizedInstanceCall( 1137 void FlowGraphCompiler::EmitOptimizedInstanceCall(
1133 ExternalLabel* target_label, 1138 ExternalLabel* target_label,
1134 const ICData& ic_data, 1139 const ICData& ic_data,
1135 const Array& arguments_descriptor, 1140 const Array& arguments_descriptor,
1136 intptr_t argument_count, 1141 intptr_t argument_count,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 // be invoked as a normal Dart function. 1233 // be invoked as a normal Dart function.
1229 __ movq(RAX, FieldAddress(RDI, RCX, TIMES_8, base + kWordSize)); 1234 __ movq(RAX, FieldAddress(RDI, RCX, TIMES_8, base + kWordSize));
1230 __ movq(RAX, FieldAddress(RAX, Function::code_offset())); 1235 __ movq(RAX, FieldAddress(RAX, Function::code_offset()));
1231 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset())); 1236 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset()));
1232 __ LoadObject(RBX, ic_data); 1237 __ LoadObject(RBX, ic_data);
1233 __ LoadObject(R10, arguments_descriptor); 1238 __ LoadObject(R10, arguments_descriptor);
1234 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1239 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1235 __ call(RAX); 1240 __ call(RAX);
1236 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); 1241 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos);
1237 RecordSafepoint(locs); 1242 RecordSafepoint(locs);
1238 AddDeoptIndexAtCall(deopt_id, token_pos); 1243 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
1239 __ Drop(argument_count); 1244 __ Drop(argument_count);
1240 } 1245 }
1241 1246
1242 1247
1243 void FlowGraphCompiler::EmitStaticCall(const Function& function, 1248 void FlowGraphCompiler::EmitStaticCall(const Function& function,
1244 const Array& arguments_descriptor, 1249 const Array& arguments_descriptor,
1245 intptr_t argument_count, 1250 intptr_t argument_count,
1246 intptr_t deopt_id, 1251 intptr_t deopt_id,
1247 intptr_t token_pos, 1252 intptr_t token_pos,
1248 LocationSummary* locs) { 1253 LocationSummary* locs) {
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { 1697 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) {
1693 __ Exchange(mem1, mem2); 1698 __ Exchange(mem1, mem2);
1694 } 1699 }
1695 1700
1696 1701
1697 #undef __ 1702 #undef __
1698 1703
1699 } // namespace dart 1704 } // namespace dart
1700 1705
1701 #endif // defined TARGET_ARCH_X64 1706 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698