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 3656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3667 #endif // OBJECT_PRINT | 3667 #endif // OBJECT_PRINT |
3668 | 3668 |
3669 | 3669 |
3670 TEST(IncrementalMarkingPreservesMonomorphicCallIC) { | 3670 TEST(IncrementalMarkingPreservesMonomorphicCallIC) { |
3671 if (i::FLAG_always_opt) return; | 3671 if (i::FLAG_always_opt) return; |
3672 CcTest::InitializeVM(); | 3672 CcTest::InitializeVM(); |
3673 v8::HandleScope scope(CcTest::isolate()); | 3673 v8::HandleScope scope(CcTest::isolate()); |
3674 v8::Local<v8::Value> fun1, fun2; | 3674 v8::Local<v8::Value> fun1, fun2; |
3675 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); | 3675 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext(); |
3676 { | 3676 { |
3677 LocalContext env; | |
3678 CompileRun("function fun() {};"); | 3677 CompileRun("function fun() {};"); |
3679 fun1 = env->Global()->Get(env.local(), v8_str("fun")).ToLocalChecked(); | 3678 fun1 = CcTest::global()->Get(ctx, v8_str("fun")).ToLocalChecked(); |
3680 } | 3679 } |
3681 | 3680 |
3682 { | 3681 { |
3683 LocalContext env; | |
3684 CompileRun("function fun() {};"); | 3682 CompileRun("function fun() {};"); |
3685 fun2 = env->Global()->Get(env.local(), v8_str("fun")).ToLocalChecked(); | 3683 fun2 = CcTest::global()->Get(ctx, v8_str("fun")).ToLocalChecked(); |
3686 } | 3684 } |
3687 | 3685 |
3688 // Prepare function f that contains type feedback for closures | 3686 // Prepare function f that contains type feedback for the two closures. |
3689 // originating from two different native contexts. | |
3690 CHECK(CcTest::global()->Set(ctx, v8_str("fun1"), fun1).FromJust()); | 3687 CHECK(CcTest::global()->Set(ctx, v8_str("fun1"), fun1).FromJust()); |
3691 CHECK(CcTest::global()->Set(ctx, v8_str("fun2"), fun2).FromJust()); | 3688 CHECK(CcTest::global()->Set(ctx, v8_str("fun2"), fun2).FromJust()); |
3692 CompileRun("function f(a, b) { a(); b(); } f(fun1, fun2);"); | 3689 CompileRun("function f(a, b) { a(); b(); } f(fun1, fun2);"); |
3693 | 3690 |
3694 Handle<JSFunction> f = Handle<JSFunction>::cast( | 3691 Handle<JSFunction> f = Handle<JSFunction>::cast( |
3695 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( | 3692 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( |
3696 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); | 3693 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); |
3697 | 3694 |
3698 Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); | 3695 Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); |
3699 FeedbackVectorHelper feedback_helper(feedback_vector); | 3696 FeedbackVectorHelper feedback_helper(feedback_vector); |
(...skipping 2754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6454 isolate->IncrementJsCallsFromApiCounter(); | 6451 isolate->IncrementJsCallsFromApiCounter(); |
6455 isolate->IncrementJsCallsFromApiCounter(); | 6452 isolate->IncrementJsCallsFromApiCounter(); |
6456 isolate->IncrementJsCallsFromApiCounter(); | 6453 isolate->IncrementJsCallsFromApiCounter(); |
6457 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); | 6454 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); |
6458 CheckDoubleEquals(2, calls_per_ms); | 6455 CheckDoubleEquals(2, calls_per_ms); |
6459 } | 6456 } |
6460 | 6457 |
6461 | 6458 |
6462 } // namespace internal | 6459 } // namespace internal |
6463 } // namespace v8 | 6460 } // namespace v8 |
OLD | NEW |