| 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 3871 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3882 | 3882 | 
| 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 | 
|  | 3893 | 
|  | 3894 void OnFatalErrorExpectOOM(const char* location, const char* message) { | 
|  | 3895   // Exit with 0 if the location matches our expectation. | 
|  | 3896   exit(strcmp(location, "CALL_AND_RETRY_LAST")); | 
|  | 3897 } | 
|  | 3898 | 
|  | 3899 | 
|  | 3900 TEST(CEntryStubOOM) { | 
|  | 3901   i::FLAG_allow_natives_syntax = true; | 
|  | 3902   CcTest::InitializeVM(); | 
|  | 3903   v8::HandleScope scope(CcTest::isolate()); | 
|  | 3904   v8::V8::SetFatalErrorHandler(OnFatalErrorExpectOOM); | 
|  | 3905 | 
|  | 3906   v8::Handle<v8::Value> result = CompileRun( | 
|  | 3907       "%SetFlags('--gc-interval=1');" | 
|  | 3908       "var a = [];" | 
|  | 3909       "a.__proto__ = [];" | 
|  | 3910       "a.unshift(1)"); | 
|  | 3911 | 
|  | 3912   CHECK(result->IsNumber()); | 
|  | 3913 } | 
|  | 3914 | 
|  | 3915 #endif  // DEBUG | 
| OLD | NEW | 
|---|