Chromium Code Reviews| 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 3872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3883 v8::Handle<v8::Object> global = CcTest::global(); | 3883 v8::Handle<v8::Object> global = CcTest::global(); |
| 3884 v8::Handle<v8::Function> g = | 3884 v8::Handle<v8::Function> g = |
| 3885 v8::Handle<v8::Function>::Cast(global->Get(v8_str("crash"))); | 3885 v8::Handle<v8::Function>::Cast(global->Get(v8_str("crash"))); |
| 3886 v8::Handle<v8::Value> args1[] = { v8_num(1) }; | 3886 v8::Handle<v8::Value> args1[] = { v8_num(1) }; |
| 3887 heap->DisableInlineAllocation(); | 3887 heap->DisableInlineAllocation(); |
| 3888 heap->set_allocation_timeout(1); | 3888 heap->set_allocation_timeout(1); |
| 3889 g->Call(global, 1, args1); | 3889 g->Call(global, 1, args1); |
| 3890 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); | 3890 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 3891 } | 3891 } |
| 3892 #endif | 3892 #endif |
| 3893 | |
| 3894 | |
| 3895 void OnFatalErrorExpectOOM(const char* location, const char* message) { | |
| 3896 // Exit with 0 if the location matches our expectation. | |
| 3897 exit(strcmp(location, "CALL_AND_RETRY_LAST")); | |
| 3898 } | |
| 3899 | |
| 3900 | |
| 3901 TEST(CEntryStubOOM) { | |
| 3902 i::FLAG_allow_natives_syntax = true; | |
| 3903 CcTest::InitializeVM(); | |
| 3904 v8::HandleScope scope(CcTest::isolate()); | |
| 3905 v8::V8::SetFatalErrorHandler(OnFatalErrorExpectOOM); | |
| 3906 | |
| 3907 CompileRun( | |
| 3908 "%SetFlags('--gc-interval=1');" | |
| 3909 "var a = [];" | |
| 3910 "a.__proto__ = [];" | |
| 3911 "a.unshift(1)"); | |
| 3912 | |
| 3913 // We should have ran into an out of memory. | |
|
Jakob Kummerow
2014/03/27 09:05:21
nit: s/ran/run/
Yang
2014/03/27 09:26:36
Done.
| |
| 3914 UNREACHABLE(); | |
|
Jakob Kummerow
2014/03/27 09:05:21
Use CHECK(false) here so it does something in Rele
Yang
2014/03/27 09:26:36
Obsolete now that we moved the entire test to debu
| |
| 3915 } | |
| OLD | NEW |