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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 365 } |
365 | 366 |
366 | 367 |
367 bool LoadIndexedInstr::AttributesEqual(Instruction* other) const { | 368 bool LoadIndexedInstr::AttributesEqual(Instruction* other) const { |
368 LoadIndexedInstr* other_load = other->AsLoadIndexed(); | 369 LoadIndexedInstr* other_load = other->AsLoadIndexed(); |
369 ASSERT(other_load != NULL); | 370 ASSERT(other_load != NULL); |
370 return class_id() == other_load->class_id(); | 371 return class_id() == other_load->class_id(); |
371 } | 372 } |
372 | 373 |
373 | 374 |
| 375 bool LoadCodeUnitsInstr::AttributesEqual(Instruction* other) const { |
| 376 LoadCodeUnitsInstr* other_load = other->AsLoadCodeUnits(); |
| 377 ASSERT(other_load != NULL); |
| 378 return (class_id() == other_load->class_id() && |
| 379 element_count() == other_load->element_count()); |
| 380 } |
| 381 |
| 382 |
374 ConstantInstr::ConstantInstr(const Object& value) : value_(value) { | 383 ConstantInstr::ConstantInstr(const Object& value) : value_(value) { |
375 // Check that the value is not an incorrect Integer representation. | 384 // Check that the value is not an incorrect Integer representation. |
376 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoSmi()); | 385 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoSmi()); |
377 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoInt64()); | 386 ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoInt64()); |
378 ASSERT(!value.IsMint() || !Smi::IsValid(Mint::Cast(value).AsInt64Value())); | 387 ASSERT(!value.IsMint() || !Smi::IsValid(Mint::Cast(value).AsInt64Value())); |
379 } | 388 } |
380 | 389 |
381 | 390 |
382 bool ConstantInstr::AttributesEqual(Instruction* other) const { | 391 bool ConstantInstr::AttributesEqual(Instruction* other) const { |
383 ConstantInstr* other_constant = other->AsConstant(); | 392 ConstantInstr* other_constant = other->AsConstant(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 } | 463 } |
455 | 464 |
456 | 465 |
457 GraphEntryInstr::GraphEntryInstr(const ParsedFunction* parsed_function, | 466 GraphEntryInstr::GraphEntryInstr(const ParsedFunction* parsed_function, |
458 TargetEntryInstr* normal_entry, | 467 TargetEntryInstr* normal_entry, |
459 intptr_t osr_id) | 468 intptr_t osr_id) |
460 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex), | 469 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex), |
461 parsed_function_(parsed_function), | 470 parsed_function_(parsed_function), |
462 normal_entry_(normal_entry), | 471 normal_entry_(normal_entry), |
463 catch_entries_(), | 472 catch_entries_(), |
| 473 indirect_entries_(), |
464 initial_definitions_(), | 474 initial_definitions_(), |
465 osr_id_(osr_id), | 475 osr_id_(osr_id), |
466 entry_count_(0), | 476 entry_count_(0), |
467 spill_slot_count_(0), | 477 spill_slot_count_(0), |
468 fixed_slot_count_(0) { | 478 fixed_slot_count_(0) { |
469 } | 479 } |
470 | 480 |
471 | 481 |
472 ConstantInstr* GraphEntryInstr::constant_null() { | 482 ConstantInstr* GraphEntryInstr::constant_null() { |
473 ASSERT(initial_definitions_.length() > 0); | 483 ASSERT(initial_definitions_.length() > 0); |
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2491 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 2501 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
2492 deopt_id_, | 2502 deopt_id_, |
2493 Scanner::kNoSourcePos); | 2503 Scanner::kNoSourcePos); |
2494 } | 2504 } |
2495 if (HasParallelMove()) { | 2505 if (HasParallelMove()) { |
2496 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2506 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
2497 } | 2507 } |
2498 } | 2508 } |
2499 | 2509 |
2500 | 2510 |
| 2511 LocationSummary* IndirectEntryInstr::MakeLocationSummary( |
| 2512 Isolate* isolate, bool optimizing) const { |
| 2513 return JoinEntryInstr::MakeLocationSummary(isolate, optimizing); |
| 2514 } |
| 2515 |
| 2516 |
| 2517 void IndirectEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2518 JoinEntryInstr::EmitNativeCode(compiler); |
| 2519 } |
| 2520 |
| 2521 |
2501 LocationSummary* PhiInstr::MakeLocationSummary(Isolate* isolate, | 2522 LocationSummary* PhiInstr::MakeLocationSummary(Isolate* isolate, |
2502 bool optimizing) const { | 2523 bool optimizing) const { |
2503 UNREACHABLE(); | 2524 UNREACHABLE(); |
2504 return NULL; | 2525 return NULL; |
2505 } | 2526 } |
2506 | 2527 |
2507 | 2528 |
2508 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2529 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2509 UNREACHABLE(); | 2530 UNREACHABLE(); |
2510 } | 2531 } |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3287 case kIllegal: return "illegal"; | 3308 case kIllegal: return "illegal"; |
3288 case kSin: return "sin"; | 3309 case kSin: return "sin"; |
3289 case kCos: return "cos"; | 3310 case kCos: return "cos"; |
3290 case kSqrt: return "sqrt"; | 3311 case kSqrt: return "sqrt"; |
3291 case kDoubleSquare: return "double-square"; | 3312 case kDoubleSquare: return "double-square"; |
3292 } | 3313 } |
3293 UNREACHABLE(); | 3314 UNREACHABLE(); |
3294 return ""; | 3315 return ""; |
3295 } | 3316 } |
3296 | 3317 |
| 3318 typedef RawBool* (*CaseInsensitiveCompareUC16Function) ( |
| 3319 RawString* string_raw, |
| 3320 RawSmi* lhs_index_raw, |
| 3321 RawSmi* rhs_index_raw, |
| 3322 RawSmi* length_raw); |
| 3323 |
| 3324 |
| 3325 extern const RuntimeEntry kCaseInsensitiveCompareUC16RuntimeEntry( |
| 3326 "CaseInsensitiveCompareUC16", reinterpret_cast<RuntimeFunction>( |
| 3327 static_cast<CaseInsensitiveCompareUC16Function>( |
| 3328 &IRRegExpMacroAssembler::CaseInsensitiveCompareUC16)), 4, true, false); |
| 3329 |
| 3330 |
| 3331 const RuntimeEntry& CaseInsensitiveCompareUC16Instr::TargetFunction() const { |
| 3332 return kCaseInsensitiveCompareUC16RuntimeEntry; |
| 3333 } |
| 3334 |
3297 | 3335 |
3298 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, | 3336 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, |
3299 intptr_t original_deopt_id, | 3337 intptr_t original_deopt_id, |
3300 MergedMathInstr::Kind kind) | 3338 MergedMathInstr::Kind kind) |
3301 : inputs_(inputs), | 3339 : inputs_(inputs), |
3302 kind_(kind) { | 3340 kind_(kind) { |
3303 ASSERT(inputs_->length() == InputCountFor(kind_)); | 3341 ASSERT(inputs_->length() == InputCountFor(kind_)); |
3304 for (intptr_t i = 0; i < inputs_->length(); ++i) { | 3342 for (intptr_t i = 0; i < inputs_->length(); ++i) { |
3305 ASSERT((*inputs)[i] != NULL); | 3343 ASSERT((*inputs)[i] != NULL); |
3306 (*inputs)[i]->set_instruction(this); | 3344 (*inputs)[i]->set_instruction(this); |
(...skipping 17 matching lines...) Expand all Loading... |
3324 case Token::kTRUNCDIV: return 0; | 3362 case Token::kTRUNCDIV: return 0; |
3325 case Token::kMOD: return 1; | 3363 case Token::kMOD: return 1; |
3326 default: UNIMPLEMENTED(); return -1; | 3364 default: UNIMPLEMENTED(); return -1; |
3327 } | 3365 } |
3328 } | 3366 } |
3329 | 3367 |
3330 | 3368 |
3331 #undef __ | 3369 #undef __ |
3332 | 3370 |
3333 } // namespace dart | 3371 } // namespace dart |
OLD | NEW |