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

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: nit. 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // LdaSmi <imm> 279 // LdaSmi <imm>
280 // 280 //
281 // Load an integer literal into the accumulator as a Smi. 281 // Load an integer literal into the accumulator as a Smi.
282 void Interpreter::DoLdaSmi(InterpreterAssembler* assembler) { 282 void Interpreter::DoLdaSmi(InterpreterAssembler* assembler) {
283 Node* raw_int = __ BytecodeOperandImm(0); 283 Node* raw_int = __ BytecodeOperandImm(0);
284 Node* smi_int = __ SmiTag(raw_int); 284 Node* smi_int = __ SmiTag(raw_int);
285 __ SetAccumulator(smi_int); 285 __ SetAccumulator(smi_int);
286 __ Dispatch(); 286 __ Dispatch();
287 } 287 }
288 288
289 void Interpreter::DoLoadConstant(InterpreterAssembler* assembler) { 289 // LdaConstant <idx>
290 //
291 // Load constant literal at |idx| in the constant pool into the accumulator.
292 void Interpreter::DoLdaConstant(InterpreterAssembler* assembler) {
290 Node* index = __ BytecodeOperandIdx(0); 293 Node* index = __ BytecodeOperandIdx(0);
291 Node* constant = __ LoadConstantPoolEntry(index); 294 Node* constant = __ LoadConstantPoolEntry(index);
292 __ SetAccumulator(constant); 295 __ SetAccumulator(constant);
293 __ Dispatch(); 296 __ Dispatch();
294 } 297 }
295 298
296 299 Node* Interpreter::BuildLoadUndefined(InterpreterAssembler* assembler) {
297 // LdaConstant <idx> 300 return __ HeapConstant(isolate_->factory()->undefined_value());
298 //
299 // Load constant literal at |idx| in the constant pool into the accumulator.
300 void Interpreter::DoLdaConstant(InterpreterAssembler* assembler) {
301 DoLoadConstant(assembler);
302 } 301 }
303 302
304 // LdaUndefined 303 // LdaUndefined
305 // 304 //
306 // Load Undefined into the accumulator. 305 // Load Undefined into the accumulator.
307 void Interpreter::DoLdaUndefined(InterpreterAssembler* assembler) { 306 void Interpreter::DoLdaUndefined(InterpreterAssembler* assembler) {
308 Node* undefined_value = 307 Node* result = BuildLoadUndefined(assembler);
309 __ HeapConstant(isolate_->factory()->undefined_value()); 308 __ SetAccumulator(result);
310 __ SetAccumulator(undefined_value);
311 __ Dispatch(); 309 __ Dispatch();
312 } 310 }
313 311
312 // LdrUndefined <reg>
313 //
314 // Loads undefined into the accumulator and |reg|.
315 void Interpreter::DoLdrUndefined(InterpreterAssembler* assembler) {
316 Node* result = BuildLoadUndefined(assembler);
317 Node* destination = __ BytecodeOperandReg(0);
318 __ StoreRegister(result, destination);
319 __ Dispatch();
320 }
314 321
315 // LdaNull 322 // LdaNull
316 // 323 //
317 // Load Null into the accumulator. 324 // Load Null into the accumulator.
318 void Interpreter::DoLdaNull(InterpreterAssembler* assembler) { 325 void Interpreter::DoLdaNull(InterpreterAssembler* assembler) {
319 Node* null_value = __ HeapConstant(isolate_->factory()->null_value()); 326 Node* null_value = __ HeapConstant(isolate_->factory()->null_value());
320 __ SetAccumulator(null_value); 327 __ SetAccumulator(null_value);
321 __ Dispatch(); 328 __ Dispatch();
322 } 329 }
323 330
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // 385 //
379 // Stores the value of register <src> to register <dst>. 386 // Stores the value of register <src> to register <dst>.
380 void Interpreter::DoMov(InterpreterAssembler* assembler) { 387 void Interpreter::DoMov(InterpreterAssembler* assembler) {
381 Node* src_index = __ BytecodeOperandReg(0); 388 Node* src_index = __ BytecodeOperandReg(0);
382 Node* src_value = __ LoadRegister(src_index); 389 Node* src_value = __ LoadRegister(src_index);
383 Node* dst_index = __ BytecodeOperandReg(1); 390 Node* dst_index = __ BytecodeOperandReg(1);
384 __ StoreRegister(src_value, dst_index); 391 __ StoreRegister(src_value, dst_index);
385 __ Dispatch(); 392 __ Dispatch();
386 } 393 }
387 394
388 395 Node* Interpreter::BuildLoadGlobal(Callable ic,
389 void Interpreter::DoLoadGlobal(Callable ic, InterpreterAssembler* assembler) { 396 InterpreterAssembler* assembler) {
390 // Get the global object. 397 // Get the global object.
391 Node* context = __ GetContext(); 398 Node* context = __ GetContext();
392 Node* native_context = 399 Node* native_context =
393 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); 400 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX);
394 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); 401 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX);
395 402
396 // Load the global via the LoadIC. 403 // Load the global via the LoadIC.
397 Node* code_target = __ HeapConstant(ic.code()); 404 Node* code_target = __ HeapConstant(ic.code());
398 Node* constant_index = __ BytecodeOperandIdx(0); 405 Node* constant_index = __ BytecodeOperandIdx(0);
399 Node* name = __ LoadConstantPoolEntry(constant_index); 406 Node* name = __ LoadConstantPoolEntry(constant_index);
400 Node* raw_slot = __ BytecodeOperandIdx(1); 407 Node* raw_slot = __ BytecodeOperandIdx(1);
401 Node* smi_slot = __ SmiTag(raw_slot); 408 Node* smi_slot = __ SmiTag(raw_slot);
402 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 409 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
403 Node* result = __ CallStub(ic.descriptor(), code_target, context, global, 410 return __ CallStub(ic.descriptor(), code_target, context, global, name,
404 name, smi_slot, type_feedback_vector); 411 smi_slot, type_feedback_vector);
405 __ SetAccumulator(result);
406 __ Dispatch();
407 } 412 }
408 413
409 // LdaGlobal <name_index> <slot> 414 // LdaGlobal <name_index> <slot>
410 // 415 //
411 // Load the global with name in constant pool entry <name_index> into the 416 // Load the global with name in constant pool entry <name_index> into the
412 // accumulator using FeedBackVector slot <slot> outside of a typeof. 417 // accumulator using FeedBackVector slot <slot> outside of a typeof.
413 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { 418 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) {
414 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, 419 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
415 UNINITIALIZED); 420 UNINITIALIZED);
416 DoLoadGlobal(ic, assembler); 421 Node* result = BuildLoadGlobal(ic, assembler);
422 __ SetAccumulator(result);
423 __ Dispatch();
424 }
425
426 // LdrGlobal <name_index> <slot> <reg>
427 //
428 // Load the global with name in constant pool entry <name_index> into
429 // register <reg> using FeedBackVector slot <slot> outside of a typeof.
430 void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) {
431 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
432 UNINITIALIZED);
433 Node* result = BuildLoadGlobal(ic, assembler);
434 Node* destination = __ BytecodeOperandReg(2);
435 __ StoreRegister(result, destination);
436 __ Dispatch();
417 } 437 }
418 438
419 // LdaGlobalInsideTypeof <name_index> <slot> 439 // LdaGlobalInsideTypeof <name_index> <slot>
420 // 440 //
421 // Load the global with name in constant pool entry <name_index> into the 441 // Load the global with name in constant pool entry <name_index> into the
422 // accumulator using FeedBackVector slot <slot> inside of a typeof. 442 // accumulator using FeedBackVector slot <slot> inside of a typeof.
423 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { 443 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) {
424 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, 444 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF,
425 UNINITIALIZED); 445 UNINITIALIZED);
426 DoLoadGlobal(ic, assembler); 446 Node* result = BuildLoadGlobal(ic, assembler);
447 __ SetAccumulator(result);
448 __ Dispatch();
427 } 449 }
428 450
429 void Interpreter::DoStoreGlobal(Callable ic, InterpreterAssembler* assembler) { 451 void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) {
430 // Get the global object. 452 // Get the global object.
431 Node* context = __ GetContext(); 453 Node* context = __ GetContext();
432 Node* native_context = 454 Node* native_context =
433 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); 455 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX);
434 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); 456 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX);
435 457
436 // Store the global via the StoreIC. 458 // Store the global via the StoreIC.
437 Node* code_target = __ HeapConstant(ic.code()); 459 Node* code_target = __ HeapConstant(ic.code());
438 Node* constant_index = __ BytecodeOperandIdx(0); 460 Node* constant_index = __ BytecodeOperandIdx(0);
439 Node* name = __ LoadConstantPoolEntry(constant_index); 461 Node* name = __ LoadConstantPoolEntry(constant_index);
440 Node* value = __ GetAccumulator(); 462 Node* value = __ GetAccumulator();
441 Node* raw_slot = __ BytecodeOperandIdx(1); 463 Node* raw_slot = __ BytecodeOperandIdx(1);
442 Node* smi_slot = __ SmiTag(raw_slot); 464 Node* smi_slot = __ SmiTag(raw_slot);
443 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 465 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
444 __ CallStub(ic.descriptor(), code_target, context, global, name, value, 466 __ CallStub(ic.descriptor(), code_target, context, global, name, value,
445 smi_slot, type_feedback_vector); 467 smi_slot, type_feedback_vector);
446 __ Dispatch(); 468 __ Dispatch();
447 } 469 }
448 470
449 471
450 // StaGlobalSloppy <name_index> <slot> 472 // StaGlobalSloppy <name_index> <slot>
451 // 473 //
452 // Store the value in the accumulator into the global with name in constant pool 474 // Store the value in the accumulator into the global with name in constant pool
453 // entry <name_index> using FeedBackVector slot <slot> in sloppy mode. 475 // entry <name_index> using FeedBackVector slot <slot> in sloppy mode.
454 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { 476 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) {
455 Callable ic = 477 Callable ic =
456 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); 478 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
457 DoStoreGlobal(ic, assembler); 479 DoStaGlobal(ic, assembler);
458 } 480 }
459 481
460 482
461 // StaGlobalStrict <name_index> <slot> 483 // StaGlobalStrict <name_index> <slot>
462 // 484 //
463 // Store the value in the accumulator into the global with name in constant pool 485 // Store the value in the accumulator into the global with name in constant pool
464 // entry <name_index> using FeedBackVector slot <slot> in strict mode. 486 // entry <name_index> using FeedBackVector slot <slot> in strict mode.
465 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { 487 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) {
466 Callable ic = 488 Callable ic =
467 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); 489 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
468 DoStoreGlobal(ic, assembler); 490 DoStaGlobal(ic, assembler);
491 }
492
493 compiler::Node* Interpreter::BuildLoadContextSlot(
494 InterpreterAssembler* assembler) {
495 Node* reg_index = __ BytecodeOperandReg(0);
496 Node* context = __ LoadRegister(reg_index);
497 Node* slot_index = __ BytecodeOperandIdx(1);
498 return __ LoadContextSlot(context, slot_index);
469 } 499 }
470 500
471 // LdaContextSlot <context> <slot_index> 501 // LdaContextSlot <context> <slot_index>
472 // 502 //
473 // Load the object in |slot_index| of |context| into the accumulator. 503 // Load the object in |slot_index| of |context| into the accumulator.
474 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { 504 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) {
475 Node* reg_index = __ BytecodeOperandReg(0); 505 Node* result = BuildLoadContextSlot(assembler);
476 Node* context = __ LoadRegister(reg_index);
477 Node* slot_index = __ BytecodeOperandIdx(1);
478 Node* result = __ LoadContextSlot(context, slot_index);
479 __ SetAccumulator(result); 506 __ SetAccumulator(result);
480 __ Dispatch(); 507 __ Dispatch();
481 } 508 }
482 509
510 // LdrContextSlot <context> <slot_index> <reg>
511 //
512 // Load the object in <slot_index> of <context> into register <reg>.
513 void Interpreter::DoLdrContextSlot(InterpreterAssembler* assembler) {
514 Node* result = BuildLoadContextSlot(assembler);
515 Node* destination = __ BytecodeOperandReg(2);
516 __ StoreRegister(result, destination);
517 __ Dispatch();
518 }
519
483 // StaContextSlot <context> <slot_index> 520 // StaContextSlot <context> <slot_index>
484 // 521 //
485 // Stores the object in the accumulator into |slot_index| of |context|. 522 // Stores the object in the accumulator into |slot_index| of |context|.
486 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { 523 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) {
487 Node* value = __ GetAccumulator(); 524 Node* value = __ GetAccumulator();
488 Node* reg_index = __ BytecodeOperandReg(0); 525 Node* reg_index = __ BytecodeOperandReg(0);
489 Node* context = __ LoadRegister(reg_index); 526 Node* context = __ LoadRegister(reg_index);
490 Node* slot_index = __ BytecodeOperandIdx(1); 527 Node* slot_index = __ BytecodeOperandIdx(1);
491 __ StoreContextSlot(context, slot_index, value); 528 __ StoreContextSlot(context, slot_index, value);
492 __ Dispatch(); 529 __ Dispatch();
493 } 530 }
494 531
495 void Interpreter::DoLoadLookupSlot(Runtime::FunctionId function_id, 532 void Interpreter::DoLdaLookupSlot(Runtime::FunctionId function_id,
496 InterpreterAssembler* assembler) { 533 InterpreterAssembler* assembler) {
497 Node* index = __ BytecodeOperandIdx(0); 534 Node* index = __ BytecodeOperandIdx(0);
498 Node* name = __ LoadConstantPoolEntry(index); 535 Node* name = __ LoadConstantPoolEntry(index);
499 Node* context = __ GetContext(); 536 Node* context = __ GetContext();
500 Node* result = __ CallRuntime(function_id, context, name); 537 Node* result = __ CallRuntime(function_id, context, name);
501 __ SetAccumulator(result); 538 __ SetAccumulator(result);
502 __ Dispatch(); 539 __ Dispatch();
503 } 540 }
504 541
505 // LdaLookupSlot <name_index> 542 // LdaLookupSlot <name_index>
506 // 543 //
507 // Lookup the object with the name in constant pool entry |name_index| 544 // Lookup the object with the name in constant pool entry |name_index|
508 // dynamically. 545 // dynamically.
509 void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) { 546 void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) {
510 DoLoadLookupSlot(Runtime::kLoadLookupSlot, assembler); 547 DoLdaLookupSlot(Runtime::kLoadLookupSlot, assembler);
511 } 548 }
512 549
513 // LdaLookupSlotInsideTypeof <name_index> 550 // LdaLookupSlotInsideTypeof <name_index>
514 // 551 //
515 // Lookup the object with the name in constant pool entry |name_index| 552 // Lookup the object with the name in constant pool entry |name_index|
516 // dynamically without causing a NoReferenceError. 553 // dynamically without causing a NoReferenceError.
517 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) { 554 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) {
518 DoLoadLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler); 555 DoLdaLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler);
519 } 556 }
520 557
521 void Interpreter::DoStoreLookupSlot(LanguageMode language_mode, 558 void Interpreter::DoStaLookupSlot(LanguageMode language_mode,
522 InterpreterAssembler* assembler) { 559 InterpreterAssembler* assembler) {
523 Node* value = __ GetAccumulator(); 560 Node* value = __ GetAccumulator();
524 Node* index = __ BytecodeOperandIdx(0); 561 Node* index = __ BytecodeOperandIdx(0);
525 Node* name = __ LoadConstantPoolEntry(index); 562 Node* name = __ LoadConstantPoolEntry(index);
526 Node* context = __ GetContext(); 563 Node* context = __ GetContext();
527 Node* result = __ CallRuntime(is_strict(language_mode) 564 Node* result = __ CallRuntime(is_strict(language_mode)
528 ? Runtime::kStoreLookupSlot_Strict 565 ? Runtime::kStoreLookupSlot_Strict
529 : Runtime::kStoreLookupSlot_Sloppy, 566 : Runtime::kStoreLookupSlot_Sloppy,
530 context, name, value); 567 context, name, value);
531 __ SetAccumulator(result); 568 __ SetAccumulator(result);
532 __ Dispatch(); 569 __ Dispatch();
533 } 570 }
534 571
535 // StaLookupSlotSloppy <name_index> 572 // StaLookupSlotSloppy <name_index>
536 // 573 //
537 // Store the object in accumulator to the object with the name in constant 574 // Store the object in accumulator to the object with the name in constant
538 // pool entry |name_index| in sloppy mode. 575 // pool entry |name_index| in sloppy mode.
539 void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) { 576 void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) {
540 DoStoreLookupSlot(LanguageMode::SLOPPY, assembler); 577 DoStaLookupSlot(LanguageMode::SLOPPY, assembler);
541 } 578 }
542 579
543 580
544 // StaLookupSlotStrict <name_index> 581 // StaLookupSlotStrict <name_index>
545 // 582 //
546 // Store the object in accumulator to the object with the name in constant 583 // Store the object in accumulator to the object with the name in constant
547 // pool entry |name_index| in strict mode. 584 // pool entry |name_index| in strict mode.
548 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { 585 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) {
549 DoStoreLookupSlot(LanguageMode::STRICT, assembler); 586 DoStaLookupSlot(LanguageMode::STRICT, assembler);
550 } 587 }
551 588
552 void Interpreter::DoLoadIC(Callable ic, InterpreterAssembler* assembler) { 589 Node* Interpreter::BuildLoadNamedProperty(Callable ic,
590 InterpreterAssembler* assembler) {
553 Node* code_target = __ HeapConstant(ic.code()); 591 Node* code_target = __ HeapConstant(ic.code());
554 Node* register_index = __ BytecodeOperandReg(0); 592 Node* register_index = __ BytecodeOperandReg(0);
555 Node* object = __ LoadRegister(register_index); 593 Node* object = __ LoadRegister(register_index);
556 Node* constant_index = __ BytecodeOperandIdx(1); 594 Node* constant_index = __ BytecodeOperandIdx(1);
557 Node* name = __ LoadConstantPoolEntry(constant_index); 595 Node* name = __ LoadConstantPoolEntry(constant_index);
558 Node* raw_slot = __ BytecodeOperandIdx(2); 596 Node* raw_slot = __ BytecodeOperandIdx(2);
559 Node* smi_slot = __ SmiTag(raw_slot); 597 Node* smi_slot = __ SmiTag(raw_slot);
560 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 598 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
561 Node* context = __ GetContext(); 599 Node* context = __ GetContext();
562 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, 600 return __ CallStub(ic.descriptor(), code_target, context, object, name,
563 name, smi_slot, type_feedback_vector); 601 smi_slot, type_feedback_vector);
564 __ SetAccumulator(result);
565 __ Dispatch();
566 } 602 }
567 603
568 // LoadIC <object> <name_index> <slot> 604 // LoadIC <object> <name_index> <slot>
569 // 605 //
570 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at 606 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
571 // constant pool entry <name_index>. 607 // constant pool entry <name_index>.
572 void Interpreter::DoLoadIC(InterpreterAssembler* assembler) { 608 void Interpreter::DoLoadIC(InterpreterAssembler* assembler) {
573 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, 609 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
574 UNINITIALIZED); 610 UNINITIALIZED);
575 DoLoadIC(ic, assembler); 611 Node* result = BuildLoadNamedProperty(ic, assembler);
612 __ SetAccumulator(result);
613 __ Dispatch();
576 } 614 }
577 615
578 void Interpreter::DoKeyedLoadIC(Callable ic, InterpreterAssembler* assembler) { 616 // LdrNamedProperty <object> <name_index> <slot> <reg>
617 //
618 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
619 // constant pool entry <name_index> and puts the result into register <reg>.
620 void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) {
621 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
622 UNINITIALIZED);
623 Node* result = BuildLoadNamedProperty(ic, assembler);
624 Node* destination = __ BytecodeOperandReg(3);
625 __ StoreRegister(result, destination);
626 __ Dispatch();
627 }
628
629 Node* Interpreter::BuildLoadKeyedProperty(Callable ic,
630 InterpreterAssembler* assembler) {
579 Node* code_target = __ HeapConstant(ic.code()); 631 Node* code_target = __ HeapConstant(ic.code());
580 Node* reg_index = __ BytecodeOperandReg(0); 632 Node* reg_index = __ BytecodeOperandReg(0);
581 Node* object = __ LoadRegister(reg_index); 633 Node* object = __ LoadRegister(reg_index);
582 Node* name = __ GetAccumulator(); 634 Node* name = __ GetAccumulator();
583 Node* raw_slot = __ BytecodeOperandIdx(1); 635 Node* raw_slot = __ BytecodeOperandIdx(1);
584 Node* smi_slot = __ SmiTag(raw_slot); 636 Node* smi_slot = __ SmiTag(raw_slot);
585 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 637 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
586 Node* context = __ GetContext(); 638 Node* context = __ GetContext();
587 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, 639 return __ CallStub(ic.descriptor(), code_target, context, object, name,
588 name, smi_slot, type_feedback_vector); 640 smi_slot, type_feedback_vector);
589 __ SetAccumulator(result);
590 __ Dispatch();
591 } 641 }
592 642
593 // KeyedLoadIC <object> <slot> 643 // KeyedLoadIC <object> <slot>
594 // 644 //
595 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key 645 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
596 // in the accumulator. 646 // in the accumulator.
597 void Interpreter::DoKeyedLoadIC(InterpreterAssembler* assembler) { 647 void Interpreter::DoKeyedLoadIC(InterpreterAssembler* assembler) {
598 Callable ic = 648 Callable ic =
599 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED); 649 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED);
600 DoKeyedLoadIC(ic, assembler); 650 Node* result = BuildLoadKeyedProperty(ic, assembler);
651 __ SetAccumulator(result);
652 __ Dispatch();
653 }
654
655 // LdrKeyedProperty <object> <slot> <reg>
656 //
657 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
658 // in the accumulator and puts the result in register <reg>.
659 void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) {
660 Callable ic =
661 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED);
662 Node* result = BuildLoadKeyedProperty(ic, assembler);
663 Node* destination = __ BytecodeOperandReg(2);
664 __ StoreRegister(result, destination);
665 __ Dispatch();
601 } 666 }
602 667
603 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { 668 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) {
604 Node* code_target = __ HeapConstant(ic.code()); 669 Node* code_target = __ HeapConstant(ic.code());
605 Node* object_reg_index = __ BytecodeOperandReg(0); 670 Node* object_reg_index = __ BytecodeOperandReg(0);
606 Node* object = __ LoadRegister(object_reg_index); 671 Node* object = __ LoadRegister(object_reg_index);
607 Node* constant_index = __ BytecodeOperandIdx(1); 672 Node* constant_index = __ BytecodeOperandIdx(1);
608 Node* name = __ LoadConstantPoolEntry(constant_index); 673 Node* name = __ LoadConstantPoolEntry(constant_index);
609 Node* value = __ GetAccumulator(); 674 Node* value = __ GetAccumulator();
610 Node* raw_slot = __ BytecodeOperandIdx(2); 675 Node* raw_slot = __ BytecodeOperandIdx(2);
611 Node* smi_slot = __ SmiTag(raw_slot); 676 Node* smi_slot = __ SmiTag(raw_slot);
612 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 677 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
613 Node* context = __ GetContext(); 678 Node* context = __ GetContext();
614 __ CallStub(ic.descriptor(), code_target, context, object, name, value, 679 __ CallStub(ic.descriptor(), code_target, context, object, name, value,
615 smi_slot, type_feedback_vector); 680 smi_slot, type_feedback_vector);
616 __ Dispatch(); 681 __ Dispatch();
617 } 682 }
618 683
619
620 // StoreICSloppy <object> <name_index> <slot> 684 // StoreICSloppy <object> <name_index> <slot>
621 // 685 //
622 // Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and 686 // Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and
623 // the name in constant pool entry <name_index> with the value in the 687 // the name in constant pool entry <name_index> with the value in the
624 // accumulator. 688 // accumulator.
625 void Interpreter::DoStoreICSloppy(InterpreterAssembler* assembler) { 689 void Interpreter::DoStoreICSloppy(InterpreterAssembler* assembler) {
626 Callable ic = 690 Callable ic =
627 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); 691 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
628 DoStoreIC(ic, assembler); 692 DoStoreIC(ic, assembler);
629 } 693 }
630 694
631
632 // StoreICStrict <object> <name_index> <slot> 695 // StoreICStrict <object> <name_index> <slot>
633 // 696 //
634 // Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and 697 // Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and
635 // the name in constant pool entry <name_index> with the value in the 698 // the name in constant pool entry <name_index> with the value in the
636 // accumulator. 699 // accumulator.
637 void Interpreter::DoStoreICStrict(InterpreterAssembler* assembler) { 700 void Interpreter::DoStoreICStrict(InterpreterAssembler* assembler) {
638 Callable ic = 701 Callable ic =
639 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); 702 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
640 DoStoreIC(ic, assembler); 703 DoStoreIC(ic, assembler);
641 } 704 }
642 705
643 void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) { 706 void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) {
644 Node* code_target = __ HeapConstant(ic.code()); 707 Node* code_target = __ HeapConstant(ic.code());
645 Node* object_reg_index = __ BytecodeOperandReg(0); 708 Node* object_reg_index = __ BytecodeOperandReg(0);
646 Node* object = __ LoadRegister(object_reg_index); 709 Node* object = __ LoadRegister(object_reg_index);
647 Node* name_reg_index = __ BytecodeOperandReg(1); 710 Node* name_reg_index = __ BytecodeOperandReg(1);
648 Node* name = __ LoadRegister(name_reg_index); 711 Node* name = __ LoadRegister(name_reg_index);
649 Node* value = __ GetAccumulator(); 712 Node* value = __ GetAccumulator();
650 Node* raw_slot = __ BytecodeOperandIdx(2); 713 Node* raw_slot = __ BytecodeOperandIdx(2);
651 Node* smi_slot = __ SmiTag(raw_slot); 714 Node* smi_slot = __ SmiTag(raw_slot);
652 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 715 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
653 Node* context = __ GetContext(); 716 Node* context = __ GetContext();
654 __ CallStub(ic.descriptor(), code_target, context, object, name, value, 717 __ CallStub(ic.descriptor(), code_target, context, object, name, value,
655 smi_slot, type_feedback_vector); 718 smi_slot, type_feedback_vector);
656 __ Dispatch(); 719 __ Dispatch();
657 } 720 }
658 721
659
660 // KeyedStoreICSloppy <object> <key> <slot> 722 // KeyedStoreICSloppy <object> <key> <slot>
661 // 723 //
662 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> 724 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object>
663 // and the key <key> with the value in the accumulator. 725 // and the key <key> with the value in the accumulator.
664 void Interpreter::DoKeyedStoreICSloppy(InterpreterAssembler* assembler) { 726 void Interpreter::DoKeyedStoreICSloppy(InterpreterAssembler* assembler) {
665 Callable ic = 727 Callable ic =
666 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); 728 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
667 DoKeyedStoreIC(ic, assembler); 729 DoKeyedStoreIC(ic, assembler);
668 } 730 }
669 731
670 732 // KeyedStoreICStrict <object> <key> <slot>
671 // KeyedStoreICStore <object> <key> <slot>
672 // 733 //
673 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> 734 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object>
674 // and the key <key> with the value in the accumulator. 735 // and the key <key> with the value in the accumulator.
675 void Interpreter::DoKeyedStoreICStrict(InterpreterAssembler* assembler) { 736 void Interpreter::DoKeyedStoreICStrict(InterpreterAssembler* assembler) {
676 Callable ic = 737 Callable ic =
677 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); 738 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
678 DoKeyedStoreIC(ic, assembler); 739 DoKeyedStoreIC(ic, assembler);
679 } 740 }
680 741
681 // PushContext <context> 742 // PushContext <context>
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 1916 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
1856 __ SmiTag(new_state)); 1917 __ SmiTag(new_state));
1857 __ SetAccumulator(old_state); 1918 __ SetAccumulator(old_state);
1858 1919
1859 __ Dispatch(); 1920 __ Dispatch();
1860 } 1921 }
1861 1922
1862 } // namespace interpreter 1923 } // namespace interpreter
1863 } // namespace internal 1924 } // namespace internal
1864 } // namespace v8 1925 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698