OLD | NEW |
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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 243 |
244 Definition* AddParameter(intptr_t index) { | 244 Definition* AddParameter(intptr_t index) { |
245 intptr_t adjustment = Intrinsifier::ParameterSlotFromSp(); | 245 intptr_t adjustment = Intrinsifier::ParameterSlotFromSp(); |
246 return AddToInitialDefinitions( | 246 return AddToInitialDefinitions( |
247 new ParameterInstr(adjustment + index, | 247 new ParameterInstr(adjustment + index, |
248 flow_graph_->graph_entry(), | 248 flow_graph_->graph_entry(), |
249 SPREG)); | 249 SPREG)); |
250 } | 250 } |
251 | 251 |
252 intptr_t TokenPos() { | 252 intptr_t TokenPos() { |
253 return flow_graph_->parsed_function()->function().token_pos(); | 253 return flow_graph_->function().token_pos(); |
254 } | 254 } |
255 | 255 |
256 private: | 256 private: |
257 FlowGraph* flow_graph_; | 257 FlowGraph* flow_graph_; |
258 BlockEntryInstr* entry_; | 258 BlockEntryInstr* entry_; |
259 Instruction* current_; | 259 Instruction* current_; |
260 }; | 260 }; |
261 | 261 |
262 | 262 |
263 static void PrepareIndexedOp(BlockBuilder* builder, | 263 static void PrepareIndexedOp(BlockBuilder* builder, |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); | 431 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
432 BlockBuilder builder(flow_graph, normal_entry); | 432 BlockBuilder builder(flow_graph, normal_entry); |
433 | 433 |
434 Definition* value = builder.AddParameter(1); | 434 Definition* value = builder.AddParameter(1); |
435 Definition* index = builder.AddParameter(2); | 435 Definition* index = builder.AddParameter(2); |
436 Definition* array = builder.AddParameter(3); | 436 Definition* array = builder.AddParameter(3); |
437 | 437 |
438 PrepareIndexedOp(&builder, array, index, TypedData::length_offset()); | 438 PrepareIndexedOp(&builder, array, index, TypedData::length_offset()); |
439 | 439 |
440 const ICData& value_check = ICData::ZoneHandle(ICData::New( | 440 const ICData& value_check = ICData::ZoneHandle(ICData::New( |
441 flow_graph->parsed_function()->function(), | 441 flow_graph->function(), |
442 String::Handle(flow_graph->parsed_function()->function().name()), | 442 String::Handle(flow_graph->function().name()), |
443 Object::empty_array(), // Dummy args. descr. | 443 Object::empty_array(), // Dummy args. descr. |
444 Isolate::kNoDeoptId, | 444 Isolate::kNoDeoptId, |
445 1)); | 445 1)); |
446 value_check.AddReceiverCheck(kDoubleCid, | 446 value_check.AddReceiverCheck(kDoubleCid, flow_graph->function()); |
447 flow_graph->parsed_function()->function()); | |
448 builder.AddInstruction( | 447 builder.AddInstruction( |
449 new CheckClassInstr(new Value(value), | 448 new CheckClassInstr(new Value(value), |
450 Isolate::kNoDeoptId, | 449 Isolate::kNoDeoptId, |
451 value_check, | 450 value_check, |
452 builder.TokenPos())); | 451 builder.TokenPos())); |
453 Definition* double_value = builder.AddDefinition( | 452 Definition* double_value = builder.AddDefinition( |
454 UnboxInstr::Create(kUnboxedDouble, | 453 UnboxInstr::Create(kUnboxedDouble, |
455 new Value(value), | 454 new Value(value), |
456 Isolate::kNoDeoptId)); | 455 Isolate::kNoDeoptId)); |
457 // Manually adjust reaching type because there is no type propagation | 456 // Manually adjust reaching type because there is no type propagation |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 new LoadFieldInstr(new Value(backing_store), | 559 new LoadFieldInstr(new Value(backing_store), |
561 Array::length_offset(), | 560 Array::length_offset(), |
562 Type::ZoneHandle(), | 561 Type::ZoneHandle(), |
563 builder.TokenPos())); | 562 builder.TokenPos())); |
564 builder.AddIntrinsicReturn(new Value(capacity)); | 563 builder.AddIntrinsicReturn(new Value(capacity)); |
565 return true; | 564 return true; |
566 } | 565 } |
567 | 566 |
568 | 567 |
569 } // namespace dart | 568 } // namespace dart |
OLD | NEW |