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 7081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7092 } | 7092 } |
7093 | 7093 |
7094 object_a.flag = false; | 7094 object_a.flag = false; |
7095 object_b.flag = false; | 7095 object_b.flag = false; |
7096 object_a.handle.SetWeak(&object_a, &DisposeAndSetFlag); | 7096 object_a.handle.SetWeak(&object_a, &DisposeAndSetFlag); |
7097 object_b.handle.SetWeak(&object_b, &DisposeAndSetFlag); | 7097 object_b.handle.SetWeak(&object_b, &DisposeAndSetFlag); |
7098 CHECK(!object_b.handle.IsIndependent()); | 7098 CHECK(!object_b.handle.IsIndependent()); |
7099 object_a.handle.MarkIndependent(); | 7099 object_a.handle.MarkIndependent(); |
7100 object_b.handle.MarkIndependent(); | 7100 object_b.handle.MarkIndependent(); |
7101 CHECK(object_b.handle.IsIndependent()); | 7101 CHECK(object_b.handle.IsIndependent()); |
7102 CcTest::heap()->PerformScavenge(); | 7102 CcTest::heap()->CollectGarbage(i::NEW_SPACE); |
7103 CHECK(object_a.flag); | 7103 CHECK(object_a.flag); |
7104 CHECK(object_b.flag); | 7104 CHECK(object_b.flag); |
7105 } | 7105 } |
7106 | 7106 |
7107 | 7107 |
7108 static void InvokeScavenge() { | 7108 static void InvokeScavenge() { |
7109 CcTest::heap()->PerformScavenge(); | 7109 CcTest::heap()->CollectGarbage(i::NEW_SPACE); |
7110 } | 7110 } |
7111 | 7111 |
7112 | 7112 |
7113 static void InvokeMarkSweep() { | 7113 static void InvokeMarkSweep() { |
7114 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); | 7114 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); |
7115 } | 7115 } |
7116 | 7116 |
7117 | 7117 |
7118 static void ForceScavenge( | 7118 static void ForceScavenge( |
7119 const v8::WeakCallbackData<v8::Object, FlagAndPersistent>& data) { | 7119 const v8::WeakCallbackData<v8::Object, FlagAndPersistent>& data) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7181 v8::HandleScope handle_scope(isolate); | 7181 v8::HandleScope handle_scope(isolate); |
7182 v8::Local<v8::Object> o = v8::Object::New(isolate); | 7182 v8::Local<v8::Object> o = v8::Object::New(isolate); |
7183 object.handle.Reset(isolate, o); | 7183 object.handle.Reset(isolate, o); |
7184 o->Set(v8_str("x"), v8::Integer::New(isolate, 1)); | 7184 o->Set(v8_str("x"), v8::Integer::New(isolate, 1)); |
7185 v8::Local<String> y_str = v8_str("y"); | 7185 v8::Local<String> y_str = v8_str("y"); |
7186 o->Set(y_str, y_str); | 7186 o->Set(y_str, y_str); |
7187 } | 7187 } |
7188 object.flag = false; | 7188 object.flag = false; |
7189 object.handle.SetWeak(&object, &RevivingCallback); | 7189 object.handle.SetWeak(&object, &RevivingCallback); |
7190 object.handle.MarkIndependent(); | 7190 object.handle.MarkIndependent(); |
7191 CcTest::heap()->PerformScavenge(); | 7191 CcTest::heap()->CollectGarbage(i::NEW_SPACE); |
7192 CHECK(object.flag); | 7192 CHECK(object.flag); |
7193 CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); | 7193 CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); |
7194 { | 7194 { |
7195 v8::HandleScope handle_scope(isolate); | 7195 v8::HandleScope handle_scope(isolate); |
7196 v8::Local<v8::Object> o = | 7196 v8::Local<v8::Object> o = |
7197 v8::Local<v8::Object>::New(isolate, object.handle); | 7197 v8::Local<v8::Object>::New(isolate, object.handle); |
7198 v8::Local<String> y_str = v8_str("y"); | 7198 v8::Local<String> y_str = v8_str("y"); |
7199 CHECK_EQ(v8::Integer::New(isolate, 1), o->Get(v8_str("x"))); | 7199 CHECK_EQ(v8::Integer::New(isolate, 1), o->Get(v8_str("x"))); |
7200 CHECK(o->Get(y_str)->Equals(y_str)); | 7200 CHECK(o->Get(y_str)->Equals(y_str)); |
7201 } | 7201 } |
(...skipping 10441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17643 finished = v8::V8::IdleNotification(kShortIdlePauseInMs); | 17643 finished = v8::V8::IdleNotification(kShortIdlePauseInMs); |
17644 } | 17644 } |
17645 intptr_t final_size = CcTest::heap()->SizeOfObjects(); | 17645 intptr_t final_size = CcTest::heap()->SizeOfObjects(); |
17646 CHECK_LT(final_size, initial_size + 1); | 17646 CHECK_LT(final_size, initial_size + 1); |
17647 } | 17647 } |
17648 | 17648 |
17649 | 17649 |
17650 TEST(Regress2333) { | 17650 TEST(Regress2333) { |
17651 LocalContext env; | 17651 LocalContext env; |
17652 for (int i = 0; i < 3; i++) { | 17652 for (int i = 0; i < 3; i++) { |
17653 CcTest::heap()->PerformScavenge(); | 17653 CcTest::heap()->CollectGarbage(i::NEW_SPACE); |
17654 } | 17654 } |
17655 } | 17655 } |
17656 | 17656 |
17657 static uint32_t* stack_limit; | 17657 static uint32_t* stack_limit; |
17658 | 17658 |
17659 static void GetStackLimitCallback( | 17659 static void GetStackLimitCallback( |
17660 const v8::FunctionCallbackInfo<v8::Value>& args) { | 17660 const v8::FunctionCallbackInfo<v8::Value>& args) { |
17661 stack_limit = reinterpret_cast<uint32_t*>( | 17661 stack_limit = reinterpret_cast<uint32_t*>( |
17662 CcTest::i_isolate()->stack_guard()->real_climit()); | 17662 CcTest::i_isolate()->stack_guard()->real_climit()); |
17663 } | 17663 } |
(...skipping 4445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22109 Local<Object> ApiCallOptimizationChecker::holder; | 22109 Local<Object> ApiCallOptimizationChecker::holder; |
22110 Local<Object> ApiCallOptimizationChecker::callee; | 22110 Local<Object> ApiCallOptimizationChecker::callee; |
22111 int ApiCallOptimizationChecker::count = 0; | 22111 int ApiCallOptimizationChecker::count = 0; |
22112 | 22112 |
22113 | 22113 |
22114 TEST(TestFunctionCallOptimization) { | 22114 TEST(TestFunctionCallOptimization) { |
22115 i::FLAG_allow_natives_syntax = true; | 22115 i::FLAG_allow_natives_syntax = true; |
22116 ApiCallOptimizationChecker checker; | 22116 ApiCallOptimizationChecker checker; |
22117 checker.RunAll(); | 22117 checker.RunAll(); |
22118 } | 22118 } |
OLD | NEW |