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

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

Issue 1115263004: [strong] Check arity of functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/arm64/builtins-arm64.cc ('k') | src/hydrogen.cc » ('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/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/all-nodes.h" 9 #include "src/compiler/all-nodes.h"
10 #include "src/compiler/ast-graph-builder.h" 10 #include "src/compiler/ast-graph-builder.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 Node* frame_state() { return NodeProperties::GetFrameStateInput(call_, 0); } 55 Node* frame_state() { return NodeProperties::GetFrameStateInput(call_, 0); }
56 56
57 private: 57 private:
58 Node* call_; 58 Node* call_;
59 }; 59 };
60 60
61 61
62 namespace { 62 namespace {
63 63
64 // A facade on a JSFunction's graph to facilitate inlining. It assumes the 64 // A facade on a JSFunction's graph to facilitate inlining. It assumes
65 // that the function graph has only one return statement, and provides 65 // that the function graph has only one return statement, and provides
66 // {UnifyReturn} to convert a function graph to that end. 66 // {UnifyReturn} to convert a function graph to that end.
67 class Inlinee { 67 class Inlinee {
68 public: 68 public:
69 Inlinee(Node* start, Node* end) : start_(start), end_(end) {} 69 Inlinee(Node* start, Node* end) : start_(start), end_(end) {}
70 70
71 // Returns the last regular control node, that is 71 // Returns the last regular control node, that is
72 // the last control node before the end node. 72 // the last control node before the end node.
73 Node* end_block() { return NodeProperties::GetControlInput(unique_return()); } 73 Node* end_block() { return NodeProperties::GetControlInput(unique_return()); }
74 74
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 Inlinee::UnifyReturn(&jsgraph); 356 Inlinee::UnifyReturn(&jsgraph);
357 357
358 CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone()); 358 CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone());
359 visitor.CopyGraph(); 359 visitor.CopyGraph();
360 360
361 Inlinee inlinee(visitor.GetCopy(graph.start()), visitor.GetCopy(graph.end())); 361 Inlinee inlinee(visitor.GetCopy(graph.start()), visitor.GetCopy(graph.end()));
362 362
363 Node* outer_frame_state = call.frame_state(); 363 Node* outer_frame_state = call.frame_state();
364 // Insert argument adaptor frame if required. 364 // Insert argument adaptor frame if required.
365 if (call.formal_arguments() != inlinee.formal_parameters()) { 365 if (call.formal_arguments() != inlinee.formal_parameters()) {
366 // In strong mode, in case of too few arguments we need to throw a
367 // TypeError so we must not inline this call.
368 if (is_strong(info.language_mode()) &&
369 call.formal_arguments() < inlinee.formal_parameters()) {
370 return NoChange();
371 }
366 outer_frame_state = 372 outer_frame_state =
367 CreateArgumentsAdaptorFrameState(&call, function, info.zone()); 373 CreateArgumentsAdaptorFrameState(&call, function, info.zone());
368 } 374 }
369 375
370 for (Node* node : visitor.copies()) { 376 for (Node* node : visitor.copies()) {
371 if (node && node->opcode() == IrOpcode::kFrameState) { 377 if (node && node->opcode() == IrOpcode::kFrameState) {
372 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); 378 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
373 AddClosureToFrameState(node, function); 379 AddClosureToFrameState(node, function);
374 NodeProperties::ReplaceFrameStateInput(node, 0, outer_frame_state); 380 NodeProperties::ReplaceFrameStateInput(node, 0, outer_frame_state);
375 } 381 }
376 } 382 }
377 383
378 return inlinee.InlineAtCall(jsgraph_, node); 384 return inlinee.InlineAtCall(jsgraph_, node);
379 } 385 }
380 386
381 } // namespace compiler 387 } // namespace compiler
382 } // namespace internal 388 } // namespace internal
383 } // namespace v8 389 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698