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 12295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12306 break; | 12306 break; |
12307 } | 12307 } |
12308 } | 12308 } |
12309 | 12309 |
12310 | 12310 |
12311 UNINITIALIZED_TEST(SetJitCodeEventHandler) { | 12311 UNINITIALIZED_TEST(SetJitCodeEventHandler) { |
12312 i::FLAG_stress_compaction = true; | 12312 i::FLAG_stress_compaction = true; |
12313 i::FLAG_incremental_marking = false; | 12313 i::FLAG_incremental_marking = false; |
12314 if (i::FLAG_never_compact) return; | 12314 if (i::FLAG_never_compact) return; |
12315 const char* script = | 12315 const char* script = |
12316 "function bar() {" | 12316 "function bar() {" |
12317 " var sum = 0;" | 12317 " var sum = 0;" |
12318 " for (i = 0; i < 100; ++i)" | 12318 " for (i = 0; i < 10; ++i)" |
12319 " sum = foo(i);" | 12319 " sum = foo(i);" |
12320 " return sum;" | 12320 " return sum;" |
12321 "}" | 12321 "}" |
12322 "function foo(i) { return i * i; };" | 12322 "function foo(i) { return i; };" |
12323 "bar();"; | 12323 "bar();"; |
12324 | 12324 |
12325 // Run this test in a new isolate to make sure we don't | 12325 // Run this test in a new isolate to make sure we don't |
12326 // have remnants of state from other code. | 12326 // have remnants of state from other code. |
12327 v8::Isolate* isolate = v8::Isolate::New(); | 12327 v8::Isolate* isolate = v8::Isolate::New(); |
12328 isolate->Enter(); | 12328 isolate->Enter(); |
12329 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 12329 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
12330 i::Heap* heap = i_isolate->heap(); | 12330 i::Heap* heap = i_isolate->heap(); |
12331 | 12331 |
12332 // Start with a clean slate. | 12332 // Start with a clean slate. |
12333 heap->CollectAllAvailableGarbage("TestSetJitCodeEventHandler_Prepare"); | 12333 heap->CollectAllAvailableGarbage("TestSetJitCodeEventHandler_Prepare"); |
(...skipping 9607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21941 } | 21941 } |
21942 { | 21942 { |
21943 v8::TryCatch try_catch; | 21943 v8::TryCatch try_catch; |
21944 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); | 21944 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); |
21945 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, | 21945 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, |
21946 length).IsEmpty()); | 21946 length).IsEmpty()); |
21947 CHECK(try_catch.HasCaught()); | 21947 CHECK(try_catch.HasCaught()); |
21948 } | 21948 } |
21949 free(buffer); | 21949 free(buffer); |
21950 } | 21950 } |
OLD | NEW |