OLD | NEW |
---|---|
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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/flow_graph_allocator.h" | 10 #include "vm/flow_graph_allocator.h" |
11 #include "vm/flow_graph_builder.h" | 11 #include "vm/flow_graph_builder.h" |
12 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
13 #include "vm/flow_graph_optimizer.h" | 13 #include "vm/flow_graph_optimizer.h" |
14 #include "vm/flow_graph_range_analysis.h" | 14 #include "vm/flow_graph_range_analysis.h" |
15 #include "vm/locations.h" | 15 #include "vm/locations.h" |
16 #include "vm/method_recognizer.h" | 16 #include "vm/method_recognizer.h" |
17 #include "vm/object.h" | 17 #include "vm/object.h" |
18 #include "vm/object_store.h" | 18 #include "vm/object_store.h" |
19 #include "vm/os.h" | 19 #include "vm/os.h" |
20 #include "vm/regexp_assembler.h" | |
20 #include "vm/resolver.h" | 21 #include "vm/resolver.h" |
21 #include "vm/scopes.h" | 22 #include "vm/scopes.h" |
22 #include "vm/stub_code.h" | 23 #include "vm/stub_code.h" |
23 #include "vm/symbols.h" | 24 #include "vm/symbols.h" |
24 | 25 |
25 #include "vm/il_printer.h" | 26 #include "vm/il_printer.h" |
26 | 27 |
27 namespace dart { | 28 namespace dart { |
28 | 29 |
29 DEFINE_FLAG(bool, propagate_ic_data, true, | 30 DEFINE_FLAG(bool, propagate_ic_data, true, |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 } | 364 } |
364 | 365 |
365 | 366 |
366 bool LoadIndexedInstr::AttributesEqual(Instruction* other) const { | 367 bool LoadIndexedInstr::AttributesEqual(Instruction* other) const { |
367 LoadIndexedInstr* other_load = other->AsLoadIndexed(); | 368 LoadIndexedInstr* other_load = other->AsLoadIndexed(); |
368 ASSERT(other_load != NULL); | 369 ASSERT(other_load != NULL); |
369 return class_id() == other_load->class_id(); | 370 return class_id() == other_load->class_id(); |
370 } | 371 } |
371 | 372 |
372 | 373 |
374 bool LoadCodeUnitsInstr::AttributesEqual(Instruction* other) const { | |
375 LoadCodeUnitsInstr* other_load = other->AsLoadCodeUnits(); | |
376 ASSERT(other_load != NULL); | |
377 return (class_id() == other_load->class_id() && | |
378 element_count() == other_load->element_count()); | |
Florian Schneider
2014/10/01 17:04:13
Did you forget checking index_scale()?
jgruber1
2014/10/03 18:59:51
I removed the index_scale_ member since index_scal
| |
379 } | |
380 | |
381 | |
373 ConstantInstr::ConstantInstr(const Object& value) : value_(value) { | 382 ConstantInstr::ConstantInstr(const Object& value) : value_(value) { |
374 // Check that the value is not an incorrect Integer representation. | 383 // Check that the value is not an incorrect Integer representation. |
375 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoSmi()); | 384 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoSmi()); |
376 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoInt64()); | 385 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoInt64()); |
377 ASSERT(!value.IsMint() || !Smi::IsValid(Mint::Cast(value).AsInt64Value())); | 386 ASSERT(!value.IsMint() || !Smi::IsValid(Mint::Cast(value).AsInt64Value())); |
378 } | 387 } |
379 | 388 |
380 | 389 |
381 bool ConstantInstr::AttributesEqual(Instruction* other) const { | 390 bool ConstantInstr::AttributesEqual(Instruction* other) const { |
382 ConstantInstr* other_constant = other->AsConstant(); | 391 ConstantInstr* other_constant = other->AsConstant(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 } | 462 } |
454 | 463 |
455 | 464 |
456 GraphEntryInstr::GraphEntryInstr(const ParsedFunction* parsed_function, | 465 GraphEntryInstr::GraphEntryInstr(const ParsedFunction* parsed_function, |
457 TargetEntryInstr* normal_entry, | 466 TargetEntryInstr* normal_entry, |
458 intptr_t osr_id) | 467 intptr_t osr_id) |
459 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex), | 468 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex), |
460 parsed_function_(parsed_function), | 469 parsed_function_(parsed_function), |
461 normal_entry_(normal_entry), | 470 normal_entry_(normal_entry), |
462 catch_entries_(), | 471 catch_entries_(), |
472 indirect_entries_(), | |
463 initial_definitions_(), | 473 initial_definitions_(), |
464 osr_id_(osr_id), | 474 osr_id_(osr_id), |
465 entry_count_(0), | 475 entry_count_(0), |
466 spill_slot_count_(0), | 476 spill_slot_count_(0), |
467 fixed_slot_count_(0) { | 477 fixed_slot_count_(0) { |
468 } | 478 } |
469 | 479 |
470 | 480 |
471 ConstantInstr* GraphEntryInstr::constant_null() { | 481 ConstantInstr* GraphEntryInstr::constant_null() { |
472 ASSERT(initial_definitions_.length() > 0); | 482 ASSERT(initial_definitions_.length() > 0); |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1769 | 1779 |
1770 | 1780 |
1771 // A math unary instruction has a side effect (exception | 1781 // A math unary instruction has a side effect (exception |
1772 // thrown) if the argument is not a number. | 1782 // thrown) if the argument is not a number. |
1773 // TODO(srdjan): eliminate if has no uses and input is guaranteed to be number. | 1783 // TODO(srdjan): eliminate if has no uses and input is guaranteed to be number. |
1774 Definition* MathUnaryInstr::Canonicalize(FlowGraph* flow_graph) { | 1784 Definition* MathUnaryInstr::Canonicalize(FlowGraph* flow_graph) { |
1775 return this; | 1785 return this; |
1776 } | 1786 } |
1777 | 1787 |
1778 | 1788 |
1789 Definition* CaseInsensitiveCompareUC16Instr::Canonicalize( | |
Florian Schneider
2014/10/01 17:04:13
Just remove CaseInsensitiveCompareUC16Instr::Canon
jgruber1
2014/10/03 18:59:51
Done.
| |
1790 FlowGraph* flow_graph) { | |
1791 return this; | |
1792 } | |
1793 | |
1794 | |
1779 Definition* LoadFieldInstr::Canonicalize(FlowGraph* flow_graph) { | 1795 Definition* LoadFieldInstr::Canonicalize(FlowGraph* flow_graph) { |
1780 if (!HasUses()) return NULL; | 1796 if (!HasUses()) return NULL; |
1781 if (!IsImmutableLengthLoad()) return this; | 1797 if (!IsImmutableLengthLoad()) return this; |
1782 | 1798 |
1783 // For fixed length arrays if the array is the result of a known constructor | 1799 // For fixed length arrays if the array is the result of a known constructor |
1784 // call we can replace the length load with the length argument passed to | 1800 // call we can replace the length load with the length argument passed to |
1785 // the constructor. | 1801 // the constructor. |
1786 StaticCallInstr* call = instance()->definition()->AsStaticCall(); | 1802 StaticCallInstr* call = instance()->definition()->AsStaticCall(); |
1787 if (call != NULL) { | 1803 if (call != NULL) { |
1788 if (call->is_known_list_constructor() && | 1804 if (call->is_known_list_constructor() && |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2501 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 2517 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
2502 deopt_id_, | 2518 deopt_id_, |
2503 Scanner::kNoSourcePos); | 2519 Scanner::kNoSourcePos); |
2504 } | 2520 } |
2505 if (HasParallelMove()) { | 2521 if (HasParallelMove()) { |
2506 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2522 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
2507 } | 2523 } |
2508 } | 2524 } |
2509 | 2525 |
2510 | 2526 |
2527 LocationSummary* IndirectEntryInstr::MakeLocationSummary( | |
2528 Isolate* isolate, bool optimizing) const { | |
2529 UNREACHABLE(); | |
2530 return NULL; | |
2531 } | |
2532 | |
2533 | |
2511 LocationSummary* PhiInstr::MakeLocationSummary(Isolate* isolate, | 2534 LocationSummary* PhiInstr::MakeLocationSummary(Isolate* isolate, |
2512 bool optimizing) const { | 2535 bool optimizing) const { |
2513 UNREACHABLE(); | 2536 UNREACHABLE(); |
2514 return NULL; | 2537 return NULL; |
2515 } | 2538 } |
2516 | 2539 |
2517 | 2540 |
2518 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2541 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2519 UNREACHABLE(); | 2542 UNREACHABLE(); |
2520 } | 2543 } |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3281 case kIllegal: return "illegal"; | 3304 case kIllegal: return "illegal"; |
3282 case kSin: return "sin"; | 3305 case kSin: return "sin"; |
3283 case kCos: return "cos"; | 3306 case kCos: return "cos"; |
3284 case kSqrt: return "sqrt"; | 3307 case kSqrt: return "sqrt"; |
3285 case kDoubleSquare: return "double-square"; | 3308 case kDoubleSquare: return "double-square"; |
3286 } | 3309 } |
3287 UNREACHABLE(); | 3310 UNREACHABLE(); |
3288 return ""; | 3311 return ""; |
3289 } | 3312 } |
3290 | 3313 |
3314 typedef RawBool* (*CaseInsensitiveCompareUC16Function) ( | |
3315 RawString* string_raw, | |
3316 RawSmi* lhs_index_raw, | |
3317 RawSmi* rhs_index_raw, | |
3318 RawSmi* length_raw); | |
3319 | |
3320 | |
3321 extern const RuntimeEntry kCaseInsensitiveCompareUC16RuntimeEntry( | |
3322 "CaseInsensitiveCompareUC16", reinterpret_cast<RuntimeFunction>( | |
3323 static_cast<CaseInsensitiveCompareUC16Function>( | |
3324 &IRRegExpMacroAssembler::CaseInsensitiveCompareUC16)), 4, true, false); | |
3325 | |
3326 | |
3327 const RuntimeEntry& CaseInsensitiveCompareUC16Instr::TargetFunction() const { | |
3328 return kCaseInsensitiveCompareUC16RuntimeEntry; | |
3329 } | |
3330 | |
3291 | 3331 |
3292 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, | 3332 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, |
3293 intptr_t original_deopt_id, | 3333 intptr_t original_deopt_id, |
3294 MergedMathInstr::Kind kind) | 3334 MergedMathInstr::Kind kind) |
3295 : inputs_(inputs), | 3335 : inputs_(inputs), |
3296 kind_(kind) { | 3336 kind_(kind) { |
3297 ASSERT(inputs_->length() == InputCountFor(kind_)); | 3337 ASSERT(inputs_->length() == InputCountFor(kind_)); |
3298 for (intptr_t i = 0; i < inputs_->length(); ++i) { | 3338 for (intptr_t i = 0; i < inputs_->length(); ++i) { |
3299 ASSERT((*inputs)[i] != NULL); | 3339 ASSERT((*inputs)[i] != NULL); |
3300 (*inputs)[i]->set_instruction(this); | 3340 (*inputs)[i]->set_instruction(this); |
(...skipping 17 matching lines...) Expand all Loading... | |
3318 case Token::kTRUNCDIV: return 0; | 3358 case Token::kTRUNCDIV: return 0; |
3319 case Token::kMOD: return 1; | 3359 case Token::kMOD: return 1; |
3320 default: UNIMPLEMENTED(); return -1; | 3360 default: UNIMPLEMENTED(); return -1; |
3321 } | 3361 } |
3322 } | 3362 } |
3323 | 3363 |
3324 | 3364 |
3325 #undef __ | 3365 #undef __ |
3326 | 3366 |
3327 } // namespace dart | 3367 } // namespace dart |
OLD | NEW |