OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 "// Empty first line\n" | 631 "// Empty first line\n" |
632 "function bar_at_the_second_line() {\n" | 632 "function bar_at_the_second_line() {\n" |
633 " foo_at_the_first_line();\n" | 633 " foo_at_the_first_line();\n" |
634 "}\n" | 634 "}\n" |
635 "bar_at_the_second_line();\n" | 635 "bar_at_the_second_line();\n" |
636 "function lazy_func_at_6th_line() {}"; | 636 "function lazy_func_at_6th_line() {}"; |
637 | 637 |
638 int GetFunctionLineNumber(LocalContext* env, const char* name) { | 638 int GetFunctionLineNumber(LocalContext* env, const char* name) { |
639 CpuProfiler* profiler = CcTest::i_isolate()->cpu_profiler(); | 639 CpuProfiler* profiler = CcTest::i_isolate()->cpu_profiler(); |
640 CodeMap* code_map = profiler->generator()->code_map(); | 640 CodeMap* code_map = profiler->generator()->code_map(); |
641 i::Handle<i::JSFunction> func = | 641 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast( |
642 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( | 642 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( |
643 (*(*env)) | 643 (*(*env)) |
644 ->Global() | 644 ->Global() |
645 ->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), | 645 ->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), |
646 v8_str(name)) | 646 v8_str(name)) |
647 .ToLocalChecked())); | 647 .ToLocalChecked()))); |
648 CodeEntry* func_entry = code_map->FindEntry(func->code()->address()); | 648 CodeEntry* func_entry = code_map->FindEntry(func->code()->address()); |
649 if (!func_entry) | 649 if (!func_entry) |
650 FATAL(name); | 650 FATAL(name); |
651 return func_entry->line_number(); | 651 return func_entry->line_number(); |
652 } | 652 } |
653 | 653 |
654 | 654 |
655 TEST(LineNumber) { | 655 TEST(LineNumber) { |
656 i::FLAG_use_inlining = false; | 656 i::FLAG_use_inlining = false; |
657 | 657 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 CHECK(const_cast<v8::CpuProfileNode*>(current)); | 717 CHECK(const_cast<v8::CpuProfileNode*>(current)); |
718 | 718 |
719 current = PickChild(current, "TryFinally"); | 719 current = PickChild(current, "TryFinally"); |
720 CHECK(const_cast<v8::CpuProfileNode*>(current)); | 720 CHECK(const_cast<v8::CpuProfileNode*>(current)); |
721 CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason())); | 721 CHECK(!strcmp("TryFinallyStatement", current->GetBailoutReason())); |
722 | 722 |
723 current = PickChild(current, "Debugger"); | 723 current = PickChild(current, "Debugger"); |
724 CHECK(const_cast<v8::CpuProfileNode*>(current)); | 724 CHECK(const_cast<v8::CpuProfileNode*>(current)); |
725 CHECK(!strcmp("DebuggerStatement", current->GetBailoutReason())); | 725 CHECK(!strcmp("DebuggerStatement", current->GetBailoutReason())); |
726 } | 726 } |
OLD | NEW |