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

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

Issue 353513002: Use range information for optimizing integer boxing and fix bug in range analysis. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // TODO(zra): Remove when tests are ready to enable. 5 // TODO(zra): Remove when tests are ready to enable.
6 #include "platform/globals.h" 6 #include "platform/globals.h"
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 smi_object = Object::null(); 278 smi_object = Object::null();
279 EXPECT(!smi_object.IsSmi()); 279 EXPECT(!smi_object.IsSmi());
280 280
281 EXPECT(smi.Equals(Smi::Handle(Smi::New(5)))); 281 EXPECT(smi.Equals(Smi::Handle(Smi::New(5))));
282 EXPECT(!smi.Equals(Smi::Handle(Smi::New(6)))); 282 EXPECT(!smi.Equals(Smi::Handle(Smi::New(6))));
283 EXPECT(smi.Equals(smi)); 283 EXPECT(smi.Equals(smi));
284 EXPECT(!smi.Equals(Smi::Handle())); 284 EXPECT(!smi.Equals(Smi::Handle()));
285 285
286 EXPECT(Smi::IsValid(0)); 286 EXPECT(Smi::IsValid(0));
287 EXPECT(Smi::IsValid(-15)); 287 EXPECT(Smi::IsValid(-15));
288 EXPECT(Smi::IsValid(0xFFu));
288 // Upper two bits must be either 00 or 11. 289 // Upper two bits must be either 00 or 11.
289 #if defined(ARCH_IS_64_BIT) 290 #if defined(ARCH_IS_64_BIT)
290 EXPECT(!Smi::IsValid(kMaxInt64)); 291 EXPECT(!Smi::IsValid(kMaxInt64));
291 EXPECT(Smi::IsValid(0x3FFFFFFFFFFFFFFF)); 292 EXPECT(Smi::IsValid(0x3FFFFFFFFFFFFFFF));
292 EXPECT(Smi::IsValid(0xFFFFFFFFFFFFFFFF)); 293 EXPECT(Smi::IsValid(-1));
294 EXPECT(!Smi::IsValid(0xFFFFFFFFFFFFFFFFu));
293 #else 295 #else
294 EXPECT(!Smi::IsValid(kMaxInt32)); 296 EXPECT(!Smi::IsValid(kMaxInt32));
295 EXPECT(Smi::IsValid(0x3FFFFFFF)); 297 EXPECT(Smi::IsValid(0x3FFFFFFF));
296 EXPECT(Smi::IsValid(0xFFFFFFFF)); 298 EXPECT(Smi::IsValid(-1));
299 EXPECT(!Smi::IsValid(0xFFFFFFFFu));
297 #endif 300 #endif
298 301
299 EXPECT_EQ(5, smi.AsInt64Value()); 302 EXPECT_EQ(5, smi.AsInt64Value());
300 EXPECT_EQ(5.0, smi.AsDoubleValue()); 303 EXPECT_EQ(5.0, smi.AsDoubleValue());
301 304
302 Smi& a = Smi::Handle(Smi::New(5)); 305 Smi& a = Smi::Handle(Smi::New(5));
303 Smi& b = Smi::Handle(Smi::New(3)); 306 Smi& b = Smi::Handle(Smi::New(3));
304 EXPECT_EQ(1, a.CompareWith(b)); 307 EXPECT_EQ(1, a.CompareWith(b));
305 EXPECT_EQ(-1, b.CompareWith(a)); 308 EXPECT_EQ(-1, b.CompareWith(a));
306 EXPECT_EQ(0, a.CompareWith(a)); 309 EXPECT_EQ(0, a.CompareWith(a));
(...skipping 3758 matching lines...) Expand 10 before | Expand all | Expand 10 after
4065 const Instance& a0 = Instance::Handle(Instance::New(clazz)); 4068 const Instance& a0 = Instance::Handle(Instance::New(clazz));
4066 const Instance& a1 = Instance::Handle(Instance::New(clazz)); 4069 const Instance& a1 = Instance::Handle(Instance::New(clazz));
4067 EXPECT(a0.raw() != a1.raw()); 4070 EXPECT(a0.raw() != a1.raw());
4068 EXPECT(a0.OperatorEquals(a0)); 4071 EXPECT(a0.OperatorEquals(a0));
4069 EXPECT(a0.OperatorEquals(a1)); 4072 EXPECT(a0.OperatorEquals(a1));
4070 EXPECT(a0.IsIdenticalTo(a0)); 4073 EXPECT(a0.IsIdenticalTo(a0));
4071 EXPECT(!a0.IsIdenticalTo(a1)); 4074 EXPECT(!a0.IsIdenticalTo(a1));
4072 } 4075 }
4073 4076
4074 } // namespace dart 4077 } // namespace dart
OLDNEW
« runtime/vm/object.h ('K') | « runtime/vm/object.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698