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

Side by Side Diff: src/runtime.cc

Issue 7310027: Add inspection of arguments for optimized frames (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor fixes Created 9 years, 5 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 | « src/deoptimizer.cc ('k') | test/mjsunit/debug-evaluate-locals-optimized.js » ('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 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 10133 matching lines...) Expand 10 before | Expand all | Expand 10 after
10144 10144
10145 // Now advance to the arguments adapter frame (if any). It contains all 10145 // Now advance to the arguments adapter frame (if any). It contains all
10146 // the provided parameters whereas the function frame always have the number 10146 // the provided parameters whereas the function frame always have the number
10147 // of arguments matching the functions parameters. The rest of the 10147 // of arguments matching the functions parameters. The rest of the
10148 // information (except for what is collected above) is the same. 10148 // information (except for what is collected above) is the same.
10149 it.AdvanceToArgumentsFrame(); 10149 it.AdvanceToArgumentsFrame();
10150 10150
10151 // Find the number of arguments to fill. At least fill the number of 10151 // Find the number of arguments to fill. At least fill the number of
10152 // parameters for the function and fill more if more parameters are provided. 10152 // parameters for the function and fill more if more parameters are provided.
10153 int argument_count = info.number_of_parameters(); 10153 int argument_count = info.number_of_parameters();
10154 if (argument_count < it.frame()->ComputeParametersCount()) { 10154 if (it.frame()->is_optimized()) {
10155 argument_count = it.frame()->ComputeParametersCount(); 10155 ASSERT_EQ(argument_count, deoptimized_frame->parameters_count());
10156 } else {
10157 if (argument_count < it.frame()->ComputeParametersCount()) {
10158 argument_count = it.frame()->ComputeParametersCount();
10159 }
10156 } 10160 }
10157 10161
10158 // Calculate the size of the result. 10162 // Calculate the size of the result.
10159 int details_size = kFrameDetailsFirstDynamicIndex + 10163 int details_size = kFrameDetailsFirstDynamicIndex +
10160 2 * (argument_count + info.NumberOfLocals()) + 10164 2 * (argument_count + info.NumberOfLocals()) +
10161 (at_return ? 1 : 0); 10165 (at_return ? 1 : 0);
10162 Handle<FixedArray> details = isolate->factory()->NewFixedArray(details_size); 10166 Handle<FixedArray> details = isolate->factory()->NewFixedArray(details_size);
10163 10167
10164 // Add the frame id. 10168 // Add the frame id.
10165 details->set(kFrameDetailsFrameIdIndex, *frame_id); 10169 details->set(kFrameDetailsFrameIdIndex, *frame_id);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
10214 10218
10215 // Add arguments name and value. 10219 // Add arguments name and value.
10216 for (int i = 0; i < argument_count; i++) { 10220 for (int i = 0; i < argument_count; i++) {
10217 // Name of the argument. 10221 // Name of the argument.
10218 if (i < info.number_of_parameters()) { 10222 if (i < info.number_of_parameters()) {
10219 details->set(details_index++, *info.parameter_name(i)); 10223 details->set(details_index++, *info.parameter_name(i));
10220 } else { 10224 } else {
10221 details->set(details_index++, heap->undefined_value()); 10225 details->set(details_index++, heap->undefined_value());
10222 } 10226 }
10223 10227
10224 // Parameter value. If we are inspecting an optimized frame, use 10228 // Parameter value.
10225 // undefined as the value. 10229 if (it.frame()->is_optimized()) {
10226 // 10230 // Get the value from the deoptimized frame.
10227 // TODO(3141533): We should be able to get the actual parameter 10231 details->set(details_index++, deoptimized_frame->GetParameter(i));
10228 // value for optimized frames.
10229 if (!it.frame()->is_optimized() &&
10230 (i < it.frame()->ComputeParametersCount())) {
10231 details->set(details_index++, it.frame()->GetParameter(i));
10232 } else { 10232 } else {
10233 details->set(details_index++, heap->undefined_value()); 10233 if (i < it.frame()->ComputeParametersCount()) {
10234 // Get the value from the stack.
10235 details->set(details_index++, it.frame()->GetParameter(i));
10236 } else {
10237 details->set(details_index++, heap->undefined_value());
10238 }
10234 } 10239 }
10235 } 10240 }
10236 10241
10237 // Add locals name and value from the temporary copy from the function frame. 10242 // Add locals name and value from the temporary copy from the function frame.
10238 for (int i = 0; i < info.NumberOfLocals() * 2; i++) { 10243 for (int i = 0; i < info.NumberOfLocals() * 2; i++) {
10239 details->set(details_index++, locals->get(i)); 10244 details->set(details_index++, locals->get(i));
10240 } 10245 }
10241 10246
10242 // Add the value being returned. 10247 // Add the value being returned.
10243 if (at_return) { 10248 if (at_return) {
(...skipping 2362 matching lines...) Expand 10 before | Expand all | Expand 10 after
12606 } else { 12611 } else {
12607 // Handle last resort GC and make sure to allow future allocations 12612 // Handle last resort GC and make sure to allow future allocations
12608 // to grow the heap without causing GCs (if possible). 12613 // to grow the heap without causing GCs (if possible).
12609 isolate->counters()->gc_last_resort_from_js()->Increment(); 12614 isolate->counters()->gc_last_resort_from_js()->Increment();
12610 isolate->heap()->CollectAllGarbage(false); 12615 isolate->heap()->CollectAllGarbage(false);
12611 } 12616 }
12612 } 12617 }
12613 12618
12614 12619
12615 } } // namespace v8::internal 12620 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | test/mjsunit/debug-evaluate-locals-optimized.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698