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

Unified Diff: src/compiler/graph-builder.cc

Issue 535133002: Remove usages of alloca() according to style guide. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/machine-node-factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/graph-builder.cc
diff --git a/src/compiler/graph-builder.cc b/src/compiler/graph-builder.cc
index 504d25ec2f00fe42801b0a4a12d71fe993ba3f58..c41fd6fac58d615d895694712d12f3dc413f9087 100644
--- a/src/compiler/graph-builder.cc
+++ b/src/compiler/graph-builder.cc
@@ -49,8 +49,7 @@ Node* StructuredGraphBuilder::MakeNode(Operator* op, int value_input_count,
if (has_framestate) ++input_count_with_deps;
if (has_control) ++input_count_with_deps;
if (has_effect) ++input_count_with_deps;
- void* raw_buffer = alloca(kPointerSize * input_count_with_deps);
- Node** buffer = reinterpret_cast<Node**>(raw_buffer);
+ Node** buffer = zone()->NewArray<Node*>(input_count_with_deps);
memcpy(buffer, value_inputs, kPointerSize * value_input_count);
Node** current_input = buffer + value_input_count;
if (has_context) {
@@ -163,8 +162,7 @@ void StructuredGraphBuilder::Environment::PrepareForLoop() {
Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) {
Operator* phi_op = common()->Phi(count);
- void* raw_buffer = alloca(kPointerSize * (count + 1));
- Node** buffer = reinterpret_cast<Node**>(raw_buffer);
+ Node** buffer = zone()->NewArray<Node*>(count + 1);
MemsetPointer(buffer, input, count);
buffer[count] = control;
return graph()->NewNode(phi_op, count + 1, buffer);
@@ -175,8 +173,7 @@ Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) {
Node* StructuredGraphBuilder::NewEffectPhi(int count, Node* input,
Node* control) {
Operator* phi_op = common()->EffectPhi(count);
- void* raw_buffer = alloca(kPointerSize * (count + 1));
- Node** buffer = reinterpret_cast<Node**>(raw_buffer);
+ Node** buffer = zone()->NewArray<Node*>(count + 1);
MemsetPointer(buffer, input, count);
buffer[count] = control;
return graph()->NewNode(phi_op, count + 1, buffer);
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/machine-node-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698