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

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

Issue 15734002: Add pretenuring support to HAllocateObject. (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
« src/hydrogen-instructions.h ('K') | « src/x64/lithium-codegen-x64.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 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 "%OptimizeFunctionOnNextCall(f);" 2119 "%OptimizeFunctionOnNextCall(f);"
2120 "f();"); 2120 "f();");
2121 2121
2122 Handle<JSObject> o = 2122 Handle<JSObject> o =
2123 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); 2123 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
2124 2124
2125 CHECK(HEAP->InNewSpace(*o)); 2125 CHECK(HEAP->InNewSpace(*o));
2126 } 2126 }
2127 2127
2128 2128
2129 TEST(OptimizedPretenuringObjectAllocation) {
2130 i::FLAG_allow_natives_syntax = true;
2131 i::FLAG_pretenure_hallocateobject = true;
2132 CcTest::InitializeVM();
2133 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
2134 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
2135 v8::HandleScope scope(CcTest::isolate());
2136 HEAP->SetNewSpaceHighPromotionModeActive(true);
2137
2138 AlwaysAllocateScope always_allocate;
2139 v8::Local<v8::Value> res = CompileRun(
2140 "function g() { this.a = 0; }"
2141 "function f() {"
2142 " return new g();"
2143 "};"
2144 "f(); f(); f();"
2145 "%OptimizeFunctionOnNextCall(f);"
2146 "f();");
2147
2148 Handle<JSObject> o =
2149 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
2150
2151 CHECK(HEAP->InOldPointerSpace(*o));
2152 }
2153
2154
2129 // Test regular array literals allocation. 2155 // Test regular array literals allocation.
2130 TEST(OptimizedAllocationArrayLiterals) { 2156 TEST(OptimizedAllocationArrayLiterals) {
2131 i::FLAG_allow_natives_syntax = true; 2157 i::FLAG_allow_natives_syntax = true;
2132 CcTest::InitializeVM(); 2158 CcTest::InitializeVM();
2133 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return; 2159 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
2134 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; 2160 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
2135 v8::HandleScope scope(CcTest::isolate()); 2161 v8::HandleScope scope(CcTest::isolate());
2136 2162
2137 AlwaysAllocateScope always_allocate; 2163 AlwaysAllocateScope always_allocate;
2138 v8::Local<v8::Value> res = CompileRun( 2164 v8::Local<v8::Value> res = CompileRun(
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 } 3122 }
3097 // An entire block of handles has been filled. 3123 // An entire block of handles has been filled.
3098 // Next handle would require a new block. 3124 // Next handle would require a new block.
3099 ASSERT(data->next == data->limit); 3125 ASSERT(data->next == data->limit);
3100 3126
3101 DeferredHandleScope deferred(isolate); 3127 DeferredHandleScope deferred(isolate);
3102 DummyVisitor visitor; 3128 DummyVisitor visitor;
3103 isolate->handle_scope_implementer()->Iterate(&visitor); 3129 isolate->handle_scope_implementer()->Iterate(&visitor);
3104 deferred.Detach(); 3130 deferred.Detach();
3105 } 3131 }
OLDNEW
« src/hydrogen-instructions.h ('K') | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698