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 13383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13394 SimulateFullSpace(HEAP->code_space()); | 13394 SimulateFullSpace(HEAP->code_space()); |
13395 CompileRun(script); | 13395 CompileRun(script); |
13396 | 13396 |
13397 // Keep a strong reference to the code object in the handle scope. | 13397 // Keep a strong reference to the code object in the handle scope. |
13398 i::Handle<i::Code> bar_code(i::Handle<i::JSFunction>::cast( | 13398 i::Handle<i::Code> bar_code(i::Handle<i::JSFunction>::cast( |
13399 v8::Utils::OpenHandle(*env->Global()->Get(v8_str("bar"))))->code()); | 13399 v8::Utils::OpenHandle(*env->Global()->Get(v8_str("bar"))))->code()); |
13400 i::Handle<i::Code> foo_code(i::Handle<i::JSFunction>::cast( | 13400 i::Handle<i::Code> foo_code(i::Handle<i::JSFunction>::cast( |
13401 v8::Utils::OpenHandle(*env->Global()->Get(v8_str("foo"))))->code()); | 13401 v8::Utils::OpenHandle(*env->Global()->Get(v8_str("foo"))))->code()); |
13402 | 13402 |
13403 // Clear the compilation cache to get more wastage. | 13403 // Clear the compilation cache to get more wastage. |
13404 ISOLATE->compilation_cache()->Clear(); | 13404 reinterpret_cast<i::Isolate*>(isolate)->compilation_cache()->Clear(); |
13405 } | 13405 } |
13406 | 13406 |
13407 // Force code movement. | 13407 // Force code movement. |
13408 HEAP->CollectAllAvailableGarbage("TestSetJitCodeEventHandler"); | 13408 HEAP->CollectAllAvailableGarbage("TestSetJitCodeEventHandler"); |
13409 | 13409 |
13410 V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault, NULL); | 13410 V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault, NULL); |
13411 | 13411 |
13412 CHECK_LE(kIterations, saw_bar); | 13412 CHECK_LE(kIterations, saw_bar); |
13413 CHECK_LT(0, move_events); | 13413 CHECK_LT(0, move_events); |
13414 | 13414 |
(...skipping 6313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19728 CHECK(*v8::Utils::OpenHandle(*v8::True()) == *true_value); | 19728 CHECK(*v8::Utils::OpenHandle(*v8::True()) == *true_value); |
19729 CHECK(*v8::Utils::OpenHandle(*v8::True(isolate)) == *true_value); | 19729 CHECK(*v8::Utils::OpenHandle(*v8::True(isolate)) == *true_value); |
19730 i::Handle<i::Object> false_value = factory->false_value(); | 19730 i::Handle<i::Object> false_value = factory->false_value(); |
19731 CHECK(*v8::Utils::OpenHandle(*v8::False()) == *false_value); | 19731 CHECK(*v8::Utils::OpenHandle(*v8::False()) == *false_value); |
19732 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value); | 19732 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value); |
19733 } | 19733 } |
19734 | 19734 |
19735 | 19735 |
19736 TEST(IsolateEmbedderData) { | 19736 TEST(IsolateEmbedderData) { |
19737 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 19737 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 19738 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
19738 CHECK_EQ(NULL, isolate->GetData()); | 19739 CHECK_EQ(NULL, isolate->GetData()); |
19739 CHECK_EQ(NULL, ISOLATE->GetData()); | 19740 CHECK_EQ(NULL, i_isolate->GetData()); |
19740 static void* data1 = reinterpret_cast<void*>(0xacce55ed); | 19741 static void* data1 = reinterpret_cast<void*>(0xacce55ed); |
19741 isolate->SetData(data1); | 19742 isolate->SetData(data1); |
19742 CHECK_EQ(data1, isolate->GetData()); | 19743 CHECK_EQ(data1, isolate->GetData()); |
19743 CHECK_EQ(data1, ISOLATE->GetData()); | 19744 CHECK_EQ(data1, i_isolate->GetData()); |
19744 static void* data2 = reinterpret_cast<void*>(0xdecea5ed); | 19745 static void* data2 = reinterpret_cast<void*>(0xdecea5ed); |
19745 ISOLATE->SetData(data2); | 19746 i_isolate->SetData(data2); |
19746 CHECK_EQ(data2, isolate->GetData()); | 19747 CHECK_EQ(data2, isolate->GetData()); |
19747 CHECK_EQ(data2, ISOLATE->GetData()); | 19748 CHECK_EQ(data2, i_isolate->GetData()); |
19748 ISOLATE->TearDown(); | 19749 i_isolate->TearDown(); |
19749 CHECK_EQ(data2, isolate->GetData()); | 19750 CHECK_EQ(data2, isolate->GetData()); |
19750 CHECK_EQ(data2, ISOLATE->GetData()); | 19751 CHECK_EQ(data2, i_isolate->GetData()); |
19751 } | 19752 } |
19752 | 19753 |
19753 | 19754 |
19754 TEST(StringEmpty) { | 19755 TEST(StringEmpty) { |
19755 LocalContext context; | 19756 LocalContext context; |
19756 i::Factory* factory = i::Isolate::Current()->factory(); | 19757 i::Factory* factory = i::Isolate::Current()->factory(); |
19757 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 19758 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
19758 v8::HandleScope scope(isolate); | 19759 v8::HandleScope scope(isolate); |
19759 i::Handle<i::Object> empty_string = factory->empty_string(); | 19760 i::Handle<i::Object> empty_string = factory->empty_string(); |
19760 CHECK(*v8::Utils::OpenHandle(*v8::String::Empty()) == *empty_string); | 19761 CHECK(*v8::Utils::OpenHandle(*v8::String::Empty()) == *empty_string); |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20579 // Verify function not cached | 20580 // Verify function not cached |
20580 int serial_number = | 20581 int serial_number = |
20581 i::Smi::cast(v8::Utils::OpenHandle(*func) | 20582 i::Smi::cast(v8::Utils::OpenHandle(*func) |
20582 ->shared()->get_api_func_data()->serial_number())->value(); | 20583 ->shared()->get_api_func_data()->serial_number())->value(); |
20583 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 20584 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
20584 i::Object* elm = i_isolate->native_context()->function_cache() | 20585 i::Object* elm = i_isolate->native_context()->function_cache() |
20585 ->GetElementNoExceptionThrown(i_isolate, serial_number); | 20586 ->GetElementNoExceptionThrown(i_isolate, serial_number); |
20586 CHECK(elm->IsNull()); | 20587 CHECK(elm->IsNull()); |
20587 } | 20588 } |
20588 | 20589 |
OLD | NEW |