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 3895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3906 v8::Handle<v8::Value> result = CompileRun( | 3906 v8::Handle<v8::Value> result = CompileRun( |
3907 "%SetFlags('--gc-interval=1');" | 3907 "%SetFlags('--gc-interval=1');" |
3908 "var a = [];" | 3908 "var a = [];" |
3909 "a.__proto__ = [];" | 3909 "a.__proto__ = [];" |
3910 "a.unshift(1)"); | 3910 "a.unshift(1)"); |
3911 | 3911 |
3912 CHECK(result->IsNumber()); | 3912 CHECK(result->IsNumber()); |
3913 } | 3913 } |
3914 | 3914 |
3915 #endif // DEBUG | 3915 #endif // DEBUG |
| 3916 |
| 3917 |
| 3918 static void InterruptCallback357137(v8::Isolate* isolate, void* data) { } |
| 3919 |
| 3920 |
| 3921 static void RequestInterrupt(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 3922 CcTest::isolate()->RequestInterrupt(&InterruptCallback357137, NULL); |
| 3923 } |
| 3924 |
| 3925 |
| 3926 TEST(Regress357137) { |
| 3927 CcTest::InitializeVM(); |
| 3928 v8::Isolate* isolate = CcTest::isolate(); |
| 3929 v8::HandleScope hscope(isolate); |
| 3930 v8::Handle<v8::ObjectTemplate> global =v8::ObjectTemplate::New(isolate); |
| 3931 global->Set(v8::String::NewFromUtf8(isolate, "interrupt"), |
| 3932 v8::FunctionTemplate::New(isolate, RequestInterrupt)); |
| 3933 v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global); |
| 3934 ASSERT(!context.IsEmpty()); |
| 3935 v8::Context::Scope cscope(context); |
| 3936 |
| 3937 v8::Local<v8::Value> result = CompileRun( |
| 3938 "var locals = '';" |
| 3939 "for (var i = 0; i < 512; i++) locals += 'var v' + i + '= 42;';" |
| 3940 "eval('function f() {' + locals + 'return function() { return v0; }; }');" |
| 3941 "interrupt();" // This triggers a fake stack overflow in f. |
| 3942 "f()()"); |
| 3943 CHECK_EQ(42.0, result->ToNumber()->Value()); |
| 3944 } |
OLD | NEW |