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 19919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19930 i::Handle<i::Object> false_value = factory->false_value(); | 19930 i::Handle<i::Object> false_value = factory->false_value(); |
19931 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value); | 19931 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value); |
19932 } | 19932 } |
19933 | 19933 |
19934 | 19934 |
19935 UNINITIALIZED_TEST(IsolateEmbedderData) { | 19935 UNINITIALIZED_TEST(IsolateEmbedderData) { |
19936 CcTest::DisableAutomaticDispose(); | 19936 CcTest::DisableAutomaticDispose(); |
19937 v8::Isolate* isolate = v8::Isolate::New(); | 19937 v8::Isolate* isolate = v8::Isolate::New(); |
19938 isolate->Enter(); | 19938 isolate->Enter(); |
19939 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 19939 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
19940 for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) { | 19940 CHECK_EQ(NULL, isolate->GetData()); |
19941 CHECK_EQ(NULL, isolate->GetData(slot)); | 19941 CHECK_EQ(NULL, i_isolate->GetData()); |
19942 CHECK_EQ(NULL, i_isolate->GetData(slot)); | 19942 static void* data1 = reinterpret_cast<void*>(0xacce55ed); |
19943 } | 19943 isolate->SetData(data1); |
19944 for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) { | 19944 CHECK_EQ(data1, isolate->GetData()); |
19945 void* data = reinterpret_cast<void*>(0xacce55ed + slot); | 19945 CHECK_EQ(data1, i_isolate->GetData()); |
19946 isolate->SetData(slot, data); | 19946 static void* data2 = reinterpret_cast<void*>(0xdecea5ed); |
19947 } | 19947 i_isolate->SetData(data2); |
19948 for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) { | 19948 CHECK_EQ(data2, isolate->GetData()); |
19949 void* data = reinterpret_cast<void*>(0xacce55ed + slot); | 19949 CHECK_EQ(data2, i_isolate->GetData()); |
19950 CHECK_EQ(data, isolate->GetData(slot)); | |
19951 CHECK_EQ(data, i_isolate->GetData(slot)); | |
19952 } | |
19953 for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) { | |
19954 void* data = reinterpret_cast<void*>(0xdecea5ed + slot); | |
19955 isolate->SetData(slot, data); | |
19956 } | |
19957 for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) { | |
19958 void* data = reinterpret_cast<void*>(0xdecea5ed + slot); | |
19959 CHECK_EQ(data, isolate->GetData(slot)); | |
19960 CHECK_EQ(data, i_isolate->GetData(slot)); | |
19961 } | |
19962 isolate->Exit(); | 19950 isolate->Exit(); |
19963 isolate->Dispose(); | 19951 isolate->Dispose(); |
19964 } | 19952 } |
19965 | 19953 |
19966 | 19954 |
19967 TEST(StringEmpty) { | 19955 TEST(StringEmpty) { |
19968 LocalContext context; | 19956 LocalContext context; |
19969 i::Factory* factory = CcTest::i_isolate()->factory(); | 19957 i::Factory* factory = CcTest::i_isolate()->factory(); |
19970 v8::Isolate* isolate = CcTest::isolate(); | 19958 v8::Isolate* isolate = CcTest::isolate(); |
19971 v8::HandleScope scope(isolate); | 19959 v8::HandleScope scope(isolate); |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20824 } | 20812 } |
20825 for (int i = 0; i < runs; i++) { | 20813 for (int i = 0; i < runs; i++) { |
20826 Local<String> expected; | 20814 Local<String> expected; |
20827 if (i != 0) { | 20815 if (i != 0) { |
20828 CHECK_EQ(v8_str("escape value"), values[i]); | 20816 CHECK_EQ(v8_str("escape value"), values[i]); |
20829 } else { | 20817 } else { |
20830 CHECK(values[i].IsEmpty()); | 20818 CHECK(values[i].IsEmpty()); |
20831 } | 20819 } |
20832 } | 20820 } |
20833 } | 20821 } |
OLD | NEW |