OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 } | 1353 } |
1354 | 1354 |
1355 | 1355 |
1356 THREADED_TEST(BigSmiInteger) { | 1356 THREADED_TEST(BigSmiInteger) { |
1357 LocalContext env; | 1357 LocalContext env; |
1358 v8::HandleScope scope(env->GetIsolate()); | 1358 v8::HandleScope scope(env->GetIsolate()); |
1359 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 1359 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
1360 | 1360 |
1361 int32_t value = i::Smi::kMaxValue; | 1361 int32_t value = i::Smi::kMaxValue; |
1362 // We cannot add one to a Smi::kMaxValue without wrapping. | 1362 // We cannot add one to a Smi::kMaxValue without wrapping. |
1363 if (i::kSmiValueSize < 32) { | 1363 if (i::SmiValuesAre31Bits()) { |
1364 CHECK(i::Smi::IsValid(value)); | 1364 CHECK(i::Smi::IsValid(value)); |
1365 CHECK(!i::Smi::IsValid(value + 1)); | 1365 CHECK(!i::Smi::IsValid(value + 1)); |
1366 | 1366 |
1367 Local<v8::Integer> value_obj = v8::Integer::New(value); | 1367 Local<v8::Integer> value_obj = v8::Integer::New(value); |
1368 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); | 1368 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); |
1369 | 1369 |
1370 value_obj = v8::Integer::New(value, isolate); | 1370 value_obj = v8::Integer::New(value, isolate); |
1371 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); | 1371 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); |
1372 } | 1372 } |
1373 } | 1373 } |
1374 | 1374 |
1375 | 1375 |
1376 THREADED_TEST(BigInteger) { | 1376 THREADED_TEST(BigInteger) { |
1377 LocalContext env; | 1377 LocalContext env; |
1378 v8::HandleScope scope(env->GetIsolate()); | 1378 v8::HandleScope scope(env->GetIsolate()); |
1379 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 1379 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
1380 | 1380 |
1381 // We cannot add one to a Smi::kMaxValue without wrapping. | 1381 // We cannot add one to a Smi::kMaxValue without wrapping. |
1382 if (i::kSmiValueSize < 32) { | 1382 if (i::SmiValuesAre31Bits()) { |
1383 // The casts allow this to compile, even if Smi::kMaxValue is 2^31-1. | 1383 // The casts allow this to compile, even if Smi::kMaxValue is 2^31-1. |
1384 // The code will not be run in that case, due to the "if" guard. | 1384 // The code will not be run in that case, due to the "if" guard. |
1385 int32_t value = | 1385 int32_t value = |
1386 static_cast<int32_t>(static_cast<uint32_t>(i::Smi::kMaxValue) + 1); | 1386 static_cast<int32_t>(static_cast<uint32_t>(i::Smi::kMaxValue) + 1); |
1387 CHECK(value > i::Smi::kMaxValue); | 1387 CHECK(value > i::Smi::kMaxValue); |
1388 CHECK(!i::Smi::IsValid(value)); | 1388 CHECK(!i::Smi::IsValid(value)); |
1389 | 1389 |
1390 Local<v8::Integer> value_obj = v8::Integer::New(value); | 1390 Local<v8::Integer> value_obj = v8::Integer::New(value); |
1391 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); | 1391 CHECK_EQ(static_cast<int64_t>(value), value_obj->Value()); |
1392 | 1392 |
(...skipping 18774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20167 CheckCorrectThrow("%HasProperty(other, 'x')"); | 20167 CheckCorrectThrow("%HasProperty(other, 'x')"); |
20168 CheckCorrectThrow("%HasElement(other, 1)"); | 20168 CheckCorrectThrow("%HasElement(other, 1)"); |
20169 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); | 20169 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); |
20170 CheckCorrectThrow("%GetPropertyNames(other)"); | 20170 CheckCorrectThrow("%GetPropertyNames(other)"); |
20171 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); | 20171 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); |
20172 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" | 20172 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" |
20173 "other, 'x', null, null, 1)"); | 20173 "other, 'x', null, null, 1)"); |
20174 } | 20174 } |
20175 | 20175 |
20176 #endif // WIN32 | 20176 #endif // WIN32 |
OLD | NEW |