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 17663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17674 i::ScopedVector<char> code(1024); | 17674 i::ScopedVector<char> code(1024); |
17675 i::OS::SNPrintF(code, source, "//# sourceURL=source_url"); | 17675 i::OS::SNPrintF(code, source, "//# sourceURL=source_url"); |
17676 v8::TryCatch try_catch; | 17676 v8::TryCatch try_catch; |
17677 CompileRunWithOrigin(code.start(), "", 0, 0); | 17677 CompileRunWithOrigin(code.start(), "", 0, 0); |
17678 CHECK(try_catch.HasCaught()); | 17678 CHECK(try_catch.HasCaught()); |
17679 v8::String::Utf8Value stack(try_catch.StackTrace()); | 17679 v8::String::Utf8Value stack(try_catch.StackTrace()); |
17680 CHECK(strstr(*stack, "at foo (source_url:3:5)") != NULL); | 17680 CHECK(strstr(*stack, "at foo (source_url:3:5)") != NULL); |
17681 } | 17681 } |
17682 | 17682 |
17683 | 17683 |
17684 TEST(EvalWithSourceURLInStackTraceString) { | |
17685 LocalContext context; | |
17686 v8::HandleScope scope(context->GetIsolate()); | |
17687 | |
17688 const char *source = | |
17689 "function outer() {\n" | |
17690 " var scriptContents = \"function foo() { FAIL.FAIL; } " | |
17691 "//# sourceURL=foo2.js\";\n" | |
vsevik
2014/04/30 10:18:40
could you please break this string (e.g.
"//# sour
kozyatinskiy1
2014/04/30 15:46:43
Done.
| |
17692 " eval(scriptContents); \n" | |
17693 " foo(); }\n" | |
17694 "outer();\n"; | |
17695 | |
17696 v8::TryCatch try_catch; | |
17697 CompileRun(source); | |
17698 CHECK(try_catch.HasCaught()); | |
17699 v8::String::Utf8Value stack(try_catch.StackTrace()); | |
vsevik
2014/04/30 10:18:40
StackTrace does not use your new method, so this t
| |
17700 CHECK(strstr(*stack, "at foo (foo2.js:1:18)") != NULL); | |
17701 } | |
17702 | |
17703 | |
17704 TEST(RecursionWithSourceURLInStackTraceString) { | |
17705 LocalContext context; | |
17706 v8::HandleScope scope(context->GetIsolate()); | |
17707 | |
17708 const char *source = | |
17709 "function outer() {\n" | |
17710 " var scriptContents = \"function boo(){ boo(); }" | |
17711 " function foo() { boo(); } //# sourceURL=foo2.js\";\n" | |
17712 " eval(scriptContents);\n" | |
17713 " foo(); }\n" | |
17714 "outer();\n"; | |
17715 | |
17716 v8::TryCatch try_catch; | |
17717 CompileRun(source); | |
17718 CHECK(try_catch.HasCaught()); | |
17719 v8::String::Utf8Value stack(try_catch.StackTrace()); | |
vsevik
2014/04/30 10:18:40
ditto
kozyatinskiy1
2014/04/30 15:46:43
Done.
| |
17720 CHECK(strstr(*stack, "at boo (foo2.js:1:13)") != NULL); | |
17721 } | |
17722 | |
17723 | |
17684 static void CreateGarbageInOldSpace() { | 17724 static void CreateGarbageInOldSpace() { |
17685 i::Factory* factory = CcTest::i_isolate()->factory(); | 17725 i::Factory* factory = CcTest::i_isolate()->factory(); |
17686 v8::HandleScope scope(CcTest::isolate()); | 17726 v8::HandleScope scope(CcTest::isolate()); |
17687 i::AlwaysAllocateScope always_allocate(CcTest::i_isolate()); | 17727 i::AlwaysAllocateScope always_allocate(CcTest::i_isolate()); |
17688 for (int i = 0; i < 1000; i++) { | 17728 for (int i = 0; i < 1000; i++) { |
17689 factory->NewFixedArray(1000, i::TENURED); | 17729 factory->NewFixedArray(1000, i::TENURED); |
17690 } | 17730 } |
17691 } | 17731 } |
17692 | 17732 |
17693 | 17733 |
(...skipping 4792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
22486 v8::internal::FLAG_stack_size = 150; | 22526 v8::internal::FLAG_stack_size = 150; |
22487 LocalContext current; | 22527 LocalContext current; |
22488 v8::Isolate* isolate = current->GetIsolate(); | 22528 v8::Isolate* isolate = current->GetIsolate(); |
22489 v8::HandleScope scope(isolate); | 22529 v8::HandleScope scope(isolate); |
22490 V8::SetCaptureStackTraceForUncaughtExceptions( | 22530 V8::SetCaptureStackTraceForUncaughtExceptions( |
22491 true, 10, v8::StackTrace::kDetailed); | 22531 true, 10, v8::StackTrace::kDetailed); |
22492 v8::TryCatch try_catch; | 22532 v8::TryCatch try_catch; |
22493 CompileRun("(function f(x) { f(x+1); })(0)"); | 22533 CompileRun("(function f(x) { f(x+1); })(0)"); |
22494 CHECK(try_catch.HasCaught()); | 22534 CHECK(try_catch.HasCaught()); |
22495 } | 22535 } |
OLD | NEW |