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

Side by Side Diff: test/unittests/compiler/instruction-selector-unittest.cc

Issue 2586903002: [turbofan] Avoid allocation of temporary array of Nodes when generating calls. (Closed)
Patch Set: Created 4 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 | « test/cctest/compiler/test-run-native-calls.cc ('k') | 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "test/unittests/compiler/instruction-selector-unittest.h" 5 #include "test/unittests/compiler/instruction-selector-unittest.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/compiler-source-position-table.h" 8 #include "src/compiler/compiler-source-position-table.h"
9 #include "src/compiler/graph.h" 9 #include "src/compiler/graph.h"
10 #include "src/compiler/schedule.h" 10 #include "src/compiler/schedule.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 Node* locals = m.AddNode(m.common()->TypedStateValues(&empty_types)); 369 Node* locals = m.AddNode(m.common()->TypedStateValues(&empty_types));
370 Node* stack = m.AddNode(m.common()->TypedStateValues(&empty_types)); 370 Node* stack = m.AddNode(m.common()->TypedStateValues(&empty_types));
371 Node* context_sentinel = m.Int32Constant(0); 371 Node* context_sentinel = m.Int32Constant(0);
372 Node* state_node = m.AddNode( 372 Node* state_node = m.AddNode(
373 m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(), 373 m.common()->FrameState(bailout_id, OutputFrameStateCombine::Push(),
374 m.GetFrameStateFunctionInfo(1, 0)), 374 m.GetFrameStateFunctionInfo(1, 0)),
375 parameters, locals, stack, context_sentinel, function_node, 375 parameters, locals, stack, context_sentinel, function_node,
376 m.UndefinedConstant()); 376 m.UndefinedConstant());
377 377
378 // Build the call. 378 // Build the call.
379 Node* args[] = {receiver, m.UndefinedConstant(), m.Int32Constant(1), context}; 379 Node* nodes[] = {function_node, receiver, m.UndefinedConstant(),
380 Node* call = 380 m.Int32Constant(1), context, state_node};
381 m.CallNWithFrameState(descriptor, function_node, args, state_node); 381 Node* call = m.CallNWithFrameState(descriptor, arraysize(nodes), nodes);
382 m.Return(call); 382 m.Return(call);
383 383
384 Stream s = m.Build(kAllExceptNopInstructions); 384 Stream s = m.Build(kAllExceptNopInstructions);
385 385
386 // Skip until kArchCallJSFunction. 386 // Skip until kArchCallJSFunction.
387 size_t index = 0; 387 size_t index = 0;
388 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction; 388 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction;
389 index++) { 389 index++) {
390 } 390 }
391 // Now we should have two instructions: call and return. 391 // Now we should have two instructions: call and return.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 Node* stack = m.AddNode(m.common()->TypedStateValues(&tagged_type), 426 Node* stack = m.AddNode(m.common()->TypedStateValues(&tagged_type),
427 m.UndefinedConstant()); 427 m.UndefinedConstant());
428 Node* context_sentinel = m.Int32Constant(0); 428 Node* context_sentinel = m.Int32Constant(0);
429 Node* state_node = m.AddNode( 429 Node* state_node = m.AddNode(
430 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), 430 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(),
431 m.GetFrameStateFunctionInfo(1, 1)), 431 m.GetFrameStateFunctionInfo(1, 1)),
432 parameters, locals, stack, context_sentinel, function_node, 432 parameters, locals, stack, context_sentinel, function_node,
433 m.UndefinedConstant()); 433 m.UndefinedConstant());
434 434
435 // Build the call. 435 // Build the call.
436 Node* args[] = {function_node, receiver, context};
437 Node* stub_code = m.HeapConstant(callable.code()); 436 Node* stub_code = m.HeapConstant(callable.code());
438 Node* call = m.CallNWithFrameState(descriptor, stub_code, args, state_node); 437 Node* nodes[] = {stub_code, function_node, receiver, context, state_node};
438 Node* call = m.CallNWithFrameState(descriptor, arraysize(nodes), nodes);
439 m.Return(call); 439 m.Return(call);
440 440
441 Stream s = m.Build(kAllExceptNopInstructions); 441 Stream s = m.Build(kAllExceptNopInstructions);
442 442
443 // Skip until kArchCallJSFunction. 443 // Skip until kArchCallJSFunction.
444 size_t index = 0; 444 size_t index = 0;
445 for (; index < s.size() && s[index]->arch_opcode() != kArchCallCodeObject; 445 for (; index < s.size() && s[index]->arch_opcode() != kArchCallCodeObject;
446 index++) { 446 index++) {
447 } 447 }
448 // Now we should have two instructions: call, return. 448 // Now we should have two instructions: call, return.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 m.Float64Constant(0.25)); 530 m.Float64Constant(0.25));
531 Node* stack2 = m.AddNode(m.common()->TypedStateValues(&int32x2_type), 531 Node* stack2 = m.AddNode(m.common()->TypedStateValues(&int32x2_type),
532 m.Int32Constant(44), m.Int32Constant(45)); 532 m.Int32Constant(44), m.Int32Constant(45));
533 Node* state_node = m.AddNode( 533 Node* state_node = m.AddNode(
534 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(), 534 m.common()->FrameState(bailout_id_before, OutputFrameStateCombine::Push(),
535 m.GetFrameStateFunctionInfo(1, 1)), 535 m.GetFrameStateFunctionInfo(1, 1)),
536 parameters2, locals2, stack2, context2, function_node, 536 parameters2, locals2, stack2, context2, function_node,
537 frame_state_parent); 537 frame_state_parent);
538 538
539 // Build the call. 539 // Build the call.
540 Node* args[] = {function_node, receiver, context2};
541 Node* stub_code = m.HeapConstant(callable.code()); 540 Node* stub_code = m.HeapConstant(callable.code());
542 Node* call = m.CallNWithFrameState(descriptor, stub_code, args, state_node); 541 Node* nodes[] = {stub_code, function_node, receiver, context2, state_node};
542 Node* call = m.CallNWithFrameState(descriptor, arraysize(nodes), nodes);
543 m.Return(call); 543 m.Return(call);
544 544
545 Stream s = m.Build(kAllExceptNopInstructions); 545 Stream s = m.Build(kAllExceptNopInstructions);
546 546
547 // Skip until kArchCallJSFunction. 547 // Skip until kArchCallJSFunction.
548 size_t index = 0; 548 size_t index = 0;
549 for (; index < s.size() && s[index]->arch_opcode() != kArchCallCodeObject; 549 for (; index < s.size() && s[index]->arch_opcode() != kArchCallCodeObject;
550 index++) { 550 index++) {
551 } 551 }
552 // Now we should have three instructions: call, return. 552 // Now we should have three instructions: call, return.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); 597 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14)));
598 // Continuation. 598 // Continuation.
599 599
600 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); 600 EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
601 EXPECT_EQ(index, s.size()); 601 EXPECT_EQ(index, s.size());
602 } 602 }
603 603
604 } // namespace compiler 604 } // namespace compiler
605 } // namespace internal 605 } // namespace internal
606 } // namespace v8 606 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-native-calls.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698