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

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

Issue 544953006: Reland "Add handling for argument adaptor frames to inlining." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Reland fix: Add framestate to CollectStackTrace runtime call. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/instruction-selector-impl.h ('k') | src/compiler/js-inlining.h » ('j') | 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 "src/compiler/instruction-selector-unittest.h" 5 #include "src/compiler/instruction-selector-unittest.h"
6 6
7 #include "src/compiler/compiler-test-utils.h" 7 #include "src/compiler/compiler-test-utils.h"
8 #include "src/flags.h" 8 #include "src/flags.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 Node* function_node = m.Parameter(0); 297 Node* function_node = m.Parameter(0);
298 Node* receiver = m.Parameter(1); 298 Node* receiver = m.Parameter(1);
299 Node* context = m.Parameter(2); 299 Node* context = m.Parameter(2);
300 300
301 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(1)); 301 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(1));
302 Node* locals = m.NewNode(m.common()->StateValues(0)); 302 Node* locals = m.NewNode(m.common()->StateValues(0));
303 Node* stack = m.NewNode(m.common()->StateValues(0)); 303 Node* stack = m.NewNode(m.common()->StateValues(0));
304 Node* context_dummy = m.Int32Constant(0); 304 Node* context_dummy = m.Int32Constant(0);
305 305
306 Node* state_node = 306 Node* state_node = m.NewNode(
307 m.NewNode(m.common()->FrameState(bailout_id, kPushOutput), parameters, 307 m.common()->FrameState(JS_FRAME, bailout_id, kPushOutput), parameters,
308 locals, stack, context_dummy, m.UndefinedConstant()); 308 locals, stack, context_dummy, m.UndefinedConstant());
309 Node* call = m.CallJS0(function_node, receiver, context, state_node); 309 Node* call = m.CallJS0(function_node, receiver, context, state_node);
310 m.Return(call); 310 m.Return(call);
311 311
312 Stream s = m.Build(kAllExceptNopInstructions); 312 Stream s = m.Build(kAllExceptNopInstructions);
313 313
314 // Skip until kArchCallJSFunction. 314 // Skip until kArchCallJSFunction.
315 size_t index = 0; 315 size_t index = 0;
316 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction; 316 for (; index < s.size() && s[index]->arch_opcode() != kArchCallJSFunction;
317 index++) { 317 index++) {
318 } 318 }
(...skipping 18 matching lines...) Expand all
337 Node* receiver = m.Parameter(1); 337 Node* receiver = m.Parameter(1);
338 Node* context = m.Int32Constant(1); // Context is ignored. 338 Node* context = m.Int32Constant(1); // Context is ignored.
339 339
340 // Build frame state for the state before the call. 340 // Build frame state for the state before the call.
341 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(43)); 341 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(43));
342 Node* locals = m.NewNode(m.common()->StateValues(1), m.Int32Constant(44)); 342 Node* locals = m.NewNode(m.common()->StateValues(1), m.Int32Constant(44));
343 Node* stack = m.NewNode(m.common()->StateValues(1), m.Int32Constant(45)); 343 Node* stack = m.NewNode(m.common()->StateValues(1), m.Int32Constant(45));
344 344
345 Node* context_sentinel = m.Int32Constant(0); 345 Node* context_sentinel = m.Int32Constant(0);
346 Node* frame_state_before = m.NewNode( 346 Node* frame_state_before = m.NewNode(
347 m.common()->FrameState(bailout_id_before, kPushOutput), parameters, 347 m.common()->FrameState(JS_FRAME, bailout_id_before, kPushOutput),
348 locals, stack, context_sentinel, m.UndefinedConstant()); 348 parameters, locals, stack, context_sentinel, m.UndefinedConstant());
349 349
350 // Build the call. 350 // Build the call.
351 Node* call = m.CallFunctionStub0(function_node, receiver, context, 351 Node* call = m.CallFunctionStub0(function_node, receiver, context,
352 frame_state_before, CALL_AS_METHOD); 352 frame_state_before, CALL_AS_METHOD);
353 353
354 m.Return(call); 354 m.Return(call);
355 355
356 Stream s = m.Build(kAllExceptNopInstructions); 356 Stream s = m.Build(kAllExceptNopInstructions);
357 357
358 // Skip until kArchCallJSFunction. 358 // Skip until kArchCallJSFunction.
(...skipping 17 matching lines...) Expand all
376 376
377 // Code object. 377 // Code object.
378 EXPECT_TRUE(call_instr->InputAt(0)->IsImmediate()); 378 EXPECT_TRUE(call_instr->InputAt(0)->IsImmediate());
379 379
380 // Deoptimization id. 380 // Deoptimization id.
381 int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1)); 381 int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1));
382 FrameStateDescriptor* desc_before = 382 FrameStateDescriptor* desc_before =
383 s.GetFrameStateDescriptor(deopt_id_before); 383 s.GetFrameStateDescriptor(deopt_id_before);
384 EXPECT_EQ(bailout_id_before, desc_before->bailout_id()); 384 EXPECT_EQ(bailout_id_before, desc_before->bailout_id());
385 EXPECT_EQ(kPushOutput, desc_before->state_combine()); 385 EXPECT_EQ(kPushOutput, desc_before->state_combine());
386 EXPECT_EQ(1, desc_before->parameters_count()); 386 EXPECT_EQ(1u, desc_before->parameters_count());
387 EXPECT_EQ(1, desc_before->locals_count()); 387 EXPECT_EQ(1u, desc_before->locals_count());
388 EXPECT_EQ(1, desc_before->stack_count()); 388 EXPECT_EQ(1u, desc_before->stack_count());
389 EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(2))); 389 EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(2)));
390 EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(3))); 390 EXPECT_EQ(0, s.ToInt32(call_instr->InputAt(3)));
391 EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(4))); 391 EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(4)));
392 EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(5))); 392 EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(5)));
393 393
394 // Function. 394 // Function.
395 EXPECT_EQ(function_node->id(), s.ToVreg(call_instr->InputAt(6))); 395 EXPECT_EQ(function_node->id(), s.ToVreg(call_instr->InputAt(6)));
396 // Context. 396 // Context.
397 EXPECT_EQ(context->id(), s.ToVreg(call_instr->InputAt(7))); 397 EXPECT_EQ(context->id(), s.ToVreg(call_instr->InputAt(7)));
398 398
(...skipping 13 matching lines...) Expand all
412 412
413 // Some arguments for the call node. 413 // Some arguments for the call node.
414 Node* function_node = m.Parameter(0); 414 Node* function_node = m.Parameter(0);
415 Node* receiver = m.Parameter(1); 415 Node* receiver = m.Parameter(1);
416 Node* context = m.Int32Constant(66); 416 Node* context = m.Int32Constant(66);
417 417
418 // Build frame state for the state before the call. 418 // Build frame state for the state before the call.
419 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(63)); 419 Node* parameters = m.NewNode(m.common()->StateValues(1), m.Int32Constant(63));
420 Node* locals = m.NewNode(m.common()->StateValues(1), m.Int32Constant(64)); 420 Node* locals = m.NewNode(m.common()->StateValues(1), m.Int32Constant(64));
421 Node* stack = m.NewNode(m.common()->StateValues(1), m.Int32Constant(65)); 421 Node* stack = m.NewNode(m.common()->StateValues(1), m.Int32Constant(65));
422 Node* frame_state_parent = 422 Node* frame_state_parent = m.NewNode(
423 m.NewNode(m.common()->FrameState(bailout_id_parent, kIgnoreOutput), 423 m.common()->FrameState(JS_FRAME, bailout_id_parent, kIgnoreOutput),
424 parameters, locals, stack, context, m.UndefinedConstant()); 424 parameters, locals, stack, context, m.UndefinedConstant());
425 425
426 Node* context2 = m.Int32Constant(46); 426 Node* context2 = m.Int32Constant(46);
427 Node* parameters2 = 427 Node* parameters2 =
428 m.NewNode(m.common()->StateValues(1), m.Int32Constant(43)); 428 m.NewNode(m.common()->StateValues(1), m.Int32Constant(43));
429 Node* locals2 = m.NewNode(m.common()->StateValues(1), m.Int32Constant(44)); 429 Node* locals2 = m.NewNode(m.common()->StateValues(1), m.Int32Constant(44));
430 Node* stack2 = m.NewNode(m.common()->StateValues(1), m.Int32Constant(45)); 430 Node* stack2 = m.NewNode(m.common()->StateValues(1), m.Int32Constant(45));
431 Node* frame_state_before = 431 Node* frame_state_before = m.NewNode(
432 m.NewNode(m.common()->FrameState(bailout_id_before, kPushOutput), 432 m.common()->FrameState(JS_FRAME, bailout_id_before, kPushOutput),
433 parameters2, locals2, stack2, context2, frame_state_parent); 433 parameters2, locals2, stack2, context2, frame_state_parent);
434 434
435 // Build the call. 435 // Build the call.
436 Node* call = m.CallFunctionStub0(function_node, receiver, context2, 436 Node* call = m.CallFunctionStub0(function_node, receiver, context2,
437 frame_state_before, CALL_AS_METHOD); 437 frame_state_before, CALL_AS_METHOD);
438 438
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.
(...skipping 16 matching lines...) Expand all
460 1; // Context. 460 1; // Context.
461 EXPECT_EQ(num_operands, call_instr->InputCount()); 461 EXPECT_EQ(num_operands, call_instr->InputCount());
462 // Code object. 462 // Code object.
463 EXPECT_TRUE(call_instr->InputAt(0)->IsImmediate()); 463 EXPECT_TRUE(call_instr->InputAt(0)->IsImmediate());
464 464
465 // Deoptimization id. 465 // Deoptimization id.
466 int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1)); 466 int32_t deopt_id_before = s.ToInt32(call_instr->InputAt(1));
467 FrameStateDescriptor* desc_before = 467 FrameStateDescriptor* desc_before =
468 s.GetFrameStateDescriptor(deopt_id_before); 468 s.GetFrameStateDescriptor(deopt_id_before);
469 EXPECT_EQ(bailout_id_before, desc_before->bailout_id()); 469 EXPECT_EQ(bailout_id_before, desc_before->bailout_id());
470 EXPECT_EQ(1, desc_before->parameters_count()); 470 EXPECT_EQ(1u, desc_before->parameters_count());
471 EXPECT_EQ(1, desc_before->locals_count()); 471 EXPECT_EQ(1u, desc_before->locals_count());
472 EXPECT_EQ(1, desc_before->stack_count()); 472 EXPECT_EQ(1u, desc_before->stack_count());
473 EXPECT_EQ(63, s.ToInt32(call_instr->InputAt(2))); 473 EXPECT_EQ(63, s.ToInt32(call_instr->InputAt(2)));
474 // Context: 474 // Context:
475 EXPECT_EQ(66, s.ToInt32(call_instr->InputAt(3))); 475 EXPECT_EQ(66, s.ToInt32(call_instr->InputAt(3)));
476 EXPECT_EQ(64, s.ToInt32(call_instr->InputAt(4))); 476 EXPECT_EQ(64, s.ToInt32(call_instr->InputAt(4)));
477 EXPECT_EQ(65, s.ToInt32(call_instr->InputAt(5))); 477 EXPECT_EQ(65, s.ToInt32(call_instr->InputAt(5)));
478 // Values from parent environment should follow. 478 // Values from parent environment should follow.
479 EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(6))); 479 EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(6)));
480 EXPECT_EQ(46, s.ToInt32(call_instr->InputAt(7))); 480 EXPECT_EQ(46, s.ToInt32(call_instr->InputAt(7)));
481 EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(8))); 481 EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(8)));
482 EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(9))); 482 EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(9)));
483 483
484 // Function. 484 // Function.
485 EXPECT_EQ(function_node->id(), s.ToVreg(call_instr->InputAt(10))); 485 EXPECT_EQ(function_node->id(), s.ToVreg(call_instr->InputAt(10)));
486 // Context. 486 // Context.
487 EXPECT_EQ(context2->id(), s.ToVreg(call_instr->InputAt(11))); 487 EXPECT_EQ(context2->id(), s.ToVreg(call_instr->InputAt(11)));
488 // Continuation. 488 // Continuation.
489 489
490 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); 490 EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
491 EXPECT_EQ(index, s.size()); 491 EXPECT_EQ(index, s.size());
492 } 492 }
493 493
494 } // namespace compiler 494 } // namespace compiler
495 } // namespace internal 495 } // namespace internal
496 } // namespace v8 496 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector-impl.h ('k') | src/compiler/js-inlining.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698