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

Side by Side Diff: src/compiler/js-inlining.cc

Issue 1410023006: [turbofan] Fix JSInliner strong mode bailout. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix signed versus unsigned. Created 5 years, 2 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 | « no previous file | 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/compiler/js-inlining.h" 5 #include "src/compiler/js-inlining.h"
6 6
7 #include "src/ast.h" 7 #include "src/ast.h"
8 #include "src/ast-numbering.h" 8 #include "src/ast-numbering.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/compiler/all-nodes.h" 10 #include "src/compiler/all-nodes.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 if (!Compiler::ParseAndAnalyze(info.parse_info())) { 335 if (!Compiler::ParseAndAnalyze(info.parse_info())) {
336 TRACE("Not inlining %s into %s because parsing failed\n", 336 TRACE("Not inlining %s into %s because parsing failed\n",
337 function->shared()->DebugName()->ToCString().get(), 337 function->shared()->DebugName()->ToCString().get(),
338 info_->shared_info()->DebugName()->ToCString().get()); 338 info_->shared_info()->DebugName()->ToCString().get());
339 if (info_->isolate()->has_pending_exception()) { 339 if (info_->isolate()->has_pending_exception()) {
340 info_->isolate()->clear_pending_exception(); 340 info_->isolate()->clear_pending_exception();
341 } 341 }
342 return NoChange(); 342 return NoChange();
343 } 343 }
344 344
345 // In strong mode, in case of too few arguments we need to throw a TypeError
346 // so we must not inline this call.
347 size_t parameter_count = info.literal()->parameter_count();
348 if (is_strong(info.language_mode()) &&
349 call.formal_arguments() < parameter_count) {
350 TRACE("Not inlining %s into %s because too few arguments for strong mode\n",
351 function->shared()->DebugName()->ToCString().get(),
352 info_->shared_info()->DebugName()->ToCString().get());
353 return NoChange();
354 }
355
345 if (!Compiler::EnsureDeoptimizationSupport(&info)) { 356 if (!Compiler::EnsureDeoptimizationSupport(&info)) {
346 TRACE("Not inlining %s into %s because deoptimization support failed\n", 357 TRACE("Not inlining %s into %s because deoptimization support failed\n",
347 function->shared()->DebugName()->ToCString().get(), 358 function->shared()->DebugName()->ToCString().get(),
348 info_->shared_info()->DebugName()->ToCString().get()); 359 info_->shared_info()->DebugName()->ToCString().get());
349 return NoChange(); 360 return NoChange();
350 } 361 }
351 // Remember that we inlined this function. This needs to be called right 362 // Remember that we inlined this function. This needs to be called right
352 // after we ensure deoptimization support so that the code flusher 363 // after we ensure deoptimization support so that the code flusher
353 // does not remove the code with the deoptimization support. 364 // does not remove the code with the deoptimization support.
354 info_->AddInlinedFunction(info.shared_info()); 365 info_->AddInlinedFunction(info.shared_info());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // type feedback in the compiler. 406 // type feedback in the compiler.
396 Node* context = jsgraph_->Constant(handle(function->context())); 407 Node* context = jsgraph_->Constant(handle(function->context()));
397 408
398 CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone()); 409 CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone());
399 visitor.CopyGraph(); 410 visitor.CopyGraph();
400 411
401 Node* start = visitor.GetCopy(graph.start()); 412 Node* start = visitor.GetCopy(graph.start());
402 Node* end = visitor.GetCopy(graph.end()); 413 Node* end = visitor.GetCopy(graph.end());
403 414
404 Node* frame_state = call.frame_state(); 415 Node* frame_state = call.frame_state();
405 size_t const inlinee_formal_parameters = start->op()->ValueOutputCount() - 3;
Jarin 2015/10/22 10:03:09 Now I am wondering whether we should dcheck that
Michael Starzinger 2015/10/22 10:35:41 Done.
406 // Insert argument adaptor frame if required. 416 // Insert argument adaptor frame if required.
407 if (call.formal_arguments() != inlinee_formal_parameters) { 417 if (call.formal_arguments() != parameter_count) {
408 // In strong mode, in case of too few arguments we need to throw a
409 // TypeError so we must not inline this call.
410 // TODO(jarin) This check should be moved before the decision point
411 // above so that we do not compile the function uselessly.
412 if (is_strong(info.language_mode()) &&
413 call.formal_arguments() < inlinee_formal_parameters) {
414 return NoChange();
415 }
416 frame_state = CreateArgumentsAdaptorFrameState(&call, info.shared_info(), 418 frame_state = CreateArgumentsAdaptorFrameState(&call, info.shared_info(),
417 info.zone()); 419 info.zone());
418 } 420 }
419 421
420 return InlineCall(node, context, frame_state, start, end); 422 return InlineCall(node, context, frame_state, start, end);
421 } 423 }
422 424
423 } // namespace compiler 425 } // namespace compiler
424 } // namespace internal 426 } // namespace internal
425 } // namespace v8 427 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698