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

Side by Side Diff: src/frames.cc

Issue 1186823003: Clean up JSConstructStub (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased Created 5 years, 6 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
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/ia32/builtins-ia32.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 // 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/frames.h" 5 #include "src/frames.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 } 1113 }
1114 1114
1115 1115
1116 void StackFrame::PrintIndex(StringStream* accumulator, 1116 void StackFrame::PrintIndex(StringStream* accumulator,
1117 PrintMode mode, 1117 PrintMode mode,
1118 int index) { 1118 int index) {
1119 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index); 1119 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index);
1120 } 1120 }
1121 1121
1122 1122
1123 namespace {
1124
1125
1126 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared,
1127 Code* code) {
1128 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) {
1129 std::ostringstream os;
1130 os << "--------- s o u r c e c o d e ---------\n"
1131 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length)
1132 << "\n-----------------------------------------\n";
1133 accumulator->Add(os.str().c_str());
1134 }
1135 }
1136
1137
1138 } // namespace
1139
1140
1123 void JavaScriptFrame::Print(StringStream* accumulator, 1141 void JavaScriptFrame::Print(StringStream* accumulator,
1124 PrintMode mode, 1142 PrintMode mode,
1125 int index) const { 1143 int index) const {
1126 DisallowHeapAllocation no_gc; 1144 DisallowHeapAllocation no_gc;
1127 Object* receiver = this->receiver(); 1145 Object* receiver = this->receiver();
1128 JSFunction* function = this->function(); 1146 JSFunction* function = this->function();
1129 1147
1130 accumulator->PrintSecurityTokenIfChanged(function); 1148 accumulator->PrintSecurityTokenIfChanged(function);
1131 PrintIndex(accumulator, mode, index); 1149 PrintIndex(accumulator, mode, index);
1132 Code* code = NULL; 1150 Code* code = NULL;
(...skipping 17 matching lines...) Expand all
1150 pc >= code->instruction_start() && pc < code->instruction_end()) { 1168 pc >= code->instruction_start() && pc < code->instruction_end()) {
1151 int source_pos = code->SourcePosition(pc); 1169 int source_pos = code->SourcePosition(pc);
1152 int line = script->GetLineNumber(source_pos) + 1; 1170 int line = script->GetLineNumber(source_pos) + 1;
1153 accumulator->Add(":%d", line); 1171 accumulator->Add(":%d", line);
1154 } else { 1172 } else {
1155 int function_start_pos = shared->start_position(); 1173 int function_start_pos = shared->start_position();
1156 int line = script->GetLineNumber(function_start_pos) + 1; 1174 int line = script->GetLineNumber(function_start_pos) + 1;
1157 accumulator->Add(":~%d", line); 1175 accumulator->Add(":~%d", line);
1158 } 1176 }
1159 1177
1160 accumulator->Add("] "); 1178 accumulator->Add("] [pc=%p] ", pc);
1161 } 1179 }
1162 1180
1163 accumulator->Add("(this=%o", receiver); 1181 accumulator->Add("(this=%o", receiver);
1164 1182
1165 // Print the parameters. 1183 // Print the parameters.
1166 int parameters_count = ComputeParametersCount(); 1184 int parameters_count = ComputeParametersCount();
1167 for (int i = 0; i < parameters_count; i++) { 1185 for (int i = 0; i < parameters_count; i++) {
1168 accumulator->Add(","); 1186 accumulator->Add(",");
1169 // If we have a name for the parameter we print it. Nameless 1187 // If we have a name for the parameter we print it. Nameless
1170 // parameters are either because we have more actual parameters 1188 // parameters are either because we have more actual parameters
1171 // than formal parameters or because we have no scope information. 1189 // than formal parameters or because we have no scope information.
1172 if (i < scope_info->ParameterCount()) { 1190 if (i < scope_info->ParameterCount()) {
1173 accumulator->PrintName(scope_info->ParameterName(i)); 1191 accumulator->PrintName(scope_info->ParameterName(i));
1174 accumulator->Add("="); 1192 accumulator->Add("=");
1175 } 1193 }
1176 accumulator->Add("%o", GetParameter(i)); 1194 accumulator->Add("%o", GetParameter(i));
1177 } 1195 }
1178 1196
1179 accumulator->Add(")"); 1197 accumulator->Add(")");
1180 if (mode == OVERVIEW) { 1198 if (mode == OVERVIEW) {
1181 accumulator->Add("\n"); 1199 accumulator->Add("\n");
1182 return; 1200 return;
1183 } 1201 }
1184 if (is_optimized()) { 1202 if (is_optimized()) {
1185 accumulator->Add(" {\n// optimized frame\n}\n"); 1203 accumulator->Add(" {\n// optimized frame\n");
1204 PrintFunctionSource(accumulator, shared, code);
1205 accumulator->Add("}\n");
1186 return; 1206 return;
1187 } 1207 }
1188 accumulator->Add(" {\n"); 1208 accumulator->Add(" {\n");
1189 1209
1190 // Compute the number of locals and expression stack elements. 1210 // Compute the number of locals and expression stack elements.
1191 int stack_locals_count = scope_info->StackLocalCount(); 1211 int stack_locals_count = scope_info->StackLocalCount();
1192 int heap_locals_count = scope_info->ContextLocalCount(); 1212 int heap_locals_count = scope_info->ContextLocalCount();
1193 int expressions_count = ComputeExpressionsCount(); 1213 int expressions_count = ComputeExpressionsCount();
1194 1214
1195 // Print stack-allocated local variables. 1215 // Print stack-allocated local variables.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 1262
1243 // Print the expression stack. 1263 // Print the expression stack.
1244 int expressions_start = stack_locals_count; 1264 int expressions_start = stack_locals_count;
1245 if (expressions_start < expressions_count) { 1265 if (expressions_start < expressions_count) {
1246 accumulator->Add(" // expression stack (top to bottom)\n"); 1266 accumulator->Add(" // expression stack (top to bottom)\n");
1247 } 1267 }
1248 for (int i = expressions_count - 1; i >= expressions_start; i--) { 1268 for (int i = expressions_count - 1; i >= expressions_start; i--) {
1249 accumulator->Add(" [%02d] : %o\n", i, GetExpression(i)); 1269 accumulator->Add(" [%02d] : %o\n", i, GetExpression(i));
1250 } 1270 }
1251 1271
1252 // Print details about the function. 1272 PrintFunctionSource(accumulator, shared, code);
1253 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) {
1254 std::ostringstream os;
1255 SharedFunctionInfo* shared = function->shared();
1256 os << "--------- s o u r c e c o d e ---------\n"
1257 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length)
1258 << "\n-----------------------------------------\n";
1259 accumulator->Add(os.str().c_str());
1260 }
1261 1273
1262 accumulator->Add("}\n\n"); 1274 accumulator->Add("}\n\n");
1263 } 1275 }
1264 1276
1265 1277
1266 void ArgumentsAdaptorFrame::Print(StringStream* accumulator, 1278 void ArgumentsAdaptorFrame::Print(StringStream* accumulator,
1267 PrintMode mode, 1279 PrintMode mode,
1268 int index) const { 1280 int index) const {
1269 int actual = ComputeParametersCount(); 1281 int actual = ComputeParametersCount();
1270 int expected = -1; 1282 int expected = -1;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1536 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1525 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1537 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1526 list.Add(frame, zone); 1538 list.Add(frame, zone);
1527 } 1539 }
1528 return list.ToVector(); 1540 return list.ToVector();
1529 } 1541 }
1530 1542
1531 1543
1532 } // namespace internal 1544 } // namespace internal
1533 } // namespace v8 1545 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698