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

Side by Side Diff: src/compiler/node.cc

Issue 1492433003: [turbofan] Check that inputs to Node::New are not NULL. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/node.h" 5 #include "src/compiler/node.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 51
52 Node* Node::New(Zone* zone, NodeId id, const Operator* op, int input_count, 52 Node* Node::New(Zone* zone, NodeId id, const Operator* op, int input_count,
53 Node* const* inputs, bool has_extensible_inputs) { 53 Node* const* inputs, bool has_extensible_inputs) {
54 Node** input_ptr; 54 Node** input_ptr;
55 Use* use_ptr; 55 Use* use_ptr;
56 Node* node; 56 Node* node;
57 bool is_inline; 57 bool is_inline;
58 58
59 #if DEBUG
60 // Verify that none of the inputs are {nullptr}.
61 for (int i = 0; i < input_count; i++) {
62 if (inputs[i] == nullptr) {
63 V8_Fatal(__FILE__, __LINE__, "Node::New() Error: #%d:%s[%d] is NULL",
64 static_cast<int>(id), op->mnemonic(), i);
65 }
66 }
67 #endif
68
59 if (input_count > kMaxInlineCapacity) { 69 if (input_count > kMaxInlineCapacity) {
60 // Allocate out-of-line inputs. 70 // Allocate out-of-line inputs.
61 int capacity = 71 int capacity =
62 has_extensible_inputs ? input_count + kMaxInlineCapacity : input_count; 72 has_extensible_inputs ? input_count + kMaxInlineCapacity : input_count;
63 OutOfLineInputs* outline = OutOfLineInputs::New(zone, capacity); 73 OutOfLineInputs* outline = OutOfLineInputs::New(zone, capacity);
64 74
65 // Allocate node. 75 // Allocate node.
66 void* node_buffer = zone->New(sizeof(Node)); 76 void* node_buffer = zone->New(sizeof(Node));
67 node = new (node_buffer) Node(id, op, kOutlineMarker, 0); 77 node = new (node_buffer) Node(id, op, kOutlineMarker, 0);
68 node->inputs_.outline_ = outline; 78 node->inputs_.outline_ = outline;
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 ++(*this); 412 ++(*this);
403 return result; 413 return result;
404 } 414 }
405 415
406 416
407 bool Node::Uses::empty() const { return begin() == end(); } 417 bool Node::Uses::empty() const { return begin() == end(); }
408 418
409 } // namespace compiler 419 } // namespace compiler
410 } // namespace internal 420 } // namespace internal
411 } // namespace v8 421 } // 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