OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); | 721 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); |
722 } | 722 } |
723 } | 723 } |
724 | 724 |
725 | 725 |
726 THREADED_TEST(BigInteger) { | 726 THREADED_TEST(BigInteger) { |
727 v8::HandleScope scope; | 727 v8::HandleScope scope; |
728 LocalContext env; | 728 LocalContext env; |
729 // We cannot add one to a Smi::kMaxValue without wrapping. | 729 // We cannot add one to a Smi::kMaxValue without wrapping. |
730 if (i::kSmiValueSize < 32) { | 730 if (i::kSmiValueSize < 32) { |
731 int32_t value = i::Smi::kMaxValue + 1; | 731 // The casts allow this to compile, even if Smi::kMaxValue is 2^31-1. |
| 732 // The code will not be run in that case, due to the "if" guard. |
| 733 int32_t value = |
| 734 static_cast<int32_t>(static_cast<uint32_t>(i::Smi::kMaxValue) + 1); |
732 CHECK(value > i::Smi::kMaxValue); | 735 CHECK(value > i::Smi::kMaxValue); |
733 CHECK(!i::Smi::IsValid(value)); | 736 CHECK(!i::Smi::IsValid(value)); |
734 Local<v8::Integer> value_obj = v8::Integer::New(value); | 737 Local<v8::Integer> value_obj = v8::Integer::New(value); |
735 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); | 738 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); |
736 } | 739 } |
737 } | 740 } |
738 | 741 |
739 | 742 |
740 THREADED_TEST(TinyUnsignedInteger) { | 743 THREADED_TEST(TinyUnsignedInteger) { |
741 v8::HandleScope scope; | 744 v8::HandleScope scope; |
(...skipping 7325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8067 env->Global()->Set(v8_str("get_stack_limit"), fun); | 8070 env->Global()->Set(v8_str("get_stack_limit"), fun); |
8068 CompileRun("get_stack_limit();"); | 8071 CompileRun("get_stack_limit();"); |
8069 | 8072 |
8070 CHECK(stack_limit == set_limit); | 8073 CHECK(stack_limit == set_limit); |
8071 } | 8074 } |
8072 { | 8075 { |
8073 v8::Locker locker; | 8076 v8::Locker locker; |
8074 CHECK(stack_limit == set_limit); | 8077 CHECK(stack_limit == set_limit); |
8075 } | 8078 } |
8076 } | 8079 } |
OLD | NEW |