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

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

Issue 1363883002: Version 4.6.85.21 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.6
Patch Set: Created 5 years, 2 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
« no previous file with comments | « src/x87/builtins-x87.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 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after
3865 } 3865 }
3866 return NULL; 3866 return NULL;
3867 } 3867 }
3868 3868
3869 3869
3870 static void CheckVectorIC(Handle<JSFunction> f, int ic_slot_index, 3870 static void CheckVectorIC(Handle<JSFunction> f, int ic_slot_index,
3871 InlineCacheState desired_state) { 3871 InlineCacheState desired_state) {
3872 Handle<TypeFeedbackVector> vector = 3872 Handle<TypeFeedbackVector> vector =
3873 Handle<TypeFeedbackVector>(f->shared()->feedback_vector()); 3873 Handle<TypeFeedbackVector>(f->shared()->feedback_vector());
3874 FeedbackVectorICSlot slot(ic_slot_index); 3874 FeedbackVectorICSlot slot(ic_slot_index);
3875 LoadICNexus nexus(vector, slot); 3875 if (vector->GetKind(slot) == Code::LOAD_IC) {
3876 CHECK(nexus.StateFromFeedback() == desired_state); 3876 LoadICNexus nexus(vector, slot);
3877 CHECK(nexus.StateFromFeedback() == desired_state);
3878 } else {
3879 CHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC);
3880 KeyedLoadICNexus nexus(vector, slot);
3881 CHECK(nexus.StateFromFeedback() == desired_state);
3882 }
3877 } 3883 }
3878 3884
3879 3885
3880 static void CheckVectorICCleared(Handle<JSFunction> f, int ic_slot_index) { 3886 static void CheckVectorICCleared(Handle<JSFunction> f, int ic_slot_index) {
3881 Handle<TypeFeedbackVector> vector = 3887 Handle<TypeFeedbackVector> vector =
3882 Handle<TypeFeedbackVector>(f->shared()->feedback_vector()); 3888 Handle<TypeFeedbackVector>(f->shared()->feedback_vector());
3883 FeedbackVectorICSlot slot(ic_slot_index); 3889 FeedbackVectorICSlot slot(ic_slot_index);
3884 LoadICNexus nexus(vector, slot); 3890 LoadICNexus nexus(vector, slot);
3885 CHECK(IC::IsCleared(&nexus)); 3891 CHECK(IC::IsCleared(&nexus));
3886 } 3892 }
3887 3893
3888 3894
3895 TEST(ICInBuiltInIsClearedAppropriately) {
3896 if (i::FLAG_always_opt) return;
3897 CcTest::InitializeVM();
3898 v8::HandleScope scope(CcTest::isolate());
3899
3900 Handle<JSFunction> apply;
3901 {
3902 LocalContext env;
3903 v8::Local<v8::Value> res = CompileRun("Function.apply");
3904 Handle<JSObject> maybe_apply =
3905 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
3906 apply = Handle<JSFunction>::cast(maybe_apply);
3907 TypeFeedbackVector* vector = apply->shared()->feedback_vector();
3908 CHECK(vector->ICSlots() == 1);
3909 CheckVectorIC(apply, 0, UNINITIALIZED);
3910 CompileRun(
3911 "function b(a1, a2, a3) { return a1 + a2 + a3; }"
3912 "function fun(bar) { bar.apply({}, [1, 2, 3]); };"
3913 "fun(b); fun(b)");
3914 CheckVectorIC(apply, 0, MONOMORPHIC);
3915 }
3916
3917 // Fire context dispose notification.
3918 CcTest::isolate()->ContextDisposedNotification();
3919 SimulateIncrementalMarking(CcTest::heap());
3920 CcTest::heap()->CollectAllGarbage();
3921
3922 // The IC in apply has been cleared, ready to learn again.
3923 CheckVectorIC(apply, 0, PREMONOMORPHIC);
3924 }
3925
3926
3889 TEST(IncrementalMarkingPreservesMonomorphicConstructor) { 3927 TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
3890 if (i::FLAG_always_opt) return; 3928 if (i::FLAG_always_opt) return;
3891 CcTest::InitializeVM(); 3929 CcTest::InitializeVM();
3892 v8::HandleScope scope(CcTest::isolate()); 3930 v8::HandleScope scope(CcTest::isolate());
3893 3931
3894 // Prepare function f that contains a monomorphic IC for object 3932 // Prepare function f that contains a monomorphic IC for object
3895 // originating from the same native context. 3933 // originating from the same native context.
3896 CompileRun( 3934 CompileRun(
3897 "function fun() { this.x = 1; };" 3935 "function fun() { this.x = 1; };"
3898 "function f(o) { return new o(); } f(fun); f(fun);"); 3936 "function f(o) { return new o(); } f(fun); f(fun);");
(...skipping 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after
6434 6472
6435 PrintF("Context size : %d bytes\n", measure.Size()); 6473 PrintF("Context size : %d bytes\n", measure.Size());
6436 PrintF("Context object count: %d\n", measure.Count()); 6474 PrintF("Context object count: %d\n", measure.Count());
6437 6475
6438 CHECK_LE(1000, measure.Count()); 6476 CHECK_LE(1000, measure.Count());
6439 CHECK_LE(50000, measure.Size()); 6477 CHECK_LE(50000, measure.Size());
6440 6478
6441 CHECK_LE(measure.Count(), count_upper_limit); 6479 CHECK_LE(measure.Count(), count_upper_limit);
6442 CHECK_LE(measure.Size(), size_upper_limit); 6480 CHECK_LE(measure.Size(), size_upper_limit);
6443 } 6481 }
6444
6445 } // namespace internal 6482 } // namespace internal
6446 } // namespace v8 6483 } // namespace v8
OLDNEW
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698