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

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

Issue 676743002: IR cleanup: pass deopt id as constructor argument instead of doing deopt_id_ assignment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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_builder.cc ('k') | runtime/vm/il_printer.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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 default: 1328 default:
1329 // TODO(fschneider): Add support for other array types. 1329 // TODO(fschneider): Add support for other array types.
1330 UNREACHABLE(); 1330 UNREACHABLE();
1331 } 1331 }
1332 AssertAssignableInstr* assert_value = 1332 AssertAssignableInstr* assert_value =
1333 new(I) AssertAssignableInstr(token_pos, 1333 new(I) AssertAssignableInstr(token_pos,
1334 new(I) Value(stored_value), 1334 new(I) Value(stored_value),
1335 new(I) Value(instantiator), 1335 new(I) Value(instantiator),
1336 new(I) Value(type_args), 1336 new(I) Value(type_args),
1337 value_type, 1337 value_type,
1338 Symbols::Value()); 1338 Symbols::Value(),
1339 // Newly inserted instructions that can deoptimize or throw an exception 1339 call->deopt_id());
1340 // must have a deoptimization id that is valid for lookup in the unoptimized
1341 // code.
1342 assert_value->deopt_id_ = call->deopt_id();
1343 cursor = flow_graph()->AppendTo(cursor, 1340 cursor = flow_graph()->AppendTo(cursor,
1344 assert_value, 1341 assert_value,
1345 call->env(), 1342 call->env(),
1346 FlowGraph::kValue); 1343 FlowGraph::kValue);
1347 } 1344 }
1348 1345
1349 array_cid = PrepareInlineIndexedOp(call, 1346 array_cid = PrepareInlineIndexedOp(call,
1350 array_cid, 1347 array_cid,
1351 &array, 1348 &array,
1352 index, 1349 index,
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after
3293 } 3290 }
3294 3291
3295 3292
3296 bool FlowGraphOptimizer::TryInlineFloat32x4Constructor( 3293 bool FlowGraphOptimizer::TryInlineFloat32x4Constructor(
3297 StaticCallInstr* call, 3294 StaticCallInstr* call,
3298 MethodRecognizer::Kind recognized_kind) { 3295 MethodRecognizer::Kind recognized_kind) {
3299 if (!ShouldInlineSimd()) { 3296 if (!ShouldInlineSimd()) {
3300 return false; 3297 return false;
3301 } 3298 }
3302 if (recognized_kind == MethodRecognizer::kFloat32x4Zero) { 3299 if (recognized_kind == MethodRecognizer::kFloat32x4Zero) {
3303 Float32x4ZeroInstr* zero = 3300 Float32x4ZeroInstr* zero = new(I) Float32x4ZeroInstr();
3304 new(I) Float32x4ZeroInstr(call->deopt_id());
3305 ReplaceCall(call, zero); 3301 ReplaceCall(call, zero);
3306 return true; 3302 return true;
3307 } else if (recognized_kind == MethodRecognizer::kFloat32x4Splat) { 3303 } else if (recognized_kind == MethodRecognizer::kFloat32x4Splat) {
3308 Float32x4SplatInstr* splat = 3304 Float32x4SplatInstr* splat =
3309 new(I) Float32x4SplatInstr( 3305 new(I) Float32x4SplatInstr(
3310 new(I) Value(call->ArgumentAt(1)), call->deopt_id()); 3306 new(I) Value(call->ArgumentAt(1)), call->deopt_id());
3311 ReplaceCall(call, splat); 3307 ReplaceCall(call, splat);
3312 return true; 3308 return true;
3313 } else if (recognized_kind == MethodRecognizer::kFloat32x4Constructor) { 3309 } else if (recognized_kind == MethodRecognizer::kFloat32x4Constructor) {
3314 Float32x4ConstructorInstr* con = 3310 Float32x4ConstructorInstr* con =
(...skipping 22 matching lines...) Expand all
3337 } 3333 }
3338 3334
3339 3335
3340 bool FlowGraphOptimizer::TryInlineFloat64x2Constructor( 3336 bool FlowGraphOptimizer::TryInlineFloat64x2Constructor(
3341 StaticCallInstr* call, 3337 StaticCallInstr* call,
3342 MethodRecognizer::Kind recognized_kind) { 3338 MethodRecognizer::Kind recognized_kind) {
3343 if (!ShouldInlineSimd()) { 3339 if (!ShouldInlineSimd()) {
3344 return false; 3340 return false;
3345 } 3341 }
3346 if (recognized_kind == MethodRecognizer::kFloat64x2Zero) { 3342 if (recognized_kind == MethodRecognizer::kFloat64x2Zero) {
3347 Float64x2ZeroInstr* zero = 3343 Float64x2ZeroInstr* zero = new(I) Float64x2ZeroInstr();
3348 new(I) Float64x2ZeroInstr(call->deopt_id());
3349 ReplaceCall(call, zero); 3344 ReplaceCall(call, zero);
3350 return true; 3345 return true;
3351 } else if (recognized_kind == MethodRecognizer::kFloat64x2Splat) { 3346 } else if (recognized_kind == MethodRecognizer::kFloat64x2Splat) {
3352 Float64x2SplatInstr* splat = 3347 Float64x2SplatInstr* splat =
3353 new(I) Float64x2SplatInstr( 3348 new(I) Float64x2SplatInstr(
3354 new(I) Value(call->ArgumentAt(1)), call->deopt_id()); 3349 new(I) Value(call->ArgumentAt(1)), call->deopt_id());
3355 ReplaceCall(call, splat); 3350 ReplaceCall(call, splat);
3356 return true; 3351 return true;
3357 } else if (recognized_kind == MethodRecognizer::kFloat64x2Constructor) { 3352 } else if (recognized_kind == MethodRecognizer::kFloat64x2Constructor) {
3358 Float64x2ConstructorInstr* con = 3353 Float64x2ConstructorInstr* con =
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
4303 } 4298 }
4304 } 4299 }
4305 const String& dst_name = String::ZoneHandle(I, 4300 const String& dst_name = String::ZoneHandle(I,
4306 Symbols::New(Exceptions::kCastErrorDstName)); 4301 Symbols::New(Exceptions::kCastErrorDstName));
4307 AssertAssignableInstr* assert_as = 4302 AssertAssignableInstr* assert_as =
4308 new(I) AssertAssignableInstr(call->token_pos(), 4303 new(I) AssertAssignableInstr(call->token_pos(),
4309 new(I) Value(left), 4304 new(I) Value(left),
4310 new(I) Value(instantiator), 4305 new(I) Value(instantiator),
4311 new(I) Value(type_args), 4306 new(I) Value(type_args),
4312 type, 4307 type,
4313 dst_name); 4308 dst_name,
4314 // Newly inserted instructions that can deoptimize or throw an exception 4309 call->deopt_id());
4315 // must have a deoptimization id that is valid for lookup in the unoptimized
4316 // code.
4317 assert_as->deopt_id_ = call->deopt_id();
4318 ReplaceCall(call, assert_as); 4310 ReplaceCall(call, assert_as);
4319 } 4311 }
4320 4312
4321 4313
4322 // Tries to optimize instance call by replacing it with a faster instruction 4314 // Tries to optimize instance call by replacing it with a faster instruction
4323 // (e.g, binary op, field load, ..). 4315 // (e.g, binary op, field load, ..).
4324 void FlowGraphOptimizer::VisitInstanceCall(InstanceCallInstr* instr) { 4316 void FlowGraphOptimizer::VisitInstanceCall(InstanceCallInstr* instr) {
4325 if (!instr->HasICData() || (instr->ic_data()->NumberOfUsedChecks() == 0)) { 4317 if (!instr->HasICData() || (instr->ic_data()->NumberOfUsedChecks() == 0)) {
4326 return; 4318 return;
4327 } 4319 }
(...skipping 5779 matching lines...) Expand 10 before | Expand all | Expand 10 after
10107 10099
10108 // Insert materializations at environment uses. 10100 // Insert materializations at environment uses.
10109 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 10101 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
10110 CreateMaterializationAt( 10102 CreateMaterializationAt(
10111 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); 10103 exits_collector_.exits()[i], alloc, alloc->cls(), *slots);
10112 } 10104 }
10113 } 10105 }
10114 10106
10115 10107
10116 } // namespace dart 10108 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698