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 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2841 { | 2841 { |
2842 LocalContext env; | 2842 LocalContext env; |
2843 CompileRun("function fun() {};"); | 2843 CompileRun("function fun() {};"); |
2844 fun2 = env->Global()->Get(v8_str("fun")); | 2844 fun2 = env->Global()->Get(v8_str("fun")); |
2845 } | 2845 } |
2846 | 2846 |
2847 // Prepare function f that contains type feedback for closures | 2847 // Prepare function f that contains type feedback for closures |
2848 // originating from two different native contexts. | 2848 // originating from two different native contexts. |
2849 CcTest::global()->Set(v8_str("fun1"), fun1); | 2849 CcTest::global()->Set(v8_str("fun1"), fun1); |
2850 CcTest::global()->Set(v8_str("fun2"), fun2); | 2850 CcTest::global()->Set(v8_str("fun2"), fun2); |
2851 CompileRun("function f(a, b) { a(); b(); }" | 2851 CompileRun("function f(a, b) { a(); b(); } f(fun1, fun2);"); |
2852 "f(fun1, fun2);" // Run twice to skip premonomorphic state. | |
2853 "f(fun1, fun2)"); | |
2854 | 2852 |
2855 Handle<JSFunction> f = | 2853 Handle<JSFunction> f = |
2856 v8::Utils::OpenHandle( | 2854 v8::Utils::OpenHandle( |
2857 *v8::Handle<v8::Function>::Cast( | 2855 *v8::Handle<v8::Function>::Cast( |
2858 CcTest::global()->Get(v8_str("f")))); | 2856 CcTest::global()->Get(v8_str("f")))); |
2859 | 2857 |
2860 Handle<FixedArray> feedback_vector(TypeFeedbackInfo::cast( | 2858 Handle<FixedArray> feedback_vector(TypeFeedbackInfo::cast( |
2861 f->shared()->code()->type_feedback_info())->feedback_vector()); | 2859 f->shared()->code()->type_feedback_info())->feedback_vector()); |
2862 | 2860 |
2863 CHECK_EQ(2, feedback_vector->length()); | 2861 CHECK_EQ(2, feedback_vector->length()); |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3683 code = scope.CloseAndEscape(Handle<Code>(bar->code())); | 3681 code = scope.CloseAndEscape(Handle<Code>(bar->code())); |
3684 } | 3682 } |
3685 | 3683 |
3686 // Now make sure that a gc should get rid of the function | 3684 // Now make sure that a gc should get rid of the function |
3687 for (int i = 0; i < 4; i++) { | 3685 for (int i = 0; i < 4; i++) { |
3688 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); | 3686 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
3689 } | 3687 } |
3690 | 3688 |
3691 ASSERT(code->marked_for_deoptimization()); | 3689 ASSERT(code->marked_for_deoptimization()); |
3692 } | 3690 } |
OLD | NEW |