Revision: 23657
Author:   [email protected]
Date:     Wed Sep  3 13:23:37 2014 UTC
Log:      Remove usages of alloca() according to style guide.

[email protected]

Review URL: https://codereview.chromium.org/535133002
https://code.google.com/p/v8/source/detail?r=23657

Modified:
 /branches/bleeding_edge/src/compiler/ast-graph-builder.cc
 /branches/bleeding_edge/src/compiler/graph-builder.cc
 /branches/bleeding_edge/src/compiler/machine-node-factory.h
 /branches/bleeding_edge/src/compiler/structured-machine-assembler.cc

=======================================
--- /branches/bleeding_edge/src/compiler/ast-graph-builder.cc Tue Sep 2 11:28:40 2014 UTC +++ /branches/bleeding_edge/src/compiler/ast-graph-builder.cc Wed Sep 3 13:23:37 2014 UTC
@@ -1652,7 +1652,7 @@

 Node* AstGraphBuilder::ProcessArguments(Operator* op, int arity) {
   DCHECK(environment()->stack_height() >= arity);
-  Node** all = info()->zone()->NewArray<Node*>(arity);  // XXX: alloca?
+  Node** all = info()->zone()->NewArray<Node*>(arity);
   for (int i = arity - 1; i >= 0; --i) {
     all[i] = environment()->Pop();
   }
=======================================
--- /branches/bleeding_edge/src/compiler/graph-builder.cc Tue Sep 2 11:28:40 2014 UTC +++ /branches/bleeding_edge/src/compiler/graph-builder.cc Wed Sep 3 13:23:37 2014 UTC
@@ -49,8 +49,7 @@
     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 @@

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::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);
=======================================
--- /branches/bleeding_edge/src/compiler/machine-node-factory.h Wed Sep 3 10:13:21 2014 UTC +++ /branches/bleeding_edge/src/compiler/machine-node-factory.h Wed Sep 3 13:23:37 2014 UTC
@@ -349,8 +349,7 @@
               MachineType* arg_types, Node** args, int n_args) {
     CallDescriptor* descriptor =
         Linkage::GetSimplifiedCDescriptor(ZONE(), MACHINE_SIG());
-    Node** passed_args =
-        static_cast<Node**>(alloca((n_args + 1) * sizeof(args[0])));
+    Node** passed_args = ZONE()->NewArray<Node*>(n_args + 1);
     passed_args[0] = function_address;
     for (int i = 0; i < n_args; ++i) {
       passed_args[i + 1] = args[i];
=======================================
--- /branches/bleeding_edge/src/compiler/structured-machine-assembler.cc Wed Sep 3 10:13:21 2014 UTC +++ /branches/bleeding_edge/src/compiler/structured-machine-assembler.cc Wed Sep 3 13:23:37 2014 UTC
@@ -213,8 +213,7 @@
   vars.reserve(n_vars);
   Node** scratch = NULL;
   size_t n_envs = environments->size();
-  Environment** live_environments = reinterpret_cast<Environment**>(
-      alloca(sizeof(environments->at(0)) * n_envs));
+  Environment** live_environments = zone()->NewArray<Environment*>(n_envs);
   size_t n_live = 0;
   for (size_t i = 0; i < n_envs; i++) {
     if (environments->at(i)->is_dead_) continue;
@@ -250,7 +249,7 @@
       CHECK(resolved != NULL);
       // Init scratch buffer.
       if (scratch == NULL) {
-        scratch = static_cast<Node**>(alloca(n_envs * sizeof(resolved)));
+        scratch = zone()->NewArray<Node*>(n_envs);
       }
       for (size_t k = 0; k < i; k++) {
         scratch[k] = resolved;

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to