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

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

Issue 2320673002: [deoptimizer] Clear context before NotifyDeoptimized. (Closed)
Patch Set: Addressed comments. Created 4 years, 3 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/deoptimizer.cc ('k') | no next file » | 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/asmjs/asm-js.h" 8 #include "src/asmjs/asm-js.h"
9 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" 9 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); 165 Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate);
166 DCHECK(AllowHeapAllocation::IsAllowed()); 166 DCHECK(AllowHeapAllocation::IsAllowed());
167 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate); 167 TimerEventScope<TimerEventDeoptimizeCode> timer(isolate);
168 TRACE_EVENT0("v8", "V8.DeoptimizeCode"); 168 TRACE_EVENT0("v8", "V8.DeoptimizeCode");
169 169
170 Handle<JSFunction> function = deoptimizer->function(); 170 Handle<JSFunction> function = deoptimizer->function();
171 Handle<Code> optimized_code = deoptimizer->compiled_code(); 171 Handle<Code> optimized_code = deoptimizer->compiled_code();
172 172
173 DCHECK(optimized_code->kind() == Code::OPTIMIZED_FUNCTION); 173 DCHECK(optimized_code->kind() == Code::OPTIMIZED_FUNCTION);
174 DCHECK(type == deoptimizer->bailout_type()); 174 DCHECK(type == deoptimizer->bailout_type());
175 DCHECK_NULL(isolate->context());
176
177 // TODO(turbofan): For Crankshaft we restore the context before objects are
178 // being materialized, because it never de-materializes the context but it
179 // requires a context to materialize arguments objects. This is specific to
180 // Crankshaft and can be removed once only TurboFan goes through here.
181 if (!optimized_code->is_turbofanned()) {
182 JavaScriptFrameIterator top_it(isolate);
183 JavaScriptFrame* top_frame = top_it.frame();
184 isolate->set_context(Context::cast(top_frame->context()));
185 }
175 186
176 // Make sure to materialize objects before causing any allocation. 187 // Make sure to materialize objects before causing any allocation.
177 JavaScriptFrameIterator it(isolate); 188 JavaScriptFrameIterator it(isolate);
178 deoptimizer->MaterializeHeapObjects(&it); 189 deoptimizer->MaterializeHeapObjects(&it);
179 delete deoptimizer; 190 delete deoptimizer;
180 191
181 // Ensure the context register is updated for materialized objects. 192 // Ensure the context register is updated for materialized objects.
182 JavaScriptFrameIterator top_it(isolate); 193 if (optimized_code->is_turbofanned()) {
183 JavaScriptFrame* top_frame = top_it.frame(); 194 JavaScriptFrameIterator top_it(isolate);
184 isolate->set_context(Context::cast(top_frame->context())); 195 JavaScriptFrame* top_frame = top_it.frame();
196 isolate->set_context(Context::cast(top_frame->context()));
197 }
185 198
186 if (type == Deoptimizer::LAZY) { 199 if (type == Deoptimizer::LAZY) {
187 return isolate->heap()->undefined_value(); 200 return isolate->heap()->undefined_value();
188 } 201 }
189 202
190 // Search for other activations of the same optimized code. 203 // Search for other activations of the same optimized code.
191 // At this point {it} is at the topmost frame of all the frames materialized 204 // At this point {it} is at the topmost frame of all the frames materialized
192 // by the deoptimizer. Note that this frame does not necessarily represent 205 // by the deoptimizer. Note that this frame does not necessarily represent
193 // an activation of {function} because of potential inlined tail-calls. 206 // an activation of {function} because of potential inlined tail-calls.
194 ActivationsFinder activations_finder(*optimized_code); 207 ActivationsFinder activations_finder(*optimized_code);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 DCHECK(is_valid_language_mode(args.smi_at(3))); 461 DCHECK(is_valid_language_mode(args.smi_at(3)));
449 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); 462 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3));
450 DCHECK(args[4]->IsSmi()); 463 DCHECK(args[4]->IsSmi());
451 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), 464 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(),
452 isolate); 465 isolate);
453 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, 466 return CompileGlobalEval(isolate, args.at<String>(1), outer_info,
454 language_mode, args.smi_at(4), args.smi_at(5)); 467 language_mode, args.smi_at(4), args.smi_at(5));
455 } 468 }
456 } // namespace internal 469 } // namespace internal
457 } // namespace v8 470 } // namespace v8
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698