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 static void InterruptCallback357137(v8::Isolate* isolate, void* data) { } |
| 3896 |
| 3897 |
| 3898 static void RequestInterrupt(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 3899 CcTest::isolate()->RequestInterrupt(&InterruptCallback357137, NULL); |
| 3900 } |
| 3901 |
| 3902 |
| 3903 TEST(Regress357137) { |
| 3904 CcTest::InitializeVM(); |
| 3905 v8::Isolate* isolate = CcTest::isolate(); |
| 3906 v8::HandleScope hscope(isolate); |
| 3907 v8::Handle<v8::ObjectTemplate> global =v8::ObjectTemplate::New(isolate); |
| 3908 global->Set(v8::String::NewFromUtf8(isolate, "interrupt"), |
| 3909 v8::FunctionTemplate::New(isolate, RequestInterrupt)); |
| 3910 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); |
| 3911 ASSERT(!context.IsEmpty()); |
| 3912 v8::Context::Scope cscope(context); |
| 3913 |
| 3914 v8::Local<v8::Value> result = CompileRun( |
| 3915 "var locals = '';" |
| 3916 "for (var i = 0; i < 512; i++) locals += 'var v' + i + '= 42;';" |
| 3917 "eval('function f() {' + locals + 'return function() { return v0; }; }');" |
| 3918 "interrupt();" // This triggers a fake stack overflow in f. |
| 3919 "f()()"); |
| 3920 CHECK_EQ(42.0, result->ToNumber()->Value()); |
| 3921 } |
OLD | NEW |