| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 } | 445 } |
| 445 | 446 |
| 446 | 447 |
| 447 GraphEntryInstr::GraphEntryInstr(const ParsedFunction* parsed_function, | 448 GraphEntryInstr::GraphEntryInstr(const ParsedFunction* parsed_function, |
| 448 TargetEntryInstr* normal_entry, | 449 TargetEntryInstr* normal_entry, |
| 449 intptr_t osr_id) | 450 intptr_t osr_id) |
| 450 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex), | 451 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex), |
| 451 parsed_function_(parsed_function), | 452 parsed_function_(parsed_function), |
| 452 normal_entry_(normal_entry), | 453 normal_entry_(normal_entry), |
| 453 catch_entries_(), | 454 catch_entries_(), |
| 455 indirect_entries_(), |
| 454 initial_definitions_(), | 456 initial_definitions_(), |
| 455 osr_id_(osr_id), | 457 osr_id_(osr_id), |
| 456 entry_count_(0), | 458 entry_count_(0), |
| 457 spill_slot_count_(0), | 459 spill_slot_count_(0), |
| 458 fixed_slot_count_(0) { | 460 fixed_slot_count_(0) { |
| 459 } | 461 } |
| 460 | 462 |
| 461 | 463 |
| 462 ConstantInstr* GraphEntryInstr::constant_null() { | 464 ConstantInstr* GraphEntryInstr::constant_null() { |
| 463 ASSERT(initial_definitions_.length() > 0); | 465 ASSERT(initial_definitions_.length() > 0); |
| (...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2542 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 2544 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 2543 GetDeoptId(), | 2545 GetDeoptId(), |
| 2544 Scanner::kNoSourcePos); | 2546 Scanner::kNoSourcePos); |
| 2545 } | 2547 } |
| 2546 if (HasParallelMove()) { | 2548 if (HasParallelMove()) { |
| 2547 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2549 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 2548 } | 2550 } |
| 2549 } | 2551 } |
| 2550 | 2552 |
| 2551 | 2553 |
| 2554 void IndirectGotoInstr::ComputeOffsetTable(Isolate* isolate) { |
| 2555 if (GetBlock()->offset() < 0) { |
| 2556 // Don't generate a table when contained in an unreachable block. |
| 2557 return; |
| 2558 } |
| 2559 ASSERT(SuccessorCount() == offsets_.Capacity()); |
| 2560 offsets_.SetLength(SuccessorCount()); |
| 2561 for (intptr_t i = 0; i < SuccessorCount(); i++) { |
| 2562 TargetEntryInstr* target = SuccessorAt(i); |
| 2563 intptr_t offset = target->offset(); |
| 2564 |
| 2565 // The intermediate block might be compacted, if so, use the indirect entry. |
| 2566 if (offset < 0) { |
| 2567 // Optimizations might have modified the immediate target block, but it |
| 2568 // must end with a goto to the indirect entry. Also, we can't use |
| 2569 // last_instruction because 'target' is compacted/unreachable. |
| 2570 Instruction* last = target->next(); |
| 2571 while (last != NULL && !last->IsGoto()) { |
| 2572 last = last->next(); |
| 2573 } |
| 2574 ASSERT(last); |
| 2575 IndirectEntryInstr* ientry = |
| 2576 last->AsGoto()->successor()->AsIndirectEntry(); |
| 2577 ASSERT(ientry != NULL); |
| 2578 ASSERT(ientry->indirect_id() == i); |
| 2579 offset = ientry->offset(); |
| 2580 } |
| 2581 |
| 2582 ASSERT(offset > 0); |
| 2583 offset -= Assembler::EntryPointToPcMarkerOffset(); |
| 2584 offsets_.SetAt(i, Smi::ZoneHandle(isolate, Smi::New(offset))); |
| 2585 } |
| 2586 } |
| 2587 |
| 2588 |
| 2589 LocationSummary* IndirectEntryInstr::MakeLocationSummary( |
| 2590 Isolate* isolate, bool optimizing) const { |
| 2591 return JoinEntryInstr::MakeLocationSummary(isolate, optimizing); |
| 2592 } |
| 2593 |
| 2594 |
| 2595 void IndirectEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2596 JoinEntryInstr::EmitNativeCode(compiler); |
| 2597 } |
| 2598 |
| 2599 |
| 2552 LocationSummary* PhiInstr::MakeLocationSummary(Isolate* isolate, | 2600 LocationSummary* PhiInstr::MakeLocationSummary(Isolate* isolate, |
| 2553 bool optimizing) const { | 2601 bool optimizing) const { |
| 2554 UNREACHABLE(); | 2602 UNREACHABLE(); |
| 2555 return NULL; | 2603 return NULL; |
| 2556 } | 2604 } |
| 2557 | 2605 |
| 2558 | 2606 |
| 2559 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2607 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2560 UNREACHABLE(); | 2608 UNREACHABLE(); |
| 2561 } | 2609 } |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3332 case kIllegal: return "illegal"; | 3380 case kIllegal: return "illegal"; |
| 3333 case kSin: return "sin"; | 3381 case kSin: return "sin"; |
| 3334 case kCos: return "cos"; | 3382 case kCos: return "cos"; |
| 3335 case kSqrt: return "sqrt"; | 3383 case kSqrt: return "sqrt"; |
| 3336 case kDoubleSquare: return "double-square"; | 3384 case kDoubleSquare: return "double-square"; |
| 3337 } | 3385 } |
| 3338 UNREACHABLE(); | 3386 UNREACHABLE(); |
| 3339 return ""; | 3387 return ""; |
| 3340 } | 3388 } |
| 3341 | 3389 |
| 3390 typedef RawBool* (*CaseInsensitiveCompareUC16Function) ( |
| 3391 RawString* string_raw, |
| 3392 RawSmi* lhs_index_raw, |
| 3393 RawSmi* rhs_index_raw, |
| 3394 RawSmi* length_raw); |
| 3395 |
| 3396 |
| 3397 extern const RuntimeEntry kCaseInsensitiveCompareUC16RuntimeEntry( |
| 3398 "CaseInsensitiveCompareUC16", reinterpret_cast<RuntimeFunction>( |
| 3399 static_cast<CaseInsensitiveCompareUC16Function>( |
| 3400 &IRRegExpMacroAssembler::CaseInsensitiveCompareUC16)), 4, true, false); |
| 3401 |
| 3402 |
| 3403 const RuntimeEntry& CaseInsensitiveCompareUC16Instr::TargetFunction() const { |
| 3404 return kCaseInsensitiveCompareUC16RuntimeEntry; |
| 3405 } |
| 3406 |
| 3342 | 3407 |
| 3343 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, | 3408 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, |
| 3344 intptr_t deopt_id, | 3409 intptr_t deopt_id, |
| 3345 MergedMathInstr::Kind kind) | 3410 MergedMathInstr::Kind kind) |
| 3346 : PureDefinition(deopt_id), | 3411 : PureDefinition(deopt_id), |
| 3347 inputs_(inputs), | 3412 inputs_(inputs), |
| 3348 kind_(kind) { | 3413 kind_(kind) { |
| 3349 ASSERT(inputs_->length() == InputCountFor(kind_)); | 3414 ASSERT(inputs_->length() == InputCountFor(kind_)); |
| 3350 for (intptr_t i = 0; i < inputs_->length(); ++i) { | 3415 for (intptr_t i = 0; i < inputs_->length(); ++i) { |
| 3351 ASSERT((*inputs)[i] != NULL); | 3416 ASSERT((*inputs)[i] != NULL); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3369 case Token::kTRUNCDIV: return 0; | 3434 case Token::kTRUNCDIV: return 0; |
| 3370 case Token::kMOD: return 1; | 3435 case Token::kMOD: return 1; |
| 3371 default: UNIMPLEMENTED(); return -1; | 3436 default: UNIMPLEMENTED(); return -1; |
| 3372 } | 3437 } |
| 3373 } | 3438 } |
| 3374 | 3439 |
| 3375 | 3440 |
| 3376 #undef __ | 3441 #undef __ |
| 3377 | 3442 |
| 3378 } // namespace dart | 3443 } // namespace dart |
| OLD | NEW |