| 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 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2523 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 2533 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 2524 deopt_id_, | 2534 deopt_id_, |
| 2525 Scanner::kNoSourcePos); | 2535 Scanner::kNoSourcePos); |
| 2526 } | 2536 } |
| 2527 if (HasParallelMove()) { | 2537 if (HasParallelMove()) { |
| 2528 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2538 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 2529 } | 2539 } |
| 2530 } | 2540 } |
| 2531 | 2541 |
| 2532 | 2542 |
| 2543 LocationSummary* IndirectEntryInstr::MakeLocationSummary( |
| 2544 Isolate* isolate, bool optimizing) const { |
| 2545 return JoinEntryInstr::MakeLocationSummary(isolate, optimizing); |
| 2546 } |
| 2547 |
| 2548 |
| 2549 void IndirectEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2550 JoinEntryInstr::EmitNativeCode(compiler); |
| 2551 } |
| 2552 |
| 2553 |
| 2533 LocationSummary* PhiInstr::MakeLocationSummary(Isolate* isolate, | 2554 LocationSummary* PhiInstr::MakeLocationSummary(Isolate* isolate, |
| 2534 bool optimizing) const { | 2555 bool optimizing) const { |
| 2535 UNREACHABLE(); | 2556 UNREACHABLE(); |
| 2536 return NULL; | 2557 return NULL; |
| 2537 } | 2558 } |
| 2538 | 2559 |
| 2539 | 2560 |
| 2540 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2561 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2541 UNREACHABLE(); | 2562 UNREACHABLE(); |
| 2542 } | 2563 } |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3319 case kIllegal: return "illegal"; | 3340 case kIllegal: return "illegal"; |
| 3320 case kSin: return "sin"; | 3341 case kSin: return "sin"; |
| 3321 case kCos: return "cos"; | 3342 case kCos: return "cos"; |
| 3322 case kSqrt: return "sqrt"; | 3343 case kSqrt: return "sqrt"; |
| 3323 case kDoubleSquare: return "double-square"; | 3344 case kDoubleSquare: return "double-square"; |
| 3324 } | 3345 } |
| 3325 UNREACHABLE(); | 3346 UNREACHABLE(); |
| 3326 return ""; | 3347 return ""; |
| 3327 } | 3348 } |
| 3328 | 3349 |
| 3350 typedef RawBool* (*CaseInsensitiveCompareUC16Function) ( |
| 3351 RawString* string_raw, |
| 3352 RawSmi* lhs_index_raw, |
| 3353 RawSmi* rhs_index_raw, |
| 3354 RawSmi* length_raw); |
| 3355 |
| 3356 |
| 3357 extern const RuntimeEntry kCaseInsensitiveCompareUC16RuntimeEntry( |
| 3358 "CaseInsensitiveCompareUC16", reinterpret_cast<RuntimeFunction>( |
| 3359 static_cast<CaseInsensitiveCompareUC16Function>( |
| 3360 &IRRegExpMacroAssembler::CaseInsensitiveCompareUC16)), 4, true, false); |
| 3361 |
| 3362 |
| 3363 const RuntimeEntry& CaseInsensitiveCompareUC16Instr::TargetFunction() const { |
| 3364 return kCaseInsensitiveCompareUC16RuntimeEntry; |
| 3365 } |
| 3366 |
| 3329 | 3367 |
| 3330 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, | 3368 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, |
| 3331 intptr_t original_deopt_id, | 3369 intptr_t original_deopt_id, |
| 3332 MergedMathInstr::Kind kind) | 3370 MergedMathInstr::Kind kind) |
| 3333 : inputs_(inputs), | 3371 : inputs_(inputs), |
| 3334 kind_(kind) { | 3372 kind_(kind) { |
| 3335 ASSERT(inputs_->length() == InputCountFor(kind_)); | 3373 ASSERT(inputs_->length() == InputCountFor(kind_)); |
| 3336 for (intptr_t i = 0; i < inputs_->length(); ++i) { | 3374 for (intptr_t i = 0; i < inputs_->length(); ++i) { |
| 3337 ASSERT((*inputs)[i] != NULL); | 3375 ASSERT((*inputs)[i] != NULL); |
| 3338 (*inputs)[i]->set_instruction(this); | 3376 (*inputs)[i]->set_instruction(this); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3356 case Token::kTRUNCDIV: return 0; | 3394 case Token::kTRUNCDIV: return 0; |
| 3357 case Token::kMOD: return 1; | 3395 case Token::kMOD: return 1; |
| 3358 default: UNIMPLEMENTED(); return -1; | 3396 default: UNIMPLEMENTED(); return -1; |
| 3359 } | 3397 } |
| 3360 } | 3398 } |
| 3361 | 3399 |
| 3362 | 3400 |
| 3363 #undef __ | 3401 #undef __ |
| 3364 | 3402 |
| 3365 } // namespace dart | 3403 } // namespace dart |
| OLD | NEW |