| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 12615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12626 | 12626 |
| 12627 int testGroup = args[0]->Int32Value(); | 12627 int testGroup = args[0]->Int32Value(); |
| 12628 if (testGroup == kOverviewTest) { | 12628 if (testGroup == kOverviewTest) { |
| 12629 v8::Handle<v8::StackTrace> stackTrace = | 12629 v8::Handle<v8::StackTrace> stackTrace = |
| 12630 v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kOverview); | 12630 v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kOverview); |
| 12631 CHECK_EQ(4, stackTrace->GetFrameCount()); | 12631 CHECK_EQ(4, stackTrace->GetFrameCount()); |
| 12632 checkStackFrame(origin, "bar", 2, 10, false, false, | 12632 checkStackFrame(origin, "bar", 2, 10, false, false, |
| 12633 stackTrace->GetFrame(0)); | 12633 stackTrace->GetFrame(0)); |
| 12634 checkStackFrame(origin, "foo", 6, 3, false, false, | 12634 checkStackFrame(origin, "foo", 6, 3, false, false, |
| 12635 stackTrace->GetFrame(1)); | 12635 stackTrace->GetFrame(1)); |
| 12636 checkStackFrame(NULL, "", 1, 1, false, false, | 12636 // This is the source string inside the eval which has the call to foo. |
| 12637 checkStackFrame(NULL, "", 1, 5, false, false, |
| 12637 stackTrace->GetFrame(2)); | 12638 stackTrace->GetFrame(2)); |
| 12638 // The last frame is an anonymous function that has the initial call. | 12639 // The last frame is an anonymous function which has the initial eval call. |
| 12639 checkStackFrame(origin, "", 8, 7, false, false, | 12640 checkStackFrame(origin, "", 8, 7, false, false, |
| 12640 stackTrace->GetFrame(3)); | 12641 stackTrace->GetFrame(3)); |
| 12641 | 12642 |
| 12642 CHECK(stackTrace->AsArray()->IsArray()); | 12643 CHECK(stackTrace->AsArray()->IsArray()); |
| 12643 } else if (testGroup == kDetailedTest) { | 12644 } else if (testGroup == kDetailedTest) { |
| 12644 v8::Handle<v8::StackTrace> stackTrace = | 12645 v8::Handle<v8::StackTrace> stackTrace = |
| 12645 v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed); | 12646 v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed); |
| 12646 CHECK_EQ(4, stackTrace->GetFrameCount()); | 12647 CHECK_EQ(4, stackTrace->GetFrameCount()); |
| 12647 checkStackFrame(origin, "bat", 4, 22, false, false, | 12648 checkStackFrame(origin, "bat", 4, 22, false, false, |
| 12648 stackTrace->GetFrame(0)); | 12649 stackTrace->GetFrame(0)); |
| 12649 checkStackFrame(origin, "baz", 8, 3, false, true, | 12650 checkStackFrame(origin, "baz", 8, 3, false, true, |
| 12650 stackTrace->GetFrame(1)); | 12651 stackTrace->GetFrame(1)); |
| 12651 #ifdef ENABLE_DEBUGGER_SUPPORT | 12652 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 12652 bool is_eval = true; | 12653 bool is_eval = true; |
| 12653 #else // ENABLE_DEBUGGER_SUPPORT | 12654 #else // ENABLE_DEBUGGER_SUPPORT |
| 12654 bool is_eval = false; | 12655 bool is_eval = false; |
| 12655 #endif // ENABLE_DEBUGGER_SUPPORT | 12656 #endif // ENABLE_DEBUGGER_SUPPORT |
| 12656 | 12657 |
| 12657 checkStackFrame(NULL, "", 1, 1, is_eval, false, | 12658 // This is the source string inside the eval which has the call to baz. |
| 12659 checkStackFrame(NULL, "", 1, 5, is_eval, false, |
| 12658 stackTrace->GetFrame(2)); | 12660 stackTrace->GetFrame(2)); |
| 12659 // The last frame is an anonymous function that has the initial call to foo. | 12661 // The last frame is an anonymous function which has the initial eval call. |
| 12660 checkStackFrame(origin, "", 10, 1, false, false, | 12662 checkStackFrame(origin, "", 10, 1, false, false, |
| 12661 stackTrace->GetFrame(3)); | 12663 stackTrace->GetFrame(3)); |
| 12662 | 12664 |
| 12663 CHECK(stackTrace->AsArray()->IsArray()); | 12665 CHECK(stackTrace->AsArray()->IsArray()); |
| 12664 } | 12666 } |
| 12665 return v8::Undefined(); | 12667 return v8::Undefined(); |
| 12666 } | 12668 } |
| 12667 | 12669 |
| 12668 | 12670 |
| 12669 // Tests the C++ StackTrace API. | 12671 // Tests the C++ StackTrace API. |
| (...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14677 } | 14679 } |
| 14678 | 14680 |
| 14679 i::Isolate::Current()->heap()->CollectAllGarbage(true); | 14681 i::Isolate::Current()->heap()->CollectAllGarbage(true); |
| 14680 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); | 14682 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); |
| 14681 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { | 14683 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { |
| 14682 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); | 14684 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); |
| 14683 CHECK_GT(elements, map_cache->NumberOfElements()); | 14685 CHECK_GT(elements, map_cache->NumberOfElements()); |
| 14684 } | 14686 } |
| 14685 } | 14687 } |
| 14686 } | 14688 } |
| OLD | NEW |