| 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 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2181 CHECK_EQ(static_cast<int>(3.14), | 2181 CHECK_EQ(static_cast<int>(3.14), |
| 2182 v8::Object::Cast(*res)->Get(v8_str("0"))->Int32Value()); | 2182 v8::Object::Cast(*res)->Get(v8_str("0"))->Int32Value()); |
| 2183 | 2183 |
| 2184 Handle<JSObject> o = | 2184 Handle<JSObject> o = |
| 2185 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2185 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
| 2186 | 2186 |
| 2187 CHECK(HEAP->InNewSpace(o->elements())); | 2187 CHECK(HEAP->InNewSpace(o->elements())); |
| 2188 } | 2188 } |
| 2189 | 2189 |
| 2190 | 2190 |
| 2191 TEST(OptimizedPretenuringCallNew) { | |
| 2192 i::FLAG_allow_natives_syntax = true; | |
| 2193 i::FLAG_pretenuring_call_new = true; | |
| 2194 CcTest::InitializeVM(); | |
| 2195 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return; | |
| 2196 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | |
| 2197 v8::HandleScope scope(CcTest::isolate()); | |
| 2198 HEAP->SetNewSpaceHighPromotionModeActive(true); | |
| 2199 | |
| 2200 AlwaysAllocateScope always_allocate; | |
| 2201 v8::Local<v8::Value> res = CompileRun( | |
| 2202 "function g() { this.a = 0; }" | |
| 2203 "function f() {" | |
| 2204 " return new g();" | |
| 2205 "};" | |
| 2206 "f(); f(); f();" | |
| 2207 "%OptimizeFunctionOnNextCall(f);" | |
| 2208 "f();"); | |
| 2209 | |
| 2210 Handle<JSObject> o = | |
| 2211 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | |
| 2212 CHECK(HEAP->InOldPointerSpace(*o)); | |
| 2213 } | |
| 2214 | |
| 2215 static int CountMapTransitions(Map* map) { | 2191 static int CountMapTransitions(Map* map) { |
| 2216 return map->transitions()->number_of_transitions(); | 2192 return map->transitions()->number_of_transitions(); |
| 2217 } | 2193 } |
| 2218 | 2194 |
| 2219 | 2195 |
| 2220 // Test that map transitions are cleared and maps are collected with | 2196 // Test that map transitions are cleared and maps are collected with |
| 2221 // incremental marking as well. | 2197 // incremental marking as well. |
| 2222 TEST(Regress1465) { | 2198 TEST(Regress1465) { |
| 2223 i::FLAG_stress_compaction = false; | 2199 i::FLAG_stress_compaction = false; |
| 2224 i::FLAG_allow_natives_syntax = true; | 2200 i::FLAG_allow_natives_syntax = true; |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3179 " var a = new Array(n);" | 3155 " var a = new Array(n);" |
| 3180 " for (var i = 0; i < n; i += 100) a[i] = i;" | 3156 " for (var i = 0; i < n; i += 100) a[i] = i;" |
| 3181 "};" | 3157 "};" |
| 3182 "f(10 * 1024 * 1024);"); | 3158 "f(10 * 1024 * 1024);"); |
| 3183 IncrementalMarking* marking = HEAP->incremental_marking(); | 3159 IncrementalMarking* marking = HEAP->incremental_marking(); |
| 3184 if (marking->IsStopped()) marking->Start(); | 3160 if (marking->IsStopped()) marking->Start(); |
| 3185 // This big step should be sufficient to mark the whole array. | 3161 // This big step should be sufficient to mark the whole array. |
| 3186 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 3162 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
| 3187 ASSERT(marking->IsComplete()); | 3163 ASSERT(marking->IsComplete()); |
| 3188 } | 3164 } |
| OLD | NEW |