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 25330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25341 level_(level) {} | 25341 level_(level) {} |
25342 | 25342 |
25343 virtual void Run() { isolate_->MemoryPressureNotification(level_); } | 25343 virtual void Run() { isolate_->MemoryPressureNotification(level_); } |
25344 | 25344 |
25345 private: | 25345 private: |
25346 v8::Isolate* isolate_; | 25346 v8::Isolate* isolate_; |
25347 v8::MemoryPressureLevel level_; | 25347 v8::MemoryPressureLevel level_; |
25348 }; | 25348 }; |
25349 | 25349 |
25350 TEST(MemoryPressure) { | 25350 TEST(MemoryPressure) { |
| 25351 if (v8::internal::FLAG_optimize_for_size) return; |
25351 v8::Isolate* isolate = CcTest::isolate(); | 25352 v8::Isolate* isolate = CcTest::isolate(); |
25352 WeakCallCounter counter(1234); | 25353 WeakCallCounter counter(1234); |
25353 | 25354 |
25354 // Check that critical memory pressure notification sets GC interrupt. | 25355 // Check that critical memory pressure notification sets GC interrupt. |
25355 auto garbage = CreateGarbageWithWeakCallCounter(isolate, &counter); | 25356 auto garbage = CreateGarbageWithWeakCallCounter(isolate, &counter); |
25356 CHECK(!v8::Locker::IsLocked(isolate)); | 25357 CHECK(!v8::Locker::IsLocked(isolate)); |
25357 { | 25358 { |
25358 v8::Locker locker(isolate); | 25359 v8::Locker locker(isolate); |
25359 v8::HandleScope scope(isolate); | 25360 v8::HandleScope scope(isolate); |
25360 LocalContext env; | 25361 LocalContext env; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25505 | 25506 |
25506 // Put the function into context1 and call it. Since the access check | 25507 // Put the function into context1 and call it. Since the access check |
25507 // callback always returns true, the call succeeds even though the tokens | 25508 // callback always returns true, the call succeeds even though the tokens |
25508 // are different. | 25509 // are different. |
25509 context1->Enter(); | 25510 context1->Enter(); |
25510 context1->Global()->Set(context1, v8_str("fun"), fun).FromJust(); | 25511 context1->Global()->Set(context1, v8_str("fun"), fun).FromJust(); |
25511 v8::Local<v8::Value> x_value = CompileRun("fun('x')"); | 25512 v8::Local<v8::Value> x_value = CompileRun("fun('x')"); |
25512 CHECK_EQ(42, x_value->Int32Value(context1).FromJust()); | 25513 CHECK_EQ(42, x_value->Int32Value(context1).FromJust()); |
25513 context1->Exit(); | 25514 context1->Exit(); |
25514 } | 25515 } |
OLD | NEW |