Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: test/cctest/test-heap.cc

Issue 15734007: Move global pretenuring flag check to ShouldGloballyPretenure(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 Handle<JSObject> o = 2071 Handle<JSObject> o =
2072 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); 2072 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
2073 2073
2074 CHECK(HEAP->InNewSpace(*o)); 2074 CHECK(HEAP->InNewSpace(*o));
2075 } 2075 }
2076 2076
2077 2077
2078 // Test pretenuring of array literals allocated with HAllocate. 2078 // Test pretenuring of array literals allocated with HAllocate.
2079 TEST(OptimizedPretenuringArrayLiterals) { 2079 TEST(OptimizedPretenuringArrayLiterals) {
2080 i::FLAG_allow_natives_syntax = true; 2080 i::FLAG_allow_natives_syntax = true;
2081 i::FLAG_pretenure_literals = true;
2082 CcTest::InitializeVM(); 2081 CcTest::InitializeVM();
2083 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return; 2082 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
2084 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; 2083 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
2085 v8::HandleScope scope(CcTest::isolate()); 2084 v8::HandleScope scope(CcTest::isolate());
2085 HEAP->SetNewSpaceHighPromotionModeActive(true);
2086 2086
2087 AlwaysAllocateScope always_allocate; 2087 AlwaysAllocateScope always_allocate;
2088 v8::Local<v8::Value> res = CompileRun( 2088 v8::Local<v8::Value> res = CompileRun(
2089 "function f() {" 2089 "function f() {"
2090 " var numbers = [1, 2, 3];" 2090 " var numbers = [1, 2, 3];"
2091 " numbers[0] = {};" 2091 " numbers[0] = {};"
2092 " return numbers;" 2092 " return numbers;"
2093 "};" 2093 "};"
2094 "f(); f(); f();" 2094 "f(); f(); f();"
2095 "%OptimizeFunctionOnNextCall(f);" 2095 "%OptimizeFunctionOnNextCall(f);"
2096 "f();"); 2096 "f();");
2097 2097
2098 Handle<JSObject> o = 2098 Handle<JSObject> o =
2099 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); 2099 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
2100 2100
2101 CHECK(HEAP->InOldPointerSpace(o->elements())); 2101 CHECK(HEAP->InOldPointerSpace(o->elements()));
2102 } 2102 }
2103 2103
2104 2104
2105 TEST(OptimizedPretenuringSimpleArrayLiterals) { 2105 TEST(OptimizedPretenuringSimpleArrayLiterals) {
2106 i::FLAG_allow_natives_syntax = true; 2106 i::FLAG_allow_natives_syntax = true;
2107 i::FLAG_pretenure_literals = false; 2107 i::FLAG_pretenuring = false;
2108 CcTest::InitializeVM(); 2108 CcTest::InitializeVM();
2109 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return; 2109 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
2110 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; 2110 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
2111 v8::HandleScope scope(CcTest::isolate()); 2111 v8::HandleScope scope(CcTest::isolate());
2112 2112
2113 AlwaysAllocateScope always_allocate; 2113 AlwaysAllocateScope always_allocate;
2114 v8::Local<v8::Value> res = CompileRun( 2114 v8::Local<v8::Value> res = CompileRun(
2115 "function f() {" 2115 "function f() {"
2116 " return [1, 2, 3];" 2116 " return [1, 2, 3];"
2117 "};" 2117 "};"
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 } 3096 }
3097 // An entire block of handles has been filled. 3097 // An entire block of handles has been filled.
3098 // Next handle would require a new block. 3098 // Next handle would require a new block.
3099 ASSERT(data->next == data->limit); 3099 ASSERT(data->next == data->limit);
3100 3100
3101 DeferredHandleScope deferred(isolate); 3101 DeferredHandleScope deferred(isolate);
3102 DummyVisitor visitor; 3102 DummyVisitor visitor;
3103 isolate->handle_scope_implementer()->Iterate(&visitor); 3103 isolate->handle_scope_implementer()->Iterate(&visitor);
3104 deferred.Detach(); 3104 deferred.Detach();
3105 } 3105 }
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698