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 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2148 CHECK_EQ(static_cast<int>(3.14), | 2148 CHECK_EQ(static_cast<int>(3.14), |
2149 v8::Object::Cast(*res)->Get(v8_str("0"))->Int32Value()); | 2149 v8::Object::Cast(*res)->Get(v8_str("0"))->Int32Value()); |
2150 | 2150 |
2151 Handle<JSObject> o = | 2151 Handle<JSObject> o = |
2152 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2152 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2153 | 2153 |
2154 CHECK(HEAP->InNewSpace(o->elements())); | 2154 CHECK(HEAP->InNewSpace(o->elements())); |
2155 } | 2155 } |
2156 | 2156 |
2157 | 2157 |
| 2158 TEST(OptimizedPretenuringCallNew) { |
| 2159 i::FLAG_allow_natives_syntax = true; |
| 2160 i::FLAG_pretenuring_call_new = true; |
| 2161 CcTest::InitializeVM(); |
| 2162 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return; |
| 2163 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2164 v8::HandleScope scope(CcTest::isolate()); |
| 2165 HEAP->SetNewSpaceHighPromotionModeActive(true); |
| 2166 |
| 2167 AlwaysAllocateScope always_allocate; |
| 2168 v8::Local<v8::Value> res = CompileRun( |
| 2169 "function g() { this.a = 0; }" |
| 2170 "function f() {" |
| 2171 " return new g();" |
| 2172 "};" |
| 2173 "f(); f(); f();" |
| 2174 "%OptimizeFunctionOnNextCall(f);" |
| 2175 "f();"); |
| 2176 |
| 2177 Handle<JSObject> o = |
| 2178 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
| 2179 CHECK(HEAP->InOldPointerSpace(*o)); |
| 2180 } |
| 2181 |
2158 static int CountMapTransitions(Map* map) { | 2182 static int CountMapTransitions(Map* map) { |
2159 return map->transitions()->number_of_transitions(); | 2183 return map->transitions()->number_of_transitions(); |
2160 } | 2184 } |
2161 | 2185 |
2162 | 2186 |
2163 // Test that map transitions are cleared and maps are collected with | 2187 // Test that map transitions are cleared and maps are collected with |
2164 // incremental marking as well. | 2188 // incremental marking as well. |
2165 TEST(Regress1465) { | 2189 TEST(Regress1465) { |
2166 i::FLAG_allow_natives_syntax = true; | 2190 i::FLAG_allow_natives_syntax = true; |
2167 i::FLAG_trace_incremental_marking = true; | 2191 i::FLAG_trace_incremental_marking = true; |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3113 " var a = new Array(n);" | 3137 " var a = new Array(n);" |
3114 " for (var i = 0; i < n; i += 100) a[i] = i;" | 3138 " for (var i = 0; i < n; i += 100) a[i] = i;" |
3115 "};" | 3139 "};" |
3116 "f(10 * 1024 * 1024);"); | 3140 "f(10 * 1024 * 1024);"); |
3117 IncrementalMarking* marking = HEAP->incremental_marking(); | 3141 IncrementalMarking* marking = HEAP->incremental_marking(); |
3118 if (marking->IsStopped()) marking->Start(); | 3142 if (marking->IsStopped()) marking->Start(); |
3119 // This big step should be sufficient to mark the whole array. | 3143 // This big step should be sufficient to mark the whole array. |
3120 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 3144 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
3121 ASSERT(marking->IsComplete()); | 3145 ASSERT(marking->IsComplete()); |
3122 } | 3146 } |
OLD | NEW |