| 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 2334 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2345   CHECK_EQ(static_cast<int>(3.14), | 2345   CHECK_EQ(static_cast<int>(3.14), | 
| 2346            v8::Object::Cast(*res)->Get(v8_str("0"))->Int32Value()); | 2346            v8::Object::Cast(*res)->Get(v8_str("0"))->Int32Value()); | 
| 2347 | 2347 | 
| 2348   Handle<JSObject> o = | 2348   Handle<JSObject> o = | 
| 2349       v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2349       v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 
| 2350 | 2350 | 
| 2351   CHECK(HEAP->InNewSpace(o->elements())); | 2351   CHECK(HEAP->InNewSpace(o->elements())); | 
| 2352 } | 2352 } | 
| 2353 | 2353 | 
| 2354 | 2354 | 
|  | 2355 TEST(OptimizedPretenuringCallNew) { | 
|  | 2356   i::FLAG_allow_natives_syntax = true; | 
|  | 2357   i::FLAG_pretenuring_call_new = true; | 
|  | 2358   CcTest::InitializeVM(); | 
|  | 2359   if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return; | 
|  | 2360   if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 
|  | 2361   v8::HandleScope scope(CcTest::isolate()); | 
|  | 2362   HEAP->SetNewSpaceHighPromotionModeActive(true); | 
|  | 2363 | 
|  | 2364   AlwaysAllocateScope always_allocate; | 
|  | 2365   v8::Local<v8::Value> res = CompileRun( | 
|  | 2366       "function g() { this.a = 0; }" | 
|  | 2367       "function f() {" | 
|  | 2368       "  return new g();" | 
|  | 2369       "};" | 
|  | 2370       "f(); f(); f();" | 
|  | 2371       "%OptimizeFunctionOnNextCall(f);" | 
|  | 2372       "f();"); | 
|  | 2373 | 
|  | 2374   Handle<JSObject> o = | 
|  | 2375       v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 
|  | 2376   CHECK(HEAP->InOldPointerSpace(*o)); | 
|  | 2377 } | 
|  | 2378 | 
|  | 2379 | 
| 2355 static int CountMapTransitions(Map* map) { | 2380 static int CountMapTransitions(Map* map) { | 
| 2356   return map->transitions()->number_of_transitions(); | 2381   return map->transitions()->number_of_transitions(); | 
| 2357 } | 2382 } | 
| 2358 | 2383 | 
| 2359 | 2384 | 
| 2360 // Test that map transitions are cleared and maps are collected with | 2385 // Test that map transitions are cleared and maps are collected with | 
| 2361 // incremental marking as well. | 2386 // incremental marking as well. | 
| 2362 TEST(Regress1465) { | 2387 TEST(Regress1465) { | 
| 2363   i::FLAG_stress_compaction = false; | 2388   i::FLAG_stress_compaction = false; | 
| 2364   i::FLAG_allow_natives_syntax = true; | 2389   i::FLAG_allow_natives_syntax = true; | 
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3323              "    var a = new Array(n);" | 3348              "    var a = new Array(n);" | 
| 3324              "    for (var i = 0; i < n; i += 100) a[i] = i;" | 3349              "    for (var i = 0; i < n; i += 100) a[i] = i;" | 
| 3325              "};" | 3350              "};" | 
| 3326              "f(10 * 1024 * 1024);"); | 3351              "f(10 * 1024 * 1024);"); | 
| 3327   IncrementalMarking* marking = HEAP->incremental_marking(); | 3352   IncrementalMarking* marking = HEAP->incremental_marking(); | 
| 3328   if (marking->IsStopped()) marking->Start(); | 3353   if (marking->IsStopped()) marking->Start(); | 
| 3329   // This big step should be sufficient to mark the whole array. | 3354   // This big step should be sufficient to mark the whole array. | 
| 3330   marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 3355   marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 
| 3331   ASSERT(marking->IsComplete()); | 3356   ASSERT(marking->IsComplete()); | 
| 3332 } | 3357 } | 
| OLD | NEW | 
|---|