| 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/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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 representation_(representation), | 462 representation_(representation), |
| 463 constant_address_(0) { | 463 constant_address_(0) { |
| 464 if (representation_ == kUnboxedDouble) { | 464 if (representation_ == kUnboxedDouble) { |
| 465 ASSERT(value.IsDouble()); | 465 ASSERT(value.IsDouble()); |
| 466 constant_address_ = | 466 constant_address_ = |
| 467 FlowGraphBuilder::FindDoubleConstant(Double::Cast(value).value()); | 467 FlowGraphBuilder::FindDoubleConstant(Double::Cast(value).value()); |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 | 470 |
| 471 | 471 |
| 472 bool Value::BindsTo32BitMaskConstant() const { | |
| 473 if (!definition()->IsUnboxInt64() || !definition()->IsUnboxUint32()) { | |
| 474 return false; | |
| 475 } | |
| 476 // Two cases to consider: UnboxInt64 and UnboxUint32. | |
| 477 if (definition()->IsUnboxInt64()) { | |
| 478 UnboxInt64Instr* instr = definition()->AsUnboxInt64(); | |
| 479 if (!instr->value()->BindsToConstant()) { | |
| 480 return false; | |
| 481 } | |
| 482 const Object& obj = instr->value()->BoundConstant(); | |
| 483 if (!obj.IsMint()) { | |
| 484 return false; | |
| 485 } | |
| 486 Mint& mint = Mint::Handle(); | |
| 487 mint ^= obj.raw(); | |
| 488 return mint.value() == kMaxUint32; | |
| 489 } else if (definition()->IsUnboxUint32()) { | |
| 490 UnboxUint32Instr* instr = definition()->AsUnboxUint32(); | |
| 491 if (!instr->value()->BindsToConstant()) { | |
| 492 return false; | |
| 493 } | |
| 494 const Object& obj = instr->value()->BoundConstant(); | |
| 495 if (!obj.IsMint()) { | |
| 496 return false; | |
| 497 } | |
| 498 Mint& mint = Mint::Handle(); | |
| 499 mint ^= obj.raw(); | |
| 500 return mint.value() == kMaxUint32; | |
| 501 } | |
| 502 return false; | |
| 503 } | |
| 504 | |
| 505 | |
| 506 // Returns true if the value represents a constant. | 472 // Returns true if the value represents a constant. |
| 507 bool Value::BindsToConstant() const { | 473 bool Value::BindsToConstant() const { |
| 508 return definition()->IsConstant(); | 474 return definition()->IsConstant(); |
| 509 } | 475 } |
| 510 | 476 |
| 511 | 477 |
| 512 // Returns true if the value represents constant null. | 478 // Returns true if the value represents constant null. |
| 513 bool Value::BindsToConstantNull() const { | 479 bool Value::BindsToConstantNull() const { |
| 514 ConstantInstr* constant = definition()->AsConstant(); | 480 ConstantInstr* constant = definition()->AsConstant(); |
| 515 return (constant != NULL) && constant->value().IsNull(); | 481 return (constant != NULL) && constant->value().IsNull(); |
| (...skipping 3410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3926 set_native_c_function(native_function); | 3892 set_native_c_function(native_function); |
| 3927 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3893 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
| 3928 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3894 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
| 3929 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3895 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
| 3930 set_is_bootstrap_native(is_bootstrap_native); | 3896 set_is_bootstrap_native(is_bootstrap_native); |
| 3931 } | 3897 } |
| 3932 | 3898 |
| 3933 #undef __ | 3899 #undef __ |
| 3934 | 3900 |
| 3935 } // namespace dart | 3901 } // namespace dart |
| OLD | NEW |