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

Side by Side Diff: src/runtime.cc

Issue 11519020: Fix set variable value bug: a function argument must be updated in 2 places (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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/mjsunit/debug-set-variable-value.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 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 10816 matching lines...) Expand 10 before | Expand all | Expand 10 after
10827 Handle<Object> new_value) { 10827 Handle<Object> new_value) {
10828 if (inlined_jsframe_index != 0 || frame->is_optimized()) { 10828 if (inlined_jsframe_index != 0 || frame->is_optimized()) {
10829 // Optimized frames are not supported. 10829 // Optimized frames are not supported.
10830 return false; 10830 return false;
10831 } 10831 }
10832 10832
10833 Handle<JSFunction> function(JSFunction::cast(frame->function())); 10833 Handle<JSFunction> function(JSFunction::cast(frame->function()));
10834 Handle<SharedFunctionInfo> shared(function->shared()); 10834 Handle<SharedFunctionInfo> shared(function->shared());
10835 Handle<ScopeInfo> scope_info(shared->scope_info()); 10835 Handle<ScopeInfo> scope_info(shared->scope_info());
10836 10836
10837 bool default_result = false;
10838
10837 // Parameters. 10839 // Parameters.
10838 for (int i = 0; i < scope_info->ParameterCount(); ++i) { 10840 for (int i = 0; i < scope_info->ParameterCount(); ++i) {
10839 if (scope_info->ParameterName(i)->Equals(*variable_name)) { 10841 if (scope_info->ParameterName(i)->Equals(*variable_name)) {
10840 frame->SetParameterValue(i, *new_value); 10842 frame->SetParameterValue(i, *new_value);
10841 return true; 10843 // Argument might be shadowed in heap context, don't stop here.
10844 default_result = true;
10842 } 10845 }
10843 } 10846 }
10844 10847
10845 // Stack locals. 10848 // Stack locals.
10846 for (int i = 0; i < scope_info->StackLocalCount(); ++i) { 10849 for (int i = 0; i < scope_info->StackLocalCount(); ++i) {
10847 if (scope_info->StackLocalName(i)->Equals(*variable_name)) { 10850 if (scope_info->StackLocalName(i)->Equals(*variable_name)) {
10848 frame->SetExpression(i, *new_value); 10851 frame->SetExpression(i, *new_value);
10849 return true; 10852 return true;
10850 } 10853 }
10851 } 10854 }
(...skipping 21 matching lines...) Expand all
10873 variable_name, 10876 variable_name,
10874 new_value, 10877 new_value,
10875 NONE, 10878 NONE,
10876 kNonStrictMode); 10879 kNonStrictMode);
10877 return true; 10880 return true;
10878 } 10881 }
10879 } 10882 }
10880 } 10883 }
10881 } 10884 }
10882 10885
10883 return false; 10886 return default_result;
10884 } 10887 }
10885 10888
10886 10889
10887 // Create a plain JSObject which materializes the closure content for the 10890 // Create a plain JSObject which materializes the closure content for the
10888 // context. 10891 // context.
10889 static Handle<JSObject> MaterializeClosure(Isolate* isolate, 10892 static Handle<JSObject> MaterializeClosure(Isolate* isolate,
10890 Handle<Context> context) { 10893 Handle<Context> context) {
10891 ASSERT(context->IsFunctionContext()); 10894 ASSERT(context->IsFunctionContext());
10892 10895
10893 Handle<SharedFunctionInfo> shared(context->closure()->shared()); 10896 Handle<SharedFunctionInfo> shared(context->closure()->shared());
(...skipping 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after
13624 // Handle last resort GC and make sure to allow future allocations 13627 // Handle last resort GC and make sure to allow future allocations
13625 // to grow the heap without causing GCs (if possible). 13628 // to grow the heap without causing GCs (if possible).
13626 isolate->counters()->gc_last_resort_from_js()->Increment(); 13629 isolate->counters()->gc_last_resort_from_js()->Increment();
13627 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13630 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13628 "Runtime::PerformGC"); 13631 "Runtime::PerformGC");
13629 } 13632 }
13630 } 13633 }
13631 13634
13632 13635
13633 } } // namespace v8::internal 13636 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/debug-set-variable-value.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698