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

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1985753002: [interpreter] Introduce fused bytecodes for common sequences. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 years, 7 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/interpreter.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 8
9 #include "src/ast/prettyprinter.h" 9 #include "src/ast/prettyprinter.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // LdaSmi <imm> 282 // LdaSmi <imm>
283 // 283 //
284 // Load an integer literal into the accumulator as a Smi. 284 // Load an integer literal into the accumulator as a Smi.
285 void Interpreter::DoLdaSmi(InterpreterAssembler* assembler) { 285 void Interpreter::DoLdaSmi(InterpreterAssembler* assembler) {
286 Node* raw_int = __ BytecodeOperandImm(0); 286 Node* raw_int = __ BytecodeOperandImm(0);
287 Node* smi_int = __ SmiTag(raw_int); 287 Node* smi_int = __ SmiTag(raw_int);
288 __ SetAccumulator(smi_int); 288 __ SetAccumulator(smi_int);
289 __ Dispatch(); 289 __ Dispatch();
290 } 290 }
291 291
292 void Interpreter::DoLoadConstant(InterpreterAssembler* assembler) {
293 Node* index = __ BytecodeOperandIdx(0);
294 Node* constant = __ LoadConstantPoolEntry(index);
295 __ SetAccumulator(constant);
296 __ Dispatch();
297 }
298
299 // LdaConstant <idx> 292 // LdaConstant <idx>
300 // 293 //
301 // Load constant literal at |idx| in the constant pool into the accumulator. 294 // Load constant literal at |idx| in the constant pool into the accumulator.
302 void Interpreter::DoLdaConstant(InterpreterAssembler* assembler) { 295 void Interpreter::DoLdaConstant(InterpreterAssembler* assembler) {
303 DoLoadConstant(assembler); 296 Node* index = __ BytecodeOperandIdx(0);
297 Node* constant = __ LoadConstantPoolEntry(index);
298 __ SetAccumulator(constant);
299 __ Dispatch();
304 } 300 }
305 301
306 // LdaUndefined 302 // LdaUndefined
307 // 303 //
308 // Load Undefined into the accumulator. 304 // Load Undefined into the accumulator.
309 void Interpreter::DoLdaUndefined(InterpreterAssembler* assembler) { 305 void Interpreter::DoLdaUndefined(InterpreterAssembler* assembler) {
310 Node* undefined_value = 306 Node* undefined_value =
311 __ HeapConstant(isolate_->factory()->undefined_value()); 307 __ HeapConstant(isolate_->factory()->undefined_value());
312 __ SetAccumulator(undefined_value); 308 __ SetAccumulator(undefined_value);
313 __ Dispatch(); 309 __ Dispatch();
314 } 310 }
315 311
312 // LdrUndefined <reg>
313 //
314 // Loads undefined into the accumulator and |reg|.
315 void Interpreter::DoLdrUndefined(InterpreterAssembler* assembler) {
316 Node* undefined_value =
317 __ HeapConstant(isolate_->factory()->undefined_value());
318 Node* destination = __ BytecodeOperandReg(0);
319 __ StoreRegister(undefined_value, destination);
320 __ Dispatch();
321 }
322
316 // LdaNull 323 // LdaNull
317 // 324 //
318 // Load Null into the accumulator. 325 // Load Null into the accumulator.
319 void Interpreter::DoLdaNull(InterpreterAssembler* assembler) { 326 void Interpreter::DoLdaNull(InterpreterAssembler* assembler) {
320 Node* null_value = __ HeapConstant(isolate_->factory()->null_value()); 327 Node* null_value = __ HeapConstant(isolate_->factory()->null_value());
321 __ SetAccumulator(null_value); 328 __ SetAccumulator(null_value);
322 __ Dispatch(); 329 __ Dispatch();
323 } 330 }
324 331
325 // LdaTheHole 332 // LdaTheHole
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // 380 //
374 // Stores the value of register <src> to register <dst>. 381 // Stores the value of register <src> to register <dst>.
375 void Interpreter::DoMov(InterpreterAssembler* assembler) { 382 void Interpreter::DoMov(InterpreterAssembler* assembler) {
376 Node* src_index = __ BytecodeOperandReg(0); 383 Node* src_index = __ BytecodeOperandReg(0);
377 Node* src_value = __ LoadRegister(src_index); 384 Node* src_value = __ LoadRegister(src_index);
378 Node* dst_index = __ BytecodeOperandReg(1); 385 Node* dst_index = __ BytecodeOperandReg(1);
379 __ StoreRegister(src_value, dst_index); 386 __ StoreRegister(src_value, dst_index);
380 __ Dispatch(); 387 __ Dispatch();
381 } 388 }
382 389
383 void Interpreter::DoLoadGlobal(Callable ic, InterpreterAssembler* assembler) { 390 Node* Interpreter::BuildLoadGlobal(Callable ic,
391 InterpreterAssembler* assembler) {
384 // Get the global object. 392 // Get the global object.
385 Node* context = __ GetContext(); 393 Node* context = __ GetContext();
386 Node* native_context = 394 Node* native_context =
387 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); 395 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX);
388 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); 396 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX);
389 397
390 // Load the global via the LoadIC. 398 // Load the global via the LoadIC.
391 Node* code_target = __ HeapConstant(ic.code()); 399 Node* code_target = __ HeapConstant(ic.code());
392 Node* constant_index = __ BytecodeOperandIdx(0); 400 Node* constant_index = __ BytecodeOperandIdx(0);
393 Node* name = __ LoadConstantPoolEntry(constant_index); 401 Node* name = __ LoadConstantPoolEntry(constant_index);
394 Node* raw_slot = __ BytecodeOperandIdx(1); 402 Node* raw_slot = __ BytecodeOperandIdx(1);
395 Node* smi_slot = __ SmiTag(raw_slot); 403 Node* smi_slot = __ SmiTag(raw_slot);
396 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 404 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
397 Node* result = __ CallStub(ic.descriptor(), code_target, context, global, 405 return __ CallStub(ic.descriptor(), code_target, context, global, name,
398 name, smi_slot, type_feedback_vector); 406 smi_slot, type_feedback_vector);
399 __ SetAccumulator(result);
400 __ Dispatch();
401 } 407 }
402 408
403 // LdaGlobal <name_index> <slot> 409 // LdaGlobal <name_index> <slot>
404 // 410 //
405 // Load the global with name in constant pool entry <name_index> into the 411 // Load the global with name in constant pool entry <name_index> into the
406 // accumulator using FeedBackVector slot <slot> outside of a typeof. 412 // accumulator using FeedBackVector slot <slot> outside of a typeof.
407 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { 413 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) {
408 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, 414 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
409 UNINITIALIZED); 415 UNINITIALIZED);
410 DoLoadGlobal(ic, assembler); 416 Node* result = BuildLoadGlobal(ic, assembler);
417 __ SetAccumulator(result);
418 __ Dispatch();
419 }
420
421 // LdrGlobal <name_index> <slot> <reg>
422 //
423 // Load the global with name in constant pool entry <name_index> into
424 // register <reg> using FeedBackVector slot <slot> outside of a typeof.
425 void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) {
426 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
427 UNINITIALIZED);
428 Node* result = BuildLoadGlobal(ic, assembler);
429 Node* destination = __ BytecodeOperandReg(2);
430 __ StoreRegister(result, destination);
431 __ Dispatch();
411 } 432 }
412 433
413 // LdaGlobalInsideTypeof <name_index> <slot> 434 // LdaGlobalInsideTypeof <name_index> <slot>
414 // 435 //
415 // Load the global with name in constant pool entry <name_index> into the 436 // Load the global with name in constant pool entry <name_index> into the
416 // accumulator using FeedBackVector slot <slot> inside of a typeof. 437 // accumulator using FeedBackVector slot <slot> inside of a typeof.
417 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { 438 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) {
418 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, 439 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF,
419 UNINITIALIZED); 440 UNINITIALIZED);
420 DoLoadGlobal(ic, assembler); 441 Node* result = BuildLoadGlobal(ic, assembler);
442 __ SetAccumulator(result);
443 __ Dispatch();
421 } 444 }
422 445
423 void Interpreter::DoStoreGlobal(Callable ic, InterpreterAssembler* assembler) { 446 void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) {
424 // Get the global object. 447 // Get the global object.
425 Node* context = __ GetContext(); 448 Node* context = __ GetContext();
426 Node* native_context = 449 Node* native_context =
427 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); 450 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX);
428 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); 451 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX);
429 452
430 // Store the global via the StoreIC. 453 // Store the global via the StoreIC.
431 Node* code_target = __ HeapConstant(ic.code()); 454 Node* code_target = __ HeapConstant(ic.code());
432 Node* constant_index = __ BytecodeOperandIdx(0); 455 Node* constant_index = __ BytecodeOperandIdx(0);
433 Node* name = __ LoadConstantPoolEntry(constant_index); 456 Node* name = __ LoadConstantPoolEntry(constant_index);
434 Node* value = __ GetAccumulator(); 457 Node* value = __ GetAccumulator();
435 Node* raw_slot = __ BytecodeOperandIdx(1); 458 Node* raw_slot = __ BytecodeOperandIdx(1);
436 Node* smi_slot = __ SmiTag(raw_slot); 459 Node* smi_slot = __ SmiTag(raw_slot);
437 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 460 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
438 __ CallStub(ic.descriptor(), code_target, context, global, name, value, 461 __ CallStub(ic.descriptor(), code_target, context, global, name, value,
439 smi_slot, type_feedback_vector); 462 smi_slot, type_feedback_vector);
440 __ Dispatch(); 463 __ Dispatch();
441 } 464 }
442 465
443 // StaGlobalSloppy <name_index> <slot> 466 // StaGlobalSloppy <name_index> <slot>
444 // 467 //
445 // Store the value in the accumulator into the global with name in constant pool 468 // Store the value in the accumulator into the global with name in constant pool
446 // entry <name_index> using FeedBackVector slot <slot> in sloppy mode. 469 // entry <name_index> using FeedBackVector slot <slot> in sloppy mode.
447 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { 470 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) {
448 Callable ic = 471 Callable ic =
449 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); 472 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
450 DoStoreGlobal(ic, assembler); 473 DoStaGlobal(ic, assembler);
451 } 474 }
452 475
453 // StaGlobalStrict <name_index> <slot> 476 // StaGlobalStrict <name_index> <slot>
454 // 477 //
455 // Store the value in the accumulator into the global with name in constant pool 478 // Store the value in the accumulator into the global with name in constant pool
456 // entry <name_index> using FeedBackVector slot <slot> in strict mode. 479 // entry <name_index> using FeedBackVector slot <slot> in strict mode.
457 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { 480 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) {
458 Callable ic = 481 Callable ic =
459 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); 482 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
460 DoStoreGlobal(ic, assembler); 483 DoStaGlobal(ic, assembler);
484 }
485
486 compiler::Node* Interpreter::BuildLoadContextSlot(
487 InterpreterAssembler* assembler) {
488 Node* reg_index = __ BytecodeOperandReg(0);
489 Node* context = __ LoadRegister(reg_index);
490 Node* slot_index = __ BytecodeOperandIdx(1);
491 return __ LoadContextSlot(context, slot_index);
461 } 492 }
462 493
463 // LdaContextSlot <context> <slot_index> 494 // LdaContextSlot <context> <slot_index>
464 // 495 //
465 // Load the object in |slot_index| of |context| into the accumulator. 496 // Load the object in |slot_index| of |context| into the accumulator.
466 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { 497 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) {
467 Node* reg_index = __ BytecodeOperandReg(0); 498 Node* result = BuildLoadContextSlot(assembler);
468 Node* context = __ LoadRegister(reg_index);
469 Node* slot_index = __ BytecodeOperandIdx(1);
470 Node* result = __ LoadContextSlot(context, slot_index);
471 __ SetAccumulator(result); 499 __ SetAccumulator(result);
472 __ Dispatch(); 500 __ Dispatch();
473 } 501 }
474 502
503 // LdrContextSlot <context> <slot_index> <reg>
504 //
505 // Load the object in <slot_index> of <context> into register <reg>.
506 void Interpreter::DoLdrContextSlot(InterpreterAssembler* assembler) {
507 Node* result = BuildLoadContextSlot(assembler);
508 Node* destination = __ BytecodeOperandReg(2);
509 __ StoreRegister(result, destination);
510 __ Dispatch();
511 }
512
475 // StaContextSlot <context> <slot_index> 513 // StaContextSlot <context> <slot_index>
476 // 514 //
477 // Stores the object in the accumulator into |slot_index| of |context|. 515 // Stores the object in the accumulator into |slot_index| of |context|.
478 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { 516 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) {
479 Node* value = __ GetAccumulator(); 517 Node* value = __ GetAccumulator();
480 Node* reg_index = __ BytecodeOperandReg(0); 518 Node* reg_index = __ BytecodeOperandReg(0);
481 Node* context = __ LoadRegister(reg_index); 519 Node* context = __ LoadRegister(reg_index);
482 Node* slot_index = __ BytecodeOperandIdx(1); 520 Node* slot_index = __ BytecodeOperandIdx(1);
483 __ StoreContextSlot(context, slot_index, value); 521 __ StoreContextSlot(context, slot_index, value);
484 __ Dispatch(); 522 __ Dispatch();
485 } 523 }
486 524
487 void Interpreter::DoLoadLookupSlot(Runtime::FunctionId function_id, 525 void Interpreter::DoLdaLookupSlot(Runtime::FunctionId function_id,
488 InterpreterAssembler* assembler) { 526 InterpreterAssembler* assembler) {
489 Node* index = __ BytecodeOperandIdx(0); 527 Node* index = __ BytecodeOperandIdx(0);
490 Node* name = __ LoadConstantPoolEntry(index); 528 Node* name = __ LoadConstantPoolEntry(index);
491 Node* context = __ GetContext(); 529 Node* context = __ GetContext();
492 Node* result = __ CallRuntime(function_id, context, name); 530 Node* result = __ CallRuntime(function_id, context, name);
493 __ SetAccumulator(result); 531 __ SetAccumulator(result);
494 __ Dispatch(); 532 __ Dispatch();
495 } 533 }
496 534
497 // LdaLookupSlot <name_index> 535 // LdaLookupSlot <name_index>
498 // 536 //
499 // Lookup the object with the name in constant pool entry |name_index| 537 // Lookup the object with the name in constant pool entry |name_index|
500 // dynamically. 538 // dynamically.
501 void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) { 539 void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) {
502 DoLoadLookupSlot(Runtime::kLoadLookupSlot, assembler); 540 DoLdaLookupSlot(Runtime::kLoadLookupSlot, assembler);
503 } 541 }
504 542
505 // LdaLookupSlotInsideTypeof <name_index> 543 // LdaLookupSlotInsideTypeof <name_index>
506 // 544 //
507 // Lookup the object with the name in constant pool entry |name_index| 545 // Lookup the object with the name in constant pool entry |name_index|
508 // dynamically without causing a NoReferenceError. 546 // dynamically without causing a NoReferenceError.
509 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) { 547 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) {
510 DoLoadLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler); 548 DoLdaLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler);
511 } 549 }
512 550
513 void Interpreter::DoStoreLookupSlot(LanguageMode language_mode, 551 void Interpreter::DoStaLookupSlot(LanguageMode language_mode,
514 InterpreterAssembler* assembler) { 552 InterpreterAssembler* assembler) {
515 Node* value = __ GetAccumulator(); 553 Node* value = __ GetAccumulator();
516 Node* index = __ BytecodeOperandIdx(0); 554 Node* index = __ BytecodeOperandIdx(0);
517 Node* name = __ LoadConstantPoolEntry(index); 555 Node* name = __ LoadConstantPoolEntry(index);
518 Node* context = __ GetContext(); 556 Node* context = __ GetContext();
519 Node* result = __ CallRuntime(is_strict(language_mode) 557 Node* result = __ CallRuntime(is_strict(language_mode)
520 ? Runtime::kStoreLookupSlot_Strict 558 ? Runtime::kStoreLookupSlot_Strict
521 : Runtime::kStoreLookupSlot_Sloppy, 559 : Runtime::kStoreLookupSlot_Sloppy,
522 context, name, value); 560 context, name, value);
523 __ SetAccumulator(result); 561 __ SetAccumulator(result);
524 __ Dispatch(); 562 __ Dispatch();
525 } 563 }
526 564
527 // StaLookupSlotSloppy <name_index> 565 // StaLookupSlotSloppy <name_index>
528 // 566 //
529 // Store the object in accumulator to the object with the name in constant 567 // Store the object in accumulator to the object with the name in constant
530 // pool entry |name_index| in sloppy mode. 568 // pool entry |name_index| in sloppy mode.
531 void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) { 569 void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) {
532 DoStoreLookupSlot(LanguageMode::SLOPPY, assembler); 570 DoStaLookupSlot(LanguageMode::SLOPPY, assembler);
533 } 571 }
534 572
535 // StaLookupSlotStrict <name_index> 573 // StaLookupSlotStrict <name_index>
536 // 574 //
537 // Store the object in accumulator to the object with the name in constant 575 // Store the object in accumulator to the object with the name in constant
538 // pool entry |name_index| in strict mode. 576 // pool entry |name_index| in strict mode.
539 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { 577 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) {
540 DoStoreLookupSlot(LanguageMode::STRICT, assembler); 578 DoStaLookupSlot(LanguageMode::STRICT, assembler);
541 } 579 }
542 580
543 void Interpreter::DoLoadIC(Callable ic, InterpreterAssembler* assembler) { 581 Node* Interpreter::BuildLoadNamedProperty(Callable ic,
582 InterpreterAssembler* assembler) {
544 Node* code_target = __ HeapConstant(ic.code()); 583 Node* code_target = __ HeapConstant(ic.code());
545 Node* register_index = __ BytecodeOperandReg(0); 584 Node* register_index = __ BytecodeOperandReg(0);
546 Node* object = __ LoadRegister(register_index); 585 Node* object = __ LoadRegister(register_index);
547 Node* constant_index = __ BytecodeOperandIdx(1); 586 Node* constant_index = __ BytecodeOperandIdx(1);
548 Node* name = __ LoadConstantPoolEntry(constant_index); 587 Node* name = __ LoadConstantPoolEntry(constant_index);
549 Node* raw_slot = __ BytecodeOperandIdx(2); 588 Node* raw_slot = __ BytecodeOperandIdx(2);
550 Node* smi_slot = __ SmiTag(raw_slot); 589 Node* smi_slot = __ SmiTag(raw_slot);
551 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 590 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
552 Node* context = __ GetContext(); 591 Node* context = __ GetContext();
553 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, 592 return __ CallStub(ic.descriptor(), code_target, context, object, name,
554 name, smi_slot, type_feedback_vector); 593 smi_slot, type_feedback_vector);
555 __ SetAccumulator(result);
556 __ Dispatch();
557 } 594 }
558 595
559 // LoadIC <object> <name_index> <slot> 596 // LoadIC <object> <name_index> <slot>
560 // 597 //
561 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at 598 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
562 // constant pool entry <name_index>. 599 // constant pool entry <name_index>.
563 void Interpreter::DoLoadIC(InterpreterAssembler* assembler) { 600 void Interpreter::DoLoadIC(InterpreterAssembler* assembler) {
564 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, 601 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
565 UNINITIALIZED); 602 UNINITIALIZED);
566 DoLoadIC(ic, assembler); 603 Node* result = BuildLoadNamedProperty(ic, assembler);
604 __ SetAccumulator(result);
605 __ Dispatch();
567 } 606 }
568 607
569 void Interpreter::DoKeyedLoadIC(Callable ic, InterpreterAssembler* assembler) { 608 // LdrNamedProperty <object> <name_index> <slot> <reg>
609 //
610 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
611 // constant pool entry <name_index> and puts the result into register <reg>.
612 void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) {
613 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
614 UNINITIALIZED);
615 Node* result = BuildLoadNamedProperty(ic, assembler);
616 Node* destination = __ BytecodeOperandReg(3);
617 __ StoreRegister(result, destination);
618 __ Dispatch();
619 }
620
621 Node* Interpreter::BuildLoadKeyedProperty(Callable ic,
622 InterpreterAssembler* assembler) {
570 Node* code_target = __ HeapConstant(ic.code()); 623 Node* code_target = __ HeapConstant(ic.code());
571 Node* reg_index = __ BytecodeOperandReg(0); 624 Node* reg_index = __ BytecodeOperandReg(0);
572 Node* object = __ LoadRegister(reg_index); 625 Node* object = __ LoadRegister(reg_index);
573 Node* name = __ GetAccumulator(); 626 Node* name = __ GetAccumulator();
574 Node* raw_slot = __ BytecodeOperandIdx(1); 627 Node* raw_slot = __ BytecodeOperandIdx(1);
575 Node* smi_slot = __ SmiTag(raw_slot); 628 Node* smi_slot = __ SmiTag(raw_slot);
576 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 629 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
577 Node* context = __ GetContext(); 630 Node* context = __ GetContext();
578 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, 631 return __ CallStub(ic.descriptor(), code_target, context, object, name,
579 name, smi_slot, type_feedback_vector); 632 smi_slot, type_feedback_vector);
580 __ SetAccumulator(result);
581 __ Dispatch();
582 } 633 }
583 634
584 // KeyedLoadIC <object> <slot> 635 // KeyedLoadIC <object> <slot>
585 // 636 //
586 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key 637 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
587 // in the accumulator. 638 // in the accumulator.
588 void Interpreter::DoKeyedLoadIC(InterpreterAssembler* assembler) { 639 void Interpreter::DoKeyedLoadIC(InterpreterAssembler* assembler) {
589 Callable ic = 640 Callable ic =
590 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED); 641 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED);
591 DoKeyedLoadIC(ic, assembler); 642 Node* result = BuildLoadKeyedProperty(ic, assembler);
643 __ SetAccumulator(result);
644 __ Dispatch();
645 }
646
647 // LdrKeyedProperty <object> <slot> <reg>
648 //
649 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
650 // in the accumulator and puts the result in register <reg>.
651 void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) {
652 Callable ic =
653 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED);
654 Node* result = BuildLoadKeyedProperty(ic, assembler);
655 Node* destination = __ BytecodeOperandReg(2);
656 __ StoreRegister(result, destination);
657 __ Dispatch();
592 } 658 }
593 659
594 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { 660 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) {
595 Node* code_target = __ HeapConstant(ic.code()); 661 Node* code_target = __ HeapConstant(ic.code());
596 Node* object_reg_index = __ BytecodeOperandReg(0); 662 Node* object_reg_index = __ BytecodeOperandReg(0);
597 Node* object = __ LoadRegister(object_reg_index); 663 Node* object = __ LoadRegister(object_reg_index);
598 Node* constant_index = __ BytecodeOperandIdx(1); 664 Node* constant_index = __ BytecodeOperandIdx(1);
599 Node* name = __ LoadConstantPoolEntry(constant_index); 665 Node* name = __ LoadConstantPoolEntry(constant_index);
600 Node* value = __ GetAccumulator(); 666 Node* value = __ GetAccumulator();
601 Node* raw_slot = __ BytecodeOperandIdx(2); 667 Node* raw_slot = __ BytecodeOperandIdx(2);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 // KeyedStoreICSloppy <object> <key> <slot> 714 // KeyedStoreICSloppy <object> <key> <slot>
649 // 715 //
650 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> 716 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object>
651 // and the key <key> with the value in the accumulator. 717 // and the key <key> with the value in the accumulator.
652 void Interpreter::DoKeyedStoreICSloppy(InterpreterAssembler* assembler) { 718 void Interpreter::DoKeyedStoreICSloppy(InterpreterAssembler* assembler) {
653 Callable ic = 719 Callable ic =
654 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); 720 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
655 DoKeyedStoreIC(ic, assembler); 721 DoKeyedStoreIC(ic, assembler);
656 } 722 }
657 723
658 // KeyedStoreICStore <object> <key> <slot> 724 // KeyedStoreICStrict <object> <key> <slot>
659 // 725 //
660 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> 726 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object>
661 // and the key <key> with the value in the accumulator. 727 // and the key <key> with the value in the accumulator.
662 void Interpreter::DoKeyedStoreICStrict(InterpreterAssembler* assembler) { 728 void Interpreter::DoKeyedStoreICStrict(InterpreterAssembler* assembler) {
663 Callable ic = 729 Callable ic =
664 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); 730 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
665 DoKeyedStoreIC(ic, assembler); 731 DoKeyedStoreIC(ic, assembler);
666 } 732 }
667 733
668 // PushContext <context> 734 // PushContext <context>
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 1850 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
1785 __ SmiTag(new_state)); 1851 __ SmiTag(new_state));
1786 __ SetAccumulator(old_state); 1852 __ SetAccumulator(old_state);
1787 1853
1788 __ Dispatch(); 1854 __ Dispatch();
1789 } 1855 }
1790 1856
1791 } // namespace interpreter 1857 } // namespace interpreter
1792 } // namespace internal 1858 } // namespace internal
1793 } // namespace v8 1859 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.h ('k') | test/cctest/interpreter/bytecode_expectations/CallGlobal.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698