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

Side by Side Diff: runtime/vm/assembler_ia32.h

Issue 490023004: On ia32 allow powers of two and corresponding full bit masks as safe smis. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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 #ifndef VM_ASSEMBLER_IA32_H_ 5 #ifndef VM_ASSEMBLER_IA32_H_
6 #define VM_ASSEMBLER_IA32_H_ 6 #define VM_ASSEMBLER_IA32_H_
7 7
8 #ifndef VM_ASSEMBLER_H_ 8 #ifndef VM_ASSEMBLER_H_
9 #error Do not include assembler_ia32.h directly; use assembler.h instead. 9 #error Do not include assembler_ia32.h directly; use assembler.h instead.
10 #endif 10 #endif
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 832
833 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); 833 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
834 static bool EmittingComments(); 834 static bool EmittingComments();
835 835
836 const Code::Comments& GetCodeComments() const; 836 const Code::Comments& GetCodeComments() const;
837 837
838 static const char* RegisterName(Register reg); 838 static const char* RegisterName(Register reg);
839 static const char* FpuRegisterName(FpuRegister reg); 839 static const char* FpuRegisterName(FpuRegister reg);
840 840
841 // Smis that do not fit into 17 bits (16 bits of payload) are unsafe. 841 // Smis that do not fit into 17 bits (16 bits of payload) are unsafe.
842 static bool IsSafeSmi(const Object& object) {
843 if (!object.IsSmi()) {
844 return false;
845 }
846
847 if (Utils::IsInt(17, reinterpret_cast<intptr_t>(object.raw()))) {
848 return true;
849 }
850
851 // Single bit smis (powers of two) and corresponding masks are safe.
852 const intptr_t value = Smi::Cast(object).Value();
853 if (Utils::IsPowerOfTwo(value) || Utils::IsPowerOfTwo(value + 1)) {
854 return true;
855 }
856
857 return false;
858 }
842 static bool IsSafe(const Object& object) { 859 static bool IsSafe(const Object& object) {
843 return !object.IsSmi() || 860 return !object.IsSmi() || IsSafeSmi(object);
844 Utils::IsInt(17, reinterpret_cast<intptr_t>(object.raw()));
845 }
846 static bool IsSafeSmi(const Object& object) {
847 return object.IsSmi() &&
848 Utils::IsInt(17, reinterpret_cast<intptr_t>(object.raw()));
849 } 861 }
850 862
851 private: 863 private:
852 class CodeComment : public ZoneAllocated { 864 class CodeComment : public ZoneAllocated {
853 public: 865 public:
854 CodeComment(intptr_t pc_offset, const String& comment) 866 CodeComment(intptr_t pc_offset, const String& comment)
855 : pc_offset_(pc_offset), comment_(comment) { } 867 : pc_offset_(pc_offset), comment_(comment) { }
856 868
857 intptr_t pc_offset() const { return pc_offset_; } 869 intptr_t pc_offset() const { return pc_offset_; }
858 const String& comment() const { return comment_; } 870 const String& comment() const { return comment_; }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 } 940 }
929 941
930 942
931 inline void Assembler::EmitOperandSizeOverride() { 943 inline void Assembler::EmitOperandSizeOverride() {
932 EmitUint8(0x66); 944 EmitUint8(0x66);
933 } 945 }
934 946
935 } // namespace dart 947 } // namespace dart
936 948
937 #endif // VM_ASSEMBLER_IA32_H_ 949 #endif // VM_ASSEMBLER_IA32_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698