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

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

Issue 2005723004: Fraction class prototype and test (not to be committed). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: work in progress Created 4 years, 5 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
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/intrinsifier_arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/constant_propagator.h" 10 #include "vm/constant_propagator.h"
(...skipping 2386 matching lines...) Expand 10 before | Expand all | Expand 10 after
2397 return defn; 2397 return defn;
2398 } 2398 }
2399 return this; 2399 return this;
2400 } 2400 }
2401 2401
2402 2402
2403 static bool MayBeBoxableNumber(intptr_t cid) { 2403 static bool MayBeBoxableNumber(intptr_t cid) {
2404 return (cid == kDynamicCid) || 2404 return (cid == kDynamicCid) ||
2405 (cid == kMintCid) || 2405 (cid == kMintCid) ||
2406 (cid == kBigintCid) || 2406 (cid == kBigintCid) ||
2407 (cid == kDoubleCid); 2407 (cid == kDoubleCid) ||
2408 (cid == kFractionCid);
2408 } 2409 }
2409 2410
2410 2411
2411 static bool MaybeNumber(CompileType* type) { 2412 static bool MaybeNumber(CompileType* type) {
2412 ASSERT(Type::Handle(Type::Number()).IsMoreSpecificThan( 2413 ASSERT(Type::Handle(Type::Number()).IsMoreSpecificThan(
2413 Type::Handle(Type::Number()), NULL, NULL, Heap::kOld)); 2414 Type::Handle(Type::Number()), NULL, NULL, Heap::kOld));
2414 return type->ToAbstractType()->IsDynamicType() 2415 return type->ToAbstractType()->IsDynamicType()
2415 || type->ToAbstractType()->IsObjectType() 2416 || type->ToAbstractType()->IsObjectType()
2416 || type->ToAbstractType()->IsTypeParameter() 2417 || type->ToAbstractType()->IsTypeParameter()
2417 || type->IsMoreSpecificThan(Type::Handle(Type::Number())); 2418 || type->IsMoreSpecificThan(Type::Handle(Type::Number()));
2418 } 2419 }
2419 2420
2420 2421
2421 // Returns a replacement for a strict comparison and signals if the result has 2422 // Returns a replacement for a strict comparison and signals if the result has
2422 // to be negated. 2423 // to be negated.
2423 static Definition* CanonicalizeStrictCompare(StrictCompareInstr* compare, 2424 static Definition* CanonicalizeStrictCompare(StrictCompareInstr* compare,
2424 bool* negated) { 2425 bool* negated) {
2425 // Use propagated cid and type information to eliminate number checks. 2426 // Use propagated cid and type information to eliminate number checks.
2426 // If one of the inputs is not a boxable number (Mint, Double, Bigint), or 2427 // If one of the inputs is not a boxable number (Mint, Double, Bigint,
2427 // is not a subtype of num, no need for number checks. 2428 // Fraction), or is not a subtype of num, no need for number checks.
2428 if (compare->needs_number_check()) { 2429 if (compare->needs_number_check()) {
2429 if (!MayBeBoxableNumber(compare->left()->Type()->ToCid()) || 2430 if (!MayBeBoxableNumber(compare->left()->Type()->ToCid()) ||
2430 !MayBeBoxableNumber(compare->right()->Type()->ToCid())) { 2431 !MayBeBoxableNumber(compare->right()->Type()->ToCid())) {
2431 compare->set_needs_number_check(false); 2432 compare->set_needs_number_check(false);
2432 } else if (!MaybeNumber(compare->left()->Type()) || 2433 } else if (!MaybeNumber(compare->left()->Type()) ||
2433 !MaybeNumber(compare->right()->Type())) { 2434 !MaybeNumber(compare->right()->Type())) {
2434 compare->set_needs_number_check(false); 2435 compare->set_needs_number_check(false);
2435 } 2436 }
2436 } 2437 }
2437 2438
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
3919 set_native_c_function(native_function); 3920 set_native_c_function(native_function);
3920 function().SetIsNativeAutoSetupScope(auto_setup_scope); 3921 function().SetIsNativeAutoSetupScope(auto_setup_scope);
3921 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); 3922 Dart_NativeEntryResolver resolver = library.native_entry_resolver();
3922 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); 3923 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
3923 set_is_bootstrap_native(is_bootstrap_native); 3924 set_is_bootstrap_native(is_bootstrap_native);
3924 } 3925 }
3925 3926
3926 #undef __ 3927 #undef __
3927 3928
3928 } // namespace dart 3929 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/intrinsifier_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698