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

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

Issue 804333005: Revert of [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 Handle<JSFunction> function; 2205 FrameInspector frame_inspector(frame, inlined_jsframe_index, isolate);
2206 Handle<SharedFunctionInfo> outer_info; 2206 Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction()));
2207 Handle<JSObject> materialized; 2207 Handle<SharedFunctionInfo> outer_info(function->shared());
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());
2216 2208
2217 // Traverse the saved contexts chain to find the active context for the 2209 // Traverse the saved contexts chain to find the active context for the
2218 // selected frame. 2210 // selected frame.
2219 SaveContext* save = FindSavedContextForFrame(isolate, frame); 2211 SaveContext* save = FindSavedContextForFrame(isolate, frame);
2220 2212
2221 SaveContext savex(isolate); 2213 SaveContext savex(isolate);
2222 isolate->set_context(*(save->context())); 2214 isolate->set_context(*(save->context()));
2223 2215
2224 // Materialize stack locals and the arguments object. 2216 // Materialize stack locals and the arguments object.
2225 materialized = NewJSObjectWithNullProto(isolate); 2217 Handle<JSObject> materialized = NewJSObjectWithNullProto(isolate);
2226 2218
2227 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2219 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2228 isolate, materialized, 2220 isolate, materialized,
2229 MaterializeStackLocalsWithFrameInspector(isolate, materialized, 2221 MaterializeStackLocalsWithFrameInspector(isolate, materialized, function,
2230 function, &frame_inspector)); 2222 &frame_inspector));
2231 2223
2232 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2224 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2233 isolate, materialized, 2225 isolate, materialized,
2234 MaterializeArgumentsObject(isolate, materialized, function)); 2226 MaterializeArgumentsObject(isolate, materialized, function));
2235 2227
2236 // At this point, the lookup chain may look like this: 2228 // At this point, the lookup chain may look like this:
2237 // [inner context] -> [function stack]+[function context] -> [outer context] 2229 // [inner context] -> [function stack]+[function context] -> [outer context]
2238 // The function stack is not an actual context, it complements the function 2230 // The function stack is not an actual context, it complements the function
2239 // context. In order to have the same lookup chain when debug-evaluating, 2231 // context. In order to have the same lookup chain when debug-evaluating,
2240 // we materialize the stack and insert it into the context chain as a 2232 // we materialize the stack and insert it into the context chain as a
2241 // with-context before the function context. 2233 // with-context before the function context.
2242 // [inner context] -> [with context] -> [function context] -> [outer 2234 // [inner context] -> [with context] -> [function context] -> [outer context]
2243 // context] 2235 // Ordering the with-context before the function context forces a dynamic
2244 // Ordering the with-context before the function context forces a dynamic 2236 // lookup instead of a static lookup that could fail as the scope info is
2245 // lookup instead of a static lookup that could fail as the scope info is 2237 // outdated and may expect variables to still be stack-allocated.
2246 // outdated and may expect variables to still be stack-allocated. 2238 // Afterwards, we write changes to the with-context back to the stack
2247 // Afterwards, we write changes to the with-context back to the stack 2239 // and remove it from the context chain.
2248 // and remove it from the context chain. 2240 // This could cause lookup failures if debug-evaluate creates a closure that
2249 // This could cause lookup failures if debug-evaluate creates a closure that 2241 // uses this temporary context chain.
2250 // uses this temporary context chain.
2251 2242
2252 eval_context = Handle<Context>(Context::cast(frame_inspector.GetContext())); 2243 Handle<Context> eval_context(Context::cast(frame_inspector.GetContext()));
2253 DCHECK(!eval_context.is_null()); 2244 DCHECK(!eval_context.is_null());
2254 }
2255 Handle<Context> function_context = eval_context; 2245 Handle<Context> function_context = eval_context;
2256 Handle<Context> outer_context(function->context(), isolate); 2246 Handle<Context> outer_context(function->context(), isolate);
2257 Handle<Context> inner_context; 2247 Handle<Context> inner_context;
2258 // We iterate to find the function's context. If the function has no 2248 // We iterate to find the function's context. If the function has no
2259 // context-allocated variables, we iterate until we hit the outer context. 2249 // context-allocated variables, we iterate until we hit the outer context.
2260 while (!function_context->IsFunctionContext() && 2250 while (!function_context->IsFunctionContext() &&
2261 !function_context->IsScriptContext() && 2251 !function_context->IsScriptContext() &&
2262 !function_context.is_identical_to(outer_context)) { 2252 !function_context.is_identical_to(outer_context)) {
2263 inner_context = function_context; 2253 inner_context = function_context;
2264 function_context = Handle<Context>(function_context->previous(), isolate); 2254 function_context = Handle<Context>(function_context->previous(), isolate);
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
2819 return Smi::FromInt(isolate->debug()->is_active()); 2809 return Smi::FromInt(isolate->debug()->is_active());
2820 } 2810 }
2821 2811
2822 2812
2823 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { 2813 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) {
2824 UNIMPLEMENTED(); 2814 UNIMPLEMENTED();
2825 return NULL; 2815 return NULL;
2826 } 2816 }
2827 } 2817 }
2828 } // namespace v8::internal 2818 } // 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