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();
}
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) {
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);
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);
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];
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;
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;