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

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

Issue 12880017: Build fast literals in hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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
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 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 "%OptimizeFunctionOnNextCall(f);" 2072 "%OptimizeFunctionOnNextCall(f);"
2073 "f();"); 2073 "f();");
2074 2074
2075 Handle<JSObject> o = 2075 Handle<JSObject> o =
2076 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); 2076 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
2077 2077
2078 CHECK(HEAP->InOldPointerSpace(o->elements())); 2078 CHECK(HEAP->InOldPointerSpace(o->elements()));
2079 } 2079 }
2080 2080
2081 2081
2082 TEST(OptimizedPretenuringSimpleArrayLiterals) {
2083 i::FLAG_allow_natives_syntax = true;
2084 i::FLAG_pretenure_literals = false;
2085 InitializeVM();
2086 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
2087 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
2088 v8::HandleScope scope(env->GetIsolate());
2089
2090 AlwaysAllocateScope always_allocate;
2091 v8::Local<v8::Value> res = CompileRun(
2092 "function f() {"
2093 " return [1, 2, 3];"
2094 "};"
2095 "f(); f(); f();"
2096 "%OptimizeFunctionOnNextCall(f);"
2097 "f();");
2098
2099 Handle<JSObject> o =
2100 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
2101
2102 CHECK(HEAP->InNewSpace(*o));
2103 }
2104
2105
2082 // Test regular array literals allocation. 2106 // Test regular array literals allocation.
2083 TEST(OptimizedAllocationArrayLiterals) { 2107 TEST(OptimizedAllocationArrayLiterals) {
2084 i::FLAG_allow_natives_syntax = true; 2108 i::FLAG_allow_natives_syntax = true;
2085 InitializeVM(); 2109 InitializeVM();
2086 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return; 2110 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
2087 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; 2111 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
2088 v8::HandleScope scope(env->GetIsolate()); 2112 v8::HandleScope scope(env->GetIsolate());
2089 2113
2090 AlwaysAllocateScope always_allocate; 2114 AlwaysAllocateScope always_allocate;
2091 v8::Local<v8::Value> res = CompileRun( 2115 v8::Local<v8::Value> res = CompileRun(
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
3042 } 3066 }
3043 // An entire block of handles has been filled. 3067 // An entire block of handles has been filled.
3044 // Next handle would require a new block. 3068 // Next handle would require a new block.
3045 ASSERT(data->next == data->limit); 3069 ASSERT(data->next == data->limit);
3046 3070
3047 DeferredHandleScope deferred(isolate); 3071 DeferredHandleScope deferred(isolate);
3048 DummyVisitor visitor; 3072 DummyVisitor visitor;
3049 isolate->handle_scope_implementer()->Iterate(&visitor); 3073 isolate->handle_scope_implementer()->Iterate(&visitor);
3050 deferred.Detach(); 3074 deferred.Detach();
3051 } 3075 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698