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 17502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17513 "outer()\n%s"; | 17513 "outer()\n%s"; |
17514 | 17514 |
17515 i::ScopedVector<char> code(1024); | 17515 i::ScopedVector<char> code(1024); |
17516 i::OS::SNPrintF(code, source, "//# sourceURL=source_url"); | 17516 i::OS::SNPrintF(code, source, "//# sourceURL=source_url"); |
17517 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); | 17517 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); |
17518 i::OS::SNPrintF(code, source, "//@ sourceURL=source_url"); | 17518 i::OS::SNPrintF(code, source, "//@ sourceURL=source_url"); |
17519 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); | 17519 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); |
17520 } | 17520 } |
17521 | 17521 |
17522 | 17522 |
| 17523 TEST(DynamicWithSourceURLInStackTraceString) { |
| 17524 LocalContext context; |
| 17525 v8::HandleScope scope(context->GetIsolate()); |
| 17526 |
| 17527 const char *source = |
| 17528 "function outer() {\n" |
| 17529 " function foo() {\n" |
| 17530 " FAIL.FAIL;\n" |
| 17531 " }\n" |
| 17532 " foo();\n" |
| 17533 "}\n" |
| 17534 "outer()\n%s"; |
| 17535 |
| 17536 i::ScopedVector<char> code(1024); |
| 17537 i::OS::SNPrintF(code, source, "//# sourceURL=source_url"); |
| 17538 v8::TryCatch try_catch; |
| 17539 CompileRunWithOrigin(code.start(), "", 0, 0); |
| 17540 CHECK(try_catch.HasCaught()); |
| 17541 v8::String::Utf8Value stack(try_catch.StackTrace()); |
| 17542 CHECK(strstr(*stack, "at foo (source_url:3:5)") != NULL); |
| 17543 } |
| 17544 |
| 17545 |
17523 static void CreateGarbageInOldSpace() { | 17546 static void CreateGarbageInOldSpace() { |
17524 i::Factory* factory = CcTest::i_isolate()->factory(); | 17547 i::Factory* factory = CcTest::i_isolate()->factory(); |
17525 v8::HandleScope scope(CcTest::isolate()); | 17548 v8::HandleScope scope(CcTest::isolate()); |
17526 i::AlwaysAllocateScope always_allocate; | 17549 i::AlwaysAllocateScope always_allocate; |
17527 for (int i = 0; i < 1000; i++) { | 17550 for (int i = 0; i < 1000; i++) { |
17528 factory->NewFixedArray(1000, i::TENURED); | 17551 factory->NewFixedArray(1000, i::TENURED); |
17529 } | 17552 } |
17530 } | 17553 } |
17531 | 17554 |
17532 | 17555 |
(...skipping 4425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21958 | 21981 |
21959 | 21982 |
21960 TEST(TestFunctionCallOptimization) { | 21983 TEST(TestFunctionCallOptimization) { |
21961 i::FLAG_allow_natives_syntax = true; | 21984 i::FLAG_allow_natives_syntax = true; |
21962 ApiCallOptimizationChecker checker; | 21985 ApiCallOptimizationChecker checker; |
21963 checker.Run(true, true); | 21986 checker.Run(true, true); |
21964 checker.Run(false, true); | 21987 checker.Run(false, true); |
21965 checker.Run(true, false); | 21988 checker.Run(true, false); |
21966 checker.Run(false, false); | 21989 checker.Run(false, false); |
21967 } | 21990 } |
OLD | NEW |