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

Side by Side Diff: src/runtime/runtime-debug.cc

Issue 786333004: [turbofan] Fix bunch of tests failing with --turbo-deoptimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/compiler/simplified-lowering.cc ('k') | test/mjsunit/mjsunit.status » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 2184 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 4); 2195 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 4);
2196 CONVERT_ARG_HANDLE_CHECKED(Object, context_extension, 5); 2196 CONVERT_ARG_HANDLE_CHECKED(Object, context_extension, 5);
2197 2197
2198 // Handle the processing of break. 2198 // Handle the processing of break.
2199 DisableBreak disable_break_scope(isolate->debug(), disable_break); 2199 DisableBreak disable_break_scope(isolate->debug(), disable_break);
2200 2200
2201 // Get the frame where the debugging is performed. 2201 // Get the frame where the debugging is performed.
2202 StackFrame::Id id = UnwrapFrameId(wrapped_id); 2202 StackFrame::Id id = UnwrapFrameId(wrapped_id);
2203 JavaScriptFrameIterator it(isolate, id); 2203 JavaScriptFrameIterator it(isolate, id);
2204 JavaScriptFrame* frame = it.frame(); 2204 JavaScriptFrame* frame = it.frame();
2205 FrameInspector frame_inspector(frame, inlined_jsframe_index, isolate); 2205 Handle<JSFunction> function;
2206 Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction())); 2206 Handle<SharedFunctionInfo> outer_info;
2207 Handle<SharedFunctionInfo> outer_info(function->shared()); 2207 Handle<JSObject> materialized;
2208 Handle<Context> eval_context;
2209 {
2210 // We need a short scope for re-entrancy as we cannot have two frame
2211 // inspectors at the same time (because they are using a global variable).
2212 FrameInspector frame_inspector(frame, inlined_jsframe_index, isolate);
2213 function =
2214 Handle<JSFunction>(JSFunction::cast(frame_inspector.GetFunction()));
2215 outer_info = Handle<SharedFunctionInfo>(function->shared());
2208 2216
2209 // Traverse the saved contexts chain to find the active context for the 2217 // Traverse the saved contexts chain to find the active context for the
2210 // selected frame. 2218 // selected frame.
2211 SaveContext* save = FindSavedContextForFrame(isolate, frame); 2219 SaveContext* save = FindSavedContextForFrame(isolate, frame);
2212 2220
2213 SaveContext savex(isolate); 2221 SaveContext savex(isolate);
2214 isolate->set_context(*(save->context())); 2222 isolate->set_context(*(save->context()));
2215 2223
2216 // Materialize stack locals and the arguments object. 2224 // Materialize stack locals and the arguments object.
2217 Handle<JSObject> materialized = NewJSObjectWithNullProto(isolate); 2225 materialized = NewJSObjectWithNullProto(isolate);
2218 2226
2219 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2227 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2220 isolate, materialized, 2228 isolate, materialized,
2221 MaterializeStackLocalsWithFrameInspector(isolate, materialized, function, 2229 MaterializeStackLocalsWithFrameInspector(isolate, materialized,
2222 &frame_inspector)); 2230 function, &frame_inspector));
2223 2231
2224 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2232 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2225 isolate, materialized, 2233 isolate, materialized,
2226 MaterializeArgumentsObject(isolate, materialized, function)); 2234 MaterializeArgumentsObject(isolate, materialized, function));
2227 2235
2228 // At this point, the lookup chain may look like this: 2236 // At this point, the lookup chain may look like this:
2229 // [inner context] -> [function stack]+[function context] -> [outer context] 2237 // [inner context] -> [function stack]+[function context] -> [outer context]
2230 // The function stack is not an actual context, it complements the function 2238 // The function stack is not an actual context, it complements the function
2231 // context. In order to have the same lookup chain when debug-evaluating, 2239 // context. In order to have the same lookup chain when debug-evaluating,
2232 // we materialize the stack and insert it into the context chain as a 2240 // we materialize the stack and insert it into the context chain as a
2233 // with-context before the function context. 2241 // with-context before the function context.
2234 // [inner context] -> [with context] -> [function context] -> [outer context] 2242 // [inner context] -> [with context] -> [function context] -> [outer
2235 // Ordering the with-context before the function context forces a dynamic 2243 // context]
2236 // lookup instead of a static lookup that could fail as the scope info is 2244 // Ordering the with-context before the function context forces a dynamic
2237 // outdated and may expect variables to still be stack-allocated. 2245 // lookup instead of a static lookup that could fail as the scope info is
2238 // Afterwards, we write changes to the with-context back to the stack 2246 // outdated and may expect variables to still be stack-allocated.
2239 // and remove it from the context chain. 2247 // Afterwards, we write changes to the with-context back to the stack
2240 // This could cause lookup failures if debug-evaluate creates a closure that 2248 // and remove it from the context chain.
2241 // uses this temporary context chain. 2249 // This could cause lookup failures if debug-evaluate creates a closure that
2250 // uses this temporary context chain.
2242 2251
2243 Handle<Context> eval_context(Context::cast(frame_inspector.GetContext())); 2252 eval_context = Handle<Context>(Context::cast(frame_inspector.GetContext()));
2244 DCHECK(!eval_context.is_null()); 2253 DCHECK(!eval_context.is_null());
2254 }
2245 Handle<Context> function_context = eval_context; 2255 Handle<Context> function_context = eval_context;
2246 Handle<Context> outer_context(function->context(), isolate); 2256 Handle<Context> outer_context(function->context(), isolate);
2247 Handle<Context> inner_context; 2257 Handle<Context> inner_context;
2248 // We iterate to find the function's context. If the function has no 2258 // We iterate to find the function's context. If the function has no
2249 // context-allocated variables, we iterate until we hit the outer context. 2259 // context-allocated variables, we iterate until we hit the outer context.
2250 while (!function_context->IsFunctionContext() && 2260 while (!function_context->IsFunctionContext() &&
2251 !function_context->IsScriptContext() && 2261 !function_context->IsScriptContext() &&
2252 !function_context.is_identical_to(outer_context)) { 2262 !function_context.is_identical_to(outer_context)) {
2253 inner_context = function_context; 2263 inner_context = function_context;
2254 function_context = Handle<Context>(function_context->previous(), isolate); 2264 function_context = Handle<Context>(function_context->previous(), isolate);
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 return Smi::FromInt(isolate->debug()->is_active()); 2819 return Smi::FromInt(isolate->debug()->is_active());
2810 } 2820 }
2811 2821
2812 2822
2813 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { 2823 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) {
2814 UNIMPLEMENTED(); 2824 UNIMPLEMENTED();
2815 return NULL; 2825 return NULL;
2816 } 2826 }
2817 } 2827 }
2818 } // namespace v8::internal 2828 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698