OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/disasm.h" | 10 #include "src/disasm.h" |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 SharedFunctionInfo* shared) { | 692 SharedFunctionInfo* shared) { |
693 // TODO(kasperl): For now, we do a simple linear search for the PC | 693 // TODO(kasperl): For now, we do a simple linear search for the PC |
694 // offset associated with the given node id. This should probably be | 694 // offset associated with the given node id. This should probably be |
695 // changed to a binary search. | 695 // changed to a binary search. |
696 int length = data->DeoptPoints(); | 696 int length = data->DeoptPoints(); |
697 for (int i = 0; i < length; i++) { | 697 for (int i = 0; i < length; i++) { |
698 if (data->AstId(i) == id) { | 698 if (data->AstId(i) == id) { |
699 return data->PcAndState(i)->value(); | 699 return data->PcAndState(i)->value(); |
700 } | 700 } |
701 } | 701 } |
702 PrintF(stderr, "[couldn't find pc offset for node=%d]\n", id.ToInt()); | 702 OFStream os(stderr); |
703 PrintF(stderr, "[method: %s]\n", shared->DebugName()->ToCString().get()); | 703 os << "[couldn't find pc offset for node=" << id.ToInt() << "]\n" |
704 // Print the source code if available. | 704 << "[method: " << shared->DebugName()->ToCString().get() << "]\n" |
705 HeapStringAllocator string_allocator; | 705 << "[source:\n" << SourceCodeOf(shared) << "\n]" << endl; |
706 StringStream stream(&string_allocator); | |
707 shared->SourceCodePrint(&stream, -1); | |
708 PrintF(stderr, "[source:\n%s\n]", stream.ToCString().get()); | |
709 | 706 |
710 FATAL("unable to find pc offset during deoptimization"); | 707 FATAL("unable to find pc offset during deoptimization"); |
711 return -1; | 708 return -1; |
712 } | 709 } |
713 | 710 |
714 | 711 |
715 int Deoptimizer::GetDeoptimizedCodeCount(Isolate* isolate) { | 712 int Deoptimizer::GetDeoptimizedCodeCount(Isolate* isolate) { |
716 int length = 0; | 713 int length = 0; |
717 // Count all entries in the deoptimizing code list of every context. | 714 // Count all entries in the deoptimizing code list of every context. |
718 Object* context = isolate->heap()->native_contexts_list(); | 715 Object* context = isolate->heap()->native_contexts_list(); |
(...skipping 2869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3588 } | 3585 } |
3589 | 3586 |
3590 | 3587 |
3591 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3588 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
3592 v->VisitPointer(BitCast<Object**>(&function_)); | 3589 v->VisitPointer(BitCast<Object**>(&function_)); |
3593 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3590 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
3594 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3591 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
3595 } | 3592 } |
3596 | 3593 |
3597 } } // namespace v8::internal | 3594 } } // namespace v8::internal |
OLD | NEW |