| 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 int32_t value = 239; | 706 int32_t value = 239; |
| 707 Local<v8::Integer> value_obj = v8::Integer::New(value); | 707 Local<v8::Integer> value_obj = v8::Integer::New(value); |
| 708 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); | 708 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); |
| 709 } | 709 } |
| 710 | 710 |
| 711 | 711 |
| 712 THREADED_TEST(BigSmiInteger) { | 712 THREADED_TEST(BigSmiInteger) { |
| 713 v8::HandleScope scope; | 713 v8::HandleScope scope; |
| 714 LocalContext env; | 714 LocalContext env; |
| 715 int32_t value = i::Smi::kMaxValue; | 715 int32_t value = i::Smi::kMaxValue; |
| 716 CHECK(i::Smi::IsValid(value)); | 716 // We cannot add one to a Smi::kMaxValue without wrapping. |
| 717 CHECK(!i::Smi::IsValid(value + 1)); | 717 if (i::kSmiValueSize < 32) { |
| 718 Local<v8::Integer> value_obj = v8::Integer::New(value); | 718 CHECK(i::Smi::IsValid(value)); |
| 719 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); | 719 CHECK(!i::Smi::IsValid(value + 1)); |
| 720 Local<v8::Integer> value_obj = v8::Integer::New(value); |
| 721 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); |
| 722 } |
| 720 } | 723 } |
| 721 | 724 |
| 722 | 725 |
| 723 THREADED_TEST(BigInteger) { | 726 THREADED_TEST(BigInteger) { |
| 724 v8::HandleScope scope; | 727 v8::HandleScope scope; |
| 725 LocalContext env; | 728 LocalContext env; |
| 726 int32_t value = i::Smi::kMaxValue + 1; | 729 // We cannot add one to a Smi::kMaxValue without wrapping. |
| 727 CHECK(value > i::Smi::kMaxValue); | 730 if (i::kSmiValueSize < 32) { |
| 728 CHECK(!i::Smi::IsValid(value)); | 731 int32_t value = i::Smi::kMaxValue + 1; |
| 729 Local<v8::Integer> value_obj = v8::Integer::New(value); | 732 CHECK(value > i::Smi::kMaxValue); |
| 730 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); | 733 CHECK(!i::Smi::IsValid(value)); |
| 734 Local<v8::Integer> value_obj = v8::Integer::New(value); |
| 735 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); |
| 736 } |
| 731 } | 737 } |
| 732 | 738 |
| 733 | 739 |
| 734 THREADED_TEST(TinyUnsignedInteger) { | 740 THREADED_TEST(TinyUnsignedInteger) { |
| 735 v8::HandleScope scope; | 741 v8::HandleScope scope; |
| 736 LocalContext env; | 742 LocalContext env; |
| 737 uint32_t value = 239; | 743 uint32_t value = 239; |
| 738 Local<v8::Integer> value_obj = v8::Integer::NewFromUnsigned(value); | 744 Local<v8::Integer> value_obj = v8::Integer::NewFromUnsigned(value); |
| 739 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); | 745 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); |
| 740 } | 746 } |
| (...skipping 7320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8061 env->Global()->Set(v8_str("get_stack_limit"), fun); | 8067 env->Global()->Set(v8_str("get_stack_limit"), fun); |
| 8062 CompileRun("get_stack_limit();"); | 8068 CompileRun("get_stack_limit();"); |
| 8063 | 8069 |
| 8064 CHECK(stack_limit == set_limit); | 8070 CHECK(stack_limit == set_limit); |
| 8065 } | 8071 } |
| 8066 { | 8072 { |
| 8067 v8::Locker locker; | 8073 v8::Locker locker; |
| 8068 CHECK(stack_limit == set_limit); | 8074 CHECK(stack_limit == set_limit); |
| 8069 } | 8075 } |
| 8070 } | 8076 } |
| OLD | NEW |