| 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 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 v8::Handle<v8::Function>::Cast(global->Get(v8_str("g"))); | 2010 v8::Handle<v8::Function>::Cast(global->Get(v8_str("g"))); |
| 2011 g->Call(global, 0, NULL); | 2011 g->Call(global, 0, NULL); |
| 2012 } | 2012 } |
| 2013 | 2013 |
| 2014 CcTest::heap()->incremental_marking()->set_should_hurry(true); | 2014 CcTest::heap()->incremental_marking()->set_should_hurry(true); |
| 2015 CcTest::heap()->CollectGarbage(OLD_POINTER_SPACE); | 2015 CcTest::heap()->CollectGarbage(OLD_POINTER_SPACE); |
| 2016 } | 2016 } |
| 2017 | 2017 |
| 2018 | 2018 |
| 2019 TEST(PrototypeTransitionClearing) { | 2019 TEST(PrototypeTransitionClearing) { |
| 2020 if (FLAG_never_compact) return; |
| 2020 CcTest::InitializeVM(); | 2021 CcTest::InitializeVM(); |
| 2021 Isolate* isolate = CcTest::i_isolate(); | 2022 Isolate* isolate = CcTest::i_isolate(); |
| 2022 Factory* factory = isolate->factory(); | 2023 Factory* factory = isolate->factory(); |
| 2023 v8::HandleScope scope(CcTest::isolate()); | 2024 v8::HandleScope scope(CcTest::isolate()); |
| 2024 | 2025 |
| 2025 CompileRun("var base = {};"); | 2026 CompileRun("var base = {};"); |
| 2026 Handle<JSObject> baseObject = | 2027 Handle<JSObject> baseObject = |
| 2027 v8::Utils::OpenHandle( | 2028 v8::Utils::OpenHandle( |
| 2028 *v8::Handle<v8::Object>::Cast( | 2029 *v8::Handle<v8::Object>::Cast( |
| 2029 CcTest::global()->Get(v8_str("base")))); | 2030 CcTest::global()->Get(v8_str("base")))); |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2884 *v8::Handle<v8::Object>::Cast( | 2885 *v8::Handle<v8::Object>::Cast( |
| 2885 CcTest::global()->Get(v8_str("root")))); | 2886 CcTest::global()->Get(v8_str("root")))); |
| 2886 | 2887 |
| 2887 // The root object should be in a sane state. | 2888 // The root object should be in a sane state. |
| 2888 CHECK(root->IsJSObject()); | 2889 CHECK(root->IsJSObject()); |
| 2889 CHECK(root->map()->IsMap()); | 2890 CHECK(root->map()->IsMap()); |
| 2890 } | 2891 } |
| 2891 | 2892 |
| 2892 | 2893 |
| 2893 TEST(ReleaseOverReservedPages) { | 2894 TEST(ReleaseOverReservedPages) { |
| 2895 if (FLAG_never_compact) return; |
| 2894 i::FLAG_trace_gc = true; | 2896 i::FLAG_trace_gc = true; |
| 2895 // The optimizer can allocate stuff, messing up the test. | 2897 // The optimizer can allocate stuff, messing up the test. |
| 2896 i::FLAG_crankshaft = false; | 2898 i::FLAG_crankshaft = false; |
| 2897 i::FLAG_always_opt = false; | 2899 i::FLAG_always_opt = false; |
| 2898 CcTest::InitializeVM(); | 2900 CcTest::InitializeVM(); |
| 2899 Isolate* isolate = CcTest::i_isolate(); | 2901 Isolate* isolate = CcTest::i_isolate(); |
| 2900 Factory* factory = isolate->factory(); | 2902 Factory* factory = isolate->factory(); |
| 2901 Heap* heap = isolate->heap(); | 2903 Heap* heap = isolate->heap(); |
| 2902 v8::HandleScope scope(CcTest::isolate()); | 2904 v8::HandleScope scope(CcTest::isolate()); |
| 2903 static const int number_of_test_pages = 20; | 2905 static const int number_of_test_pages = 20; |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3547 CcTest::global()->Set(array_name, array_obj); | 3549 CcTest::global()->Set(array_name, array_obj); |
| 3548 | 3550 |
| 3549 // This should crash with a protection violation if we are running a build | 3551 // This should crash with a protection violation if we are running a build |
| 3550 // with the bug. | 3552 // with the bug. |
| 3551 AlwaysAllocateScope aa_scope(isolate); | 3553 AlwaysAllocateScope aa_scope(isolate); |
| 3552 v8::Script::Compile(mote_code_string)->Run(); | 3554 v8::Script::Compile(mote_code_string)->Run(); |
| 3553 } | 3555 } |
| 3554 | 3556 |
| 3555 | 3557 |
| 3556 TEST(Regress168801) { | 3558 TEST(Regress168801) { |
| 3559 if (i::FLAG_never_compact) return; |
| 3557 i::FLAG_always_compact = true; | 3560 i::FLAG_always_compact = true; |
| 3558 i::FLAG_cache_optimized_code = false; | 3561 i::FLAG_cache_optimized_code = false; |
| 3559 i::FLAG_allow_natives_syntax = true; | 3562 i::FLAG_allow_natives_syntax = true; |
| 3560 i::FLAG_flush_code_incrementally = true; | 3563 i::FLAG_flush_code_incrementally = true; |
| 3561 CcTest::InitializeVM(); | 3564 CcTest::InitializeVM(); |
| 3562 Isolate* isolate = CcTest::i_isolate(); | 3565 Isolate* isolate = CcTest::i_isolate(); |
| 3563 Heap* heap = isolate->heap(); | 3566 Heap* heap = isolate->heap(); |
| 3564 HandleScope scope(isolate); | 3567 HandleScope scope(isolate); |
| 3565 | 3568 |
| 3566 // Perform one initial GC to enable code flushing. | 3569 // Perform one initial GC to enable code flushing. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3603 CompileRun("%OptimizeFunctionOnNextCall(f); f(3);"); | 3606 CompileRun("%OptimizeFunctionOnNextCall(f); f(3);"); |
| 3604 } | 3607 } |
| 3605 | 3608 |
| 3606 // This cycle will bust the heap and subsequent cycles will go ballistic. | 3609 // This cycle will bust the heap and subsequent cycles will go ballistic. |
| 3607 heap->CollectAllGarbage(Heap::kNoGCFlags); | 3610 heap->CollectAllGarbage(Heap::kNoGCFlags); |
| 3608 heap->CollectAllGarbage(Heap::kNoGCFlags); | 3611 heap->CollectAllGarbage(Heap::kNoGCFlags); |
| 3609 } | 3612 } |
| 3610 | 3613 |
| 3611 | 3614 |
| 3612 TEST(Regress173458) { | 3615 TEST(Regress173458) { |
| 3616 if (i::FLAG_never_compact) return; |
| 3613 i::FLAG_always_compact = true; | 3617 i::FLAG_always_compact = true; |
| 3614 i::FLAG_cache_optimized_code = false; | 3618 i::FLAG_cache_optimized_code = false; |
| 3615 i::FLAG_allow_natives_syntax = true; | 3619 i::FLAG_allow_natives_syntax = true; |
| 3616 i::FLAG_flush_code_incrementally = true; | 3620 i::FLAG_flush_code_incrementally = true; |
| 3617 CcTest::InitializeVM(); | 3621 CcTest::InitializeVM(); |
| 3618 Isolate* isolate = CcTest::i_isolate(); | 3622 Isolate* isolate = CcTest::i_isolate(); |
| 3619 Heap* heap = isolate->heap(); | 3623 Heap* heap = isolate->heap(); |
| 3620 HandleScope scope(isolate); | 3624 HandleScope scope(isolate); |
| 3621 | 3625 |
| 3622 // Perform one initial GC to enable code flushing. | 3626 // Perform one initial GC to enable code flushing. |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4183 v8::Context::Scope cscope(context); | 4187 v8::Context::Scope cscope(context); |
| 4184 | 4188 |
| 4185 v8::Local<v8::Value> result = CompileRun( | 4189 v8::Local<v8::Value> result = CompileRun( |
| 4186 "var locals = '';" | 4190 "var locals = '';" |
| 4187 "for (var i = 0; i < 512; i++) locals += 'var v' + i + '= 42;';" | 4191 "for (var i = 0; i < 512; i++) locals += 'var v' + i + '= 42;';" |
| 4188 "eval('function f() {' + locals + 'return function() { return v0; }; }');" | 4192 "eval('function f() {' + locals + 'return function() { return v0; }; }');" |
| 4189 "interrupt();" // This triggers a fake stack overflow in f. | 4193 "interrupt();" // This triggers a fake stack overflow in f. |
| 4190 "f()()"); | 4194 "f()()"); |
| 4191 CHECK_EQ(42.0, result->ToNumber()->Value()); | 4195 CHECK_EQ(42.0, result->ToNumber()->Value()); |
| 4192 } | 4196 } |
| OLD | NEW |