Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: src/frames.cc

Issue 256113003: Fix assertion when collecting stack trace from debug break. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix for the test Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/cctest/test-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 int i = jsframe_count; 983 int i = jsframe_count;
984 while (i > 0) { 984 while (i > 0) {
985 opcode = static_cast<Translation::Opcode>(it.Next()); 985 opcode = static_cast<Translation::Opcode>(it.Next());
986 if (opcode == Translation::JS_FRAME) { 986 if (opcode == Translation::JS_FRAME) {
987 i--; 987 i--;
988 BailoutId ast_id = BailoutId(it.Next()); 988 BailoutId ast_id = BailoutId(it.Next());
989 JSFunction* function = LiteralAt(literal_array, it.Next()); 989 JSFunction* function = LiteralAt(literal_array, it.Next());
990 it.Next(); // Skip height. 990 it.Next(); // Skip height.
991 991
992 // The translation commands are ordered and the receiver is always 992 // The translation commands are ordered and the receiver is always
993 // at the first position. Since we are always at a call when we need 993 // at the first position.
994 // to construct a stack trace, the receiver is always in a stack slot. 994 // If we are at a call, the receiver is always in a stack slot.
995 // Otherwise we are not guaranteed to get the receiver value.
995 opcode = static_cast<Translation::Opcode>(it.Next()); 996 opcode = static_cast<Translation::Opcode>(it.Next());
996 ASSERT(opcode == Translation::STACK_SLOT ||
997 opcode == Translation::LITERAL ||
998 opcode == Translation::CAPTURED_OBJECT ||
999 opcode == Translation::DUPLICATED_OBJECT);
1000 int index = it.Next(); 997 int index = it.Next();
1001 998
1002 // Get the correct receiver in the optimized frame. 999 // Get the correct receiver in the optimized frame.
1003 Object* receiver = NULL; 1000 Object* receiver = NULL;
1004 if (opcode == Translation::LITERAL) { 1001 if (opcode == Translation::LITERAL) {
1005 receiver = data->LiteralArray()->get(index); 1002 receiver = data->LiteralArray()->get(index);
1006 } else if (opcode == Translation::STACK_SLOT) { 1003 } else if (opcode == Translation::STACK_SLOT) {
1007 // Positive index means the value is spilled to the locals 1004 // Positive index means the value is spilled to the locals
1008 // area. Negative means it is stored in the incoming parameter 1005 // area. Negative means it is stored in the incoming parameter
1009 // area. 1006 // area.
1010 if (index >= 0) { 1007 if (index >= 0) {
1011 receiver = GetExpression(index); 1008 receiver = GetExpression(index);
1012 } else { 1009 } else {
1013 // Index -1 overlaps with last parameter, -n with the first parameter, 1010 // Index -1 overlaps with last parameter, -n with the first parameter,
1014 // (-n - 1) with the receiver with n being the number of parameters 1011 // (-n - 1) with the receiver with n being the number of parameters
1015 // of the outermost, optimized frame. 1012 // of the outermost, optimized frame.
1016 int parameter_count = ComputeParametersCount(); 1013 int parameter_count = ComputeParametersCount();
1017 int parameter_index = index + parameter_count; 1014 int parameter_index = index + parameter_count;
1018 receiver = (parameter_index == -1) 1015 receiver = (parameter_index == -1)
1019 ? this->receiver() 1016 ? this->receiver()
1020 : this->GetParameter(parameter_index); 1017 : this->GetParameter(parameter_index);
1021 } 1018 }
1022 } else { 1019 } else {
1020 // The receiver is not in a stack slot nor in a literal. We give up.
1023 // TODO(3029): Materializing a captured object (or duplicated 1021 // TODO(3029): Materializing a captured object (or duplicated
1024 // object) is hard, we return undefined for now. This breaks the 1022 // object) is hard, we return undefined for now. This breaks the
1025 // produced stack trace, as constructor frames aren't marked as 1023 // produced stack trace, as constructor frames aren't marked as
1026 // such anymore. 1024 // such anymore.
1027 receiver = isolate()->heap()->undefined_value(); 1025 receiver = isolate()->heap()->undefined_value();
1028 } 1026 }
1029 1027
1030 Code* code = function->shared()->code(); 1028 Code* code = function->shared()->code();
1031 DeoptimizationOutputData* output_data = 1029 DeoptimizationOutputData* output_data =
1032 DeoptimizationOutputData::cast(code->deoptimization_data()); 1030 DeoptimizationOutputData::cast(code->deoptimization_data());
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 ZoneList<StackFrame*> list(10, zone); 1639 ZoneList<StackFrame*> list(10, zone);
1642 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1640 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1643 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1641 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1644 list.Add(frame, zone); 1642 list.Add(frame, zone);
1645 } 1643 }
1646 return list.ToVector(); 1644 return list.ToVector();
1647 } 1645 }
1648 1646
1649 1647
1650 } } // namespace v8::internal 1648 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698