Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: runtime/vm/intermediate_language.cc

Issue 12050002: Introduce InvokeMathCFunction that can be used to directly invoke mathematical function provided by… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_allocator.h" 9 #include "vm/flow_graph_allocator.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 RawAbstractType* DoubleToSmiInstr::CompileType() const { 1602 RawAbstractType* DoubleToSmiInstr::CompileType() const {
1603 return Type::SmiType(); 1603 return Type::SmiType();
1604 } 1604 }
1605 1605
1606 1606
1607 RawAbstractType* DoubleToDoubleInstr::CompileType() const { 1607 RawAbstractType* DoubleToDoubleInstr::CompileType() const {
1608 return Type::Double(); 1608 return Type::Double();
1609 } 1609 }
1610 1610
1611 1611
1612 RawAbstractType* InvokeMathCFunctionInstr::CompileType() const {
1613 return Type::Double();
1614 }
1615
1616
1612 RawAbstractType* CheckClassInstr::CompileType() const { 1617 RawAbstractType* CheckClassInstr::CompileType() const {
1613 return AbstractType::null(); 1618 return AbstractType::null();
1614 } 1619 }
1615 1620
1616 1621
1617 RawAbstractType* CheckSmiInstr::CompileType() const { 1622 RawAbstractType* CheckSmiInstr::CompileType() const {
1618 return AbstractType::null(); 1623 return AbstractType::null();
1619 } 1624 }
1620 1625
1621 1626
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
2668 case kFloat64ArrayCid: 2673 case kFloat64ArrayCid:
2669 case kFloat32ArrayCid: 2674 case kFloat32ArrayCid:
2670 case kExternalUint8ArrayCid: 2675 case kExternalUint8ArrayCid:
2671 return ByteArray::length_offset(); 2676 return ByteArray::length_offset();
2672 default: 2677 default:
2673 UNREACHABLE(); 2678 UNREACHABLE();
2674 return -1; 2679 return -1;
2675 } 2680 }
2676 } 2681 }
2677 2682
2683
2684 intptr_t InvokeMathCFunctionInstr::ArgumentCountFor(
2685 MethodRecognizer::Kind kind) {
2686 switch (kind) {
2687 case MethodRecognizer::kDoubleTruncate:
2688 case MethodRecognizer::kDoubleRound:
2689 case MethodRecognizer::kDoubleFloor:
2690 case MethodRecognizer::kDoubleCeil: {
2691 ASSERT(!CPUFeatures::double_truncate_round_supported());
2692 return 1;
2693 }
2694 case MethodRecognizer::kDoublePow:
2695 return 2;
2696 default:
2697 UNREACHABLE();
2698 }
2699 return 0;
2700 }
2701
2702
2703 extern const RuntimeEntry kPowRuntimeEntry(
2704 "libc_pow", reinterpret_cast<RuntimeFunction>(&pow), 0, true);
2705
2706 extern const RuntimeEntry kFloorRuntimeEntry(
2707 "libc_floor", reinterpret_cast<RuntimeFunction>(&floor), 0, true);
2708
2709 extern const RuntimeEntry kCeilRuntimeEntry(
2710 "libc_ceil", reinterpret_cast<RuntimeFunction>(&ceil), 0, true);
2711
2712 extern const RuntimeEntry kTruncRuntimeEntry(
2713 "libc_trunc", reinterpret_cast<RuntimeFunction>(&trunc), 0, true);
2714
2715 extern const RuntimeEntry kRoundRuntimeEntry(
2716 "libc_round", reinterpret_cast<RuntimeFunction>(&round), 0, true);
2717
2718
2719 const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const {
2720 switch (recognized_kind_) {
2721 case MethodRecognizer::kDoubleTruncate:
2722 return kTruncRuntimeEntry;
2723 case MethodRecognizer::kDoubleRound:
2724 return kRoundRuntimeEntry;
2725 case MethodRecognizer::kDoubleFloor:
2726 return kFloorRuntimeEntry;
2727 case MethodRecognizer::kDoubleCeil:
2728 return kCeilRuntimeEntry;
2729 case MethodRecognizer::kDoublePow:
2730 return kPowRuntimeEntry;
2731 default:
2732 UNREACHABLE();
2733 }
2734 return kPowRuntimeEntry;
2735 }
2736
2737
2678 #undef __ 2738 #undef __
2679 2739
2680 } // namespace dart 2740 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698