| 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 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 CHECK_EQ(true, as_boxed->ValueOf()); | 1624 CHECK_EQ(true, as_boxed->ValueOf()); |
| 1625 as_boxed = boxed_false.As<v8::BooleanObject>(); | 1625 as_boxed = boxed_false.As<v8::BooleanObject>(); |
| 1626 CHECK_EQ(false, as_boxed->ValueOf()); | 1626 CHECK_EQ(false, as_boxed->ValueOf()); |
| 1627 } | 1627 } |
| 1628 | 1628 |
| 1629 | 1629 |
| 1630 THREADED_TEST(PrimitiveAndWrappedBooleans) { | 1630 THREADED_TEST(PrimitiveAndWrappedBooleans) { |
| 1631 LocalContext env; | 1631 LocalContext env; |
| 1632 v8::HandleScope scope(env->GetIsolate()); | 1632 v8::HandleScope scope(env->GetIsolate()); |
| 1633 | 1633 |
| 1634 Local<Value> primitive_false = Boolean::New(false); | 1634 Local<Value> primitive_false = Boolean::New(env->GetIsolate(), false); |
| 1635 CHECK(primitive_false->IsBoolean()); | 1635 CHECK(primitive_false->IsBoolean()); |
| 1636 CHECK(!primitive_false->IsBooleanObject()); | 1636 CHECK(!primitive_false->IsBooleanObject()); |
| 1637 CHECK(!primitive_false->BooleanValue()); | 1637 CHECK(!primitive_false->BooleanValue()); |
| 1638 CHECK(!primitive_false->IsTrue()); | 1638 CHECK(!primitive_false->IsTrue()); |
| 1639 CHECK(primitive_false->IsFalse()); | 1639 CHECK(primitive_false->IsFalse()); |
| 1640 | 1640 |
| 1641 Local<Value> false_value = BooleanObject::New(false); | 1641 Local<Value> false_value = BooleanObject::New(false); |
| 1642 CHECK(!false_value->IsBoolean()); | 1642 CHECK(!false_value->IsBoolean()); |
| 1643 CHECK(false_value->IsBooleanObject()); | 1643 CHECK(false_value->IsBooleanObject()); |
| 1644 CHECK(false_value->BooleanValue()); | 1644 CHECK(false_value->BooleanValue()); |
| 1645 CHECK(!false_value->IsTrue()); | 1645 CHECK(!false_value->IsTrue()); |
| 1646 CHECK(!false_value->IsFalse()); | 1646 CHECK(!false_value->IsFalse()); |
| 1647 | 1647 |
| 1648 Local<BooleanObject> false_boolean_object = false_value.As<BooleanObject>(); | 1648 Local<BooleanObject> false_boolean_object = false_value.As<BooleanObject>(); |
| 1649 CHECK(!false_boolean_object->IsBoolean()); | 1649 CHECK(!false_boolean_object->IsBoolean()); |
| 1650 CHECK(false_boolean_object->IsBooleanObject()); | 1650 CHECK(false_boolean_object->IsBooleanObject()); |
| 1651 // TODO(svenpanne) Uncomment when BooleanObject::BooleanValue() is deleted. | 1651 // TODO(svenpanne) Uncomment when BooleanObject::BooleanValue() is deleted. |
| 1652 // CHECK(false_boolean_object->BooleanValue()); | 1652 // CHECK(false_boolean_object->BooleanValue()); |
| 1653 CHECK(!false_boolean_object->ValueOf()); | 1653 CHECK(!false_boolean_object->ValueOf()); |
| 1654 CHECK(!false_boolean_object->IsTrue()); | 1654 CHECK(!false_boolean_object->IsTrue()); |
| 1655 CHECK(!false_boolean_object->IsFalse()); | 1655 CHECK(!false_boolean_object->IsFalse()); |
| 1656 | 1656 |
| 1657 Local<Value> primitive_true = Boolean::New(true); | 1657 Local<Value> primitive_true = Boolean::New(env->GetIsolate(), true); |
| 1658 CHECK(primitive_true->IsBoolean()); | 1658 CHECK(primitive_true->IsBoolean()); |
| 1659 CHECK(!primitive_true->IsBooleanObject()); | 1659 CHECK(!primitive_true->IsBooleanObject()); |
| 1660 CHECK(primitive_true->BooleanValue()); | 1660 CHECK(primitive_true->BooleanValue()); |
| 1661 CHECK(primitive_true->IsTrue()); | 1661 CHECK(primitive_true->IsTrue()); |
| 1662 CHECK(!primitive_true->IsFalse()); | 1662 CHECK(!primitive_true->IsFalse()); |
| 1663 | 1663 |
| 1664 Local<Value> true_value = BooleanObject::New(true); | 1664 Local<Value> true_value = BooleanObject::New(true); |
| 1665 CHECK(!true_value->IsBoolean()); | 1665 CHECK(!true_value->IsBoolean()); |
| 1666 CHECK(true_value->IsBooleanObject()); | 1666 CHECK(true_value->IsBooleanObject()); |
| 1667 CHECK(true_value->BooleanValue()); | 1667 CHECK(true_value->BooleanValue()); |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2618 THREADED_TEST(EmbedderData) { | 2618 THREADED_TEST(EmbedderData) { |
| 2619 LocalContext env; | 2619 LocalContext env; |
| 2620 v8::HandleScope scope(env->GetIsolate()); | 2620 v8::HandleScope scope(env->GetIsolate()); |
| 2621 | 2621 |
| 2622 CheckEmbedderData( | 2622 CheckEmbedderData( |
| 2623 &env, 3, | 2623 &env, 3, |
| 2624 v8::String::NewFromUtf8(env->GetIsolate(), "The quick brown fox jumps")); | 2624 v8::String::NewFromUtf8(env->GetIsolate(), "The quick brown fox jumps")); |
| 2625 CheckEmbedderData(&env, 2, v8::String::NewFromUtf8(env->GetIsolate(), | 2625 CheckEmbedderData(&env, 2, v8::String::NewFromUtf8(env->GetIsolate(), |
| 2626 "over the lazy dog.")); | 2626 "over the lazy dog.")); |
| 2627 CheckEmbedderData(&env, 1, v8::Number::New(1.2345)); | 2627 CheckEmbedderData(&env, 1, v8::Number::New(1.2345)); |
| 2628 CheckEmbedderData(&env, 0, v8::Boolean::New(true)); | 2628 CheckEmbedderData(&env, 0, v8::Boolean::New(env->GetIsolate(), true)); |
| 2629 } | 2629 } |
| 2630 | 2630 |
| 2631 | 2631 |
| 2632 THREADED_TEST(IdentityHash) { | 2632 THREADED_TEST(IdentityHash) { |
| 2633 LocalContext env; | 2633 LocalContext env; |
| 2634 v8::HandleScope scope(env->GetIsolate()); | 2634 v8::HandleScope scope(env->GetIsolate()); |
| 2635 | 2635 |
| 2636 // Ensure that the test starts with an fresh heap to test whether the hash | 2636 // Ensure that the test starts with an fresh heap to test whether the hash |
| 2637 // code is based on the address. | 2637 // code is based on the address. |
| 2638 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); | 2638 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); |
| (...skipping 18141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20780 } | 20780 } |
| 20781 for (int i = 0; i < runs; i++) { | 20781 for (int i = 0; i < runs; i++) { |
| 20782 Local<String> expected; | 20782 Local<String> expected; |
| 20783 if (i != 0) { | 20783 if (i != 0) { |
| 20784 CHECK_EQ(v8_str("escape value"), values[i]); | 20784 CHECK_EQ(v8_str("escape value"), values[i]); |
| 20785 } else { | 20785 } else { |
| 20786 CHECK(values[i].IsEmpty()); | 20786 CHECK(values[i].IsEmpty()); |
| 20787 } | 20787 } |
| 20788 } | 20788 } |
| 20789 } | 20789 } |
| OLD | NEW |