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

Side by Side Diff: src/runtime.cc

Issue 7388011: Fix the debugger for strict-mode functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. 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/mirror-debugger.js ('k') | test/mjsunit/debug-receiver.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 10110 matching lines...) Expand 10 before | Expand all | Expand 10 after
10121 int position = 10121 int position =
10122 it.frame()->LookupCode()->SourcePosition(it.frame()->pc()); 10122 it.frame()->LookupCode()->SourcePosition(it.frame()->pc());
10123 10123
10124 // Check for constructor frame. Inlined frames cannot be construct calls. 10124 // Check for constructor frame. Inlined frames cannot be construct calls.
10125 bool inlined_frame = 10125 bool inlined_frame =
10126 it.frame()->is_optimized() && inlined_frame_index != 0; 10126 it.frame()->is_optimized() && inlined_frame_index != 0;
10127 bool constructor = !inlined_frame && it.frame()->IsConstructor(); 10127 bool constructor = !inlined_frame && it.frame()->IsConstructor();
10128 10128
10129 // Get scope info and read from it for local variable information. 10129 // Get scope info and read from it for local variable information.
10130 Handle<JSFunction> function(JSFunction::cast(it.frame()->function())); 10130 Handle<JSFunction> function(JSFunction::cast(it.frame()->function()));
10131 Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info()); 10131 Handle<SharedFunctionInfo> shared(function->shared());
10132 Handle<SerializedScopeInfo> scope_info(shared->scope_info());
10132 ASSERT(*scope_info != SerializedScopeInfo::Empty()); 10133 ASSERT(*scope_info != SerializedScopeInfo::Empty());
10133 ScopeInfo<> info(*scope_info); 10134 ScopeInfo<> info(*scope_info);
10134 10135
10135 // Get the locals names and values into a temporary array. 10136 // Get the locals names and values into a temporary array.
10136 // 10137 //
10137 // TODO(1240907): Hide compiler-introduced stack variables 10138 // TODO(1240907): Hide compiler-introduced stack variables
10138 // (e.g. .result)? For users of the debugger, they will probably be 10139 // (e.g. .result)? For users of the debugger, they will probably be
10139 // confusing. 10140 // confusing.
10140 Handle<FixedArray> locals = 10141 Handle<FixedArray> locals =
10141 isolate->factory()->NewFixedArray(info.NumberOfLocals() * 2); 10142 isolate->factory()->NewFixedArray(info.NumberOfLocals() * 2);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
10293 10294
10294 // Add the value being returned. 10295 // Add the value being returned.
10295 if (at_return) { 10296 if (at_return) {
10296 details->set(details_index++, *return_value); 10297 details->set(details_index++, *return_value);
10297 } 10298 }
10298 10299
10299 // Add the receiver (same as in function frame). 10300 // Add the receiver (same as in function frame).
10300 // THIS MUST BE DONE LAST SINCE WE MIGHT ADVANCE 10301 // THIS MUST BE DONE LAST SINCE WE MIGHT ADVANCE
10301 // THE FRAME ITERATOR TO WRAP THE RECEIVER. 10302 // THE FRAME ITERATOR TO WRAP THE RECEIVER.
10302 Handle<Object> receiver(it.frame()->receiver(), isolate); 10303 Handle<Object> receiver(it.frame()->receiver(), isolate);
10303 if (!receiver->IsJSObject()) { 10304 if (!receiver->IsJSObject() && !shared->strict_mode() && !shared->native()) {
10304 // If the receiver is NOT a JSObject we have hit an optimization 10305 // If the receiver is not a JSObject and the function is not a
10305 // where a value object is not converted into a wrapped JS objects. 10306 // builtin or strict-mode we have hit an optimization where a
10306 // To hide this optimization from the debugger, we wrap the receiver 10307 // value object is not converted into a wrapped JS objects. To
10308 // hide this optimization from the debugger, we wrap the receiver
10307 // by creating correct wrapper object based on the calling frame's 10309 // by creating correct wrapper object based on the calling frame's
10308 // global context. 10310 // global context.
10309 it.Advance(); 10311 it.Advance();
10310 Handle<Context> calling_frames_global_context( 10312 Handle<Context> calling_frames_global_context(
10311 Context::cast(Context::cast(it.frame()->context())->global_context())); 10313 Context::cast(Context::cast(it.frame()->context())->global_context()));
10312 receiver = 10314 receiver =
10313 isolate->factory()->ToObject(receiver, calling_frames_global_context); 10315 isolate->factory()->ToObject(receiver, calling_frames_global_context);
10314 } 10316 }
10315 details->set(kFrameDetailsReceiverIndex, *receiver); 10317 details->set(kFrameDetailsReceiverIndex, *receiver);
10316 10318
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after
12670 } else { 12672 } else {
12671 // Handle last resort GC and make sure to allow future allocations 12673 // Handle last resort GC and make sure to allow future allocations
12672 // to grow the heap without causing GCs (if possible). 12674 // to grow the heap without causing GCs (if possible).
12673 isolate->counters()->gc_last_resort_from_js()->Increment(); 12675 isolate->counters()->gc_last_resort_from_js()->Increment();
12674 isolate->heap()->CollectAllGarbage(false); 12676 isolate->heap()->CollectAllGarbage(false);
12675 } 12677 }
12676 } 12678 }
12677 12679
12678 12680
12679 } } // namespace v8::internal 12681 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mirror-debugger.js ('k') | test/mjsunit/debug-receiver.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698