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