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

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

Issue 670263007: IR refactoring: consolidate all boxing and unboxing instructions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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/intermediate_language_x64.cc ('k') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Class for intrinsifying functions. 4 // Class for intrinsifying functions.
5 5
6 #include "vm/assembler.h" 6 #include "vm/assembler.h"
7 #include "vm/intrinsifier.h" 7 #include "vm/intrinsifier.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 Isolate::kNoDeoptId, 444 Isolate::kNoDeoptId,
445 1)); 445 1));
446 value_check.AddReceiverCheck(kDoubleCid, 446 value_check.AddReceiverCheck(kDoubleCid,
447 flow_graph->parsed_function().function()); 447 flow_graph->parsed_function().function());
448 builder.AddInstruction( 448 builder.AddInstruction(
449 new CheckClassInstr(new Value(value), 449 new CheckClassInstr(new Value(value),
450 Isolate::kNoDeoptId, 450 Isolate::kNoDeoptId,
451 value_check, 451 value_check,
452 builder.TokenPos())); 452 builder.TokenPos()));
453 Definition* double_value = builder.AddDefinition( 453 Definition* double_value = builder.AddDefinition(
454 new UnboxDoubleInstr(new Value(value), Isolate::kNoDeoptId)); 454 UnboxInstr::Create(kUnboxedDouble,
455 new Value(value),
456 Isolate::kNoDeoptId));
455 // Manually adjust reaching type because there is no type propagation 457 // Manually adjust reaching type because there is no type propagation
456 // when building intrinsics. 458 // when building intrinsics.
457 double_value->AsUnboxDouble()->value()->SetReachingType( 459 double_value->AsUnbox()->value()->SetReachingType(
458 ZoneCompileType::Wrap(CompileType::FromCid(kDoubleCid))); 460 ZoneCompileType::Wrap(CompileType::FromCid(kDoubleCid)));
459 461
460 builder.AddInstruction( 462 builder.AddInstruction(
461 new StoreIndexedInstr(new Value(array), 463 new StoreIndexedInstr(new Value(array),
462 new Value(index), 464 new Value(index),
463 new Value(double_value), 465 new Value(double_value),
464 kNoStoreBarrier, 466 kNoStoreBarrier,
465 8, // index scale 467 8, // index scale
466 kTypedDataFloat64ArrayCid, 468 kTypedDataFloat64ArrayCid,
467 Isolate::kNoDeoptId, 469 Isolate::kNoDeoptId,
(...skipping 19 matching lines...) Expand all
487 PrepareIndexedOp(&builder, array, index, TypedData::length_offset()); 489 PrepareIndexedOp(&builder, array, index, TypedData::length_offset());
488 490
489 Definition* unboxed_value = builder.AddDefinition( 491 Definition* unboxed_value = builder.AddDefinition(
490 new LoadIndexedInstr(new Value(array), 492 new LoadIndexedInstr(new Value(array),
491 new Value(index), 493 new Value(index),
492 8, // index scale 494 8, // index scale
493 kTypedDataFloat64ArrayCid, 495 kTypedDataFloat64ArrayCid,
494 Isolate::kNoDeoptId, 496 Isolate::kNoDeoptId,
495 builder.TokenPos())); 497 builder.TokenPos()));
496 Definition* result = builder.AddDefinition( 498 Definition* result = builder.AddDefinition(
497 new BoxDoubleInstr(new Value(unboxed_value))); 499 BoxInstr::Create(kUnboxedDouble, new Value(unboxed_value)));
498 builder.AddIntrinsicReturn(new Value(result)); 500 builder.AddIntrinsicReturn(new Value(result));
499 return true; 501 return true;
500 } 502 }
501 503
502 504
503 static bool BuildLoadField(FlowGraph* flow_graph, intptr_t offset) { 505 static bool BuildLoadField(FlowGraph* flow_graph, intptr_t offset) {
504 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); 506 GraphEntryInstr* graph_entry = flow_graph->graph_entry();
505 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); 507 TargetEntryInstr* normal_entry = graph_entry->normal_entry();
506 BlockBuilder builder(flow_graph, normal_entry); 508 BlockBuilder builder(flow_graph, normal_entry);
507 509
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 new LoadFieldInstr(new Value(backing_store), 560 new LoadFieldInstr(new Value(backing_store),
559 Array::length_offset(), 561 Array::length_offset(),
560 Type::ZoneHandle(), 562 Type::ZoneHandle(),
561 builder.TokenPos())); 563 builder.TokenPos()));
562 builder.AddIntrinsicReturn(new Value(capacity)); 564 builder.AddIntrinsicReturn(new Value(capacity));
563 return true; 565 return true;
564 } 566 }
565 567
566 568
567 } // namespace dart 569 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698