Remove usages of alloca() according to style guide.

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/535133002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23657 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7540c6ce
...@@ -1652,7 +1652,7 @@ void AstGraphBuilder::VisitLogicalExpression(BinaryOperation* expr) { ...@@ -1652,7 +1652,7 @@ void AstGraphBuilder::VisitLogicalExpression(BinaryOperation* expr) {
Node* AstGraphBuilder::ProcessArguments(Operator* op, int arity) { Node* AstGraphBuilder::ProcessArguments(Operator* op, int arity) {
DCHECK(environment()->stack_height() >= 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) { for (int i = arity - 1; i >= 0; --i) {
all[i] = environment()->Pop(); all[i] = environment()->Pop();
} }
......
...@@ -49,8 +49,7 @@ Node* StructuredGraphBuilder::MakeNode(Operator* op, int value_input_count, ...@@ -49,8 +49,7 @@ Node* StructuredGraphBuilder::MakeNode(Operator* op, int value_input_count,
if (has_framestate) ++input_count_with_deps; if (has_framestate) ++input_count_with_deps;
if (has_control) ++input_count_with_deps; if (has_control) ++input_count_with_deps;
if (has_effect) ++input_count_with_deps; if (has_effect) ++input_count_with_deps;
void* raw_buffer = alloca(kPointerSize * input_count_with_deps); Node** buffer = zone()->NewArray<Node*>(input_count_with_deps);
Node** buffer = reinterpret_cast<Node**>(raw_buffer);
memcpy(buffer, value_inputs, kPointerSize * value_input_count); memcpy(buffer, value_inputs, kPointerSize * value_input_count);
Node** current_input = buffer + value_input_count; Node** current_input = buffer + value_input_count;
if (has_context) { if (has_context) {
...@@ -163,8 +162,7 @@ void StructuredGraphBuilder::Environment::PrepareForLoop() { ...@@ -163,8 +162,7 @@ void StructuredGraphBuilder::Environment::PrepareForLoop() {
Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) { Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) {
Operator* phi_op = common()->Phi(count); Operator* phi_op = common()->Phi(count);
void* raw_buffer = alloca(kPointerSize * (count + 1)); Node** buffer = zone()->NewArray<Node*>(count + 1);
Node** buffer = reinterpret_cast<Node**>(raw_buffer);
MemsetPointer(buffer, input, count); MemsetPointer(buffer, input, count);
buffer[count] = control; buffer[count] = control;
return graph()->NewNode(phi_op, count + 1, buffer); return graph()->NewNode(phi_op, count + 1, buffer);
...@@ -175,8 +173,7 @@ Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) { ...@@ -175,8 +173,7 @@ Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) {
Node* StructuredGraphBuilder::NewEffectPhi(int count, Node* input, Node* StructuredGraphBuilder::NewEffectPhi(int count, Node* input,
Node* control) { Node* control) {
Operator* phi_op = common()->EffectPhi(count); Operator* phi_op = common()->EffectPhi(count);
void* raw_buffer = alloca(kPointerSize * (count + 1)); Node** buffer = zone()->NewArray<Node*>(count + 1);
Node** buffer = reinterpret_cast<Node**>(raw_buffer);
MemsetPointer(buffer, input, count); MemsetPointer(buffer, input, count);
buffer[count] = control; buffer[count] = control;
return graph()->NewNode(phi_op, count + 1, buffer); return graph()->NewNode(phi_op, count + 1, buffer);
......
...@@ -349,8 +349,7 @@ class MachineNodeFactory { ...@@ -349,8 +349,7 @@ class MachineNodeFactory {
MachineType* arg_types, Node** args, int n_args) { MachineType* arg_types, Node** args, int n_args) {
CallDescriptor* descriptor = CallDescriptor* descriptor =
Linkage::GetSimplifiedCDescriptor(ZONE(), MACHINE_SIG()); Linkage::GetSimplifiedCDescriptor(ZONE(), MACHINE_SIG());
Node** passed_args = Node** passed_args = ZONE()->NewArray<Node*>(n_args + 1);
static_cast<Node**>(alloca((n_args + 1) * sizeof(args[0])));
passed_args[0] = function_address; passed_args[0] = function_address;
for (int i = 0; i < n_args; ++i) { for (int i = 0; i < n_args; ++i) {
passed_args[i + 1] = args[i]; passed_args[i + 1] = args[i];
......
...@@ -213,8 +213,7 @@ void StructuredMachineAssembler::Merge(EnvironmentVector* environments, ...@@ -213,8 +213,7 @@ void StructuredMachineAssembler::Merge(EnvironmentVector* environments,
vars.reserve(n_vars); vars.reserve(n_vars);
Node** scratch = NULL; Node** scratch = NULL;
size_t n_envs = environments->size(); size_t n_envs = environments->size();
Environment** live_environments = reinterpret_cast<Environment**>( Environment** live_environments = zone()->NewArray<Environment*>(n_envs);
alloca(sizeof(environments->at(0)) * n_envs));
size_t n_live = 0; size_t n_live = 0;
for (size_t i = 0; i < n_envs; i++) { for (size_t i = 0; i < n_envs; i++) {
if (environments->at(i)->is_dead_) continue; if (environments->at(i)->is_dead_) continue;
...@@ -250,7 +249,7 @@ void StructuredMachineAssembler::Merge(EnvironmentVector* environments, ...@@ -250,7 +249,7 @@ void StructuredMachineAssembler::Merge(EnvironmentVector* environments,
CHECK(resolved != NULL); CHECK(resolved != NULL);
// Init scratch buffer. // Init scratch buffer.
if (scratch == NULL) { 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++) { for (size_t k = 0; k < i; k++) {
scratch[k] = resolved; scratch[k] = resolved;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment