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

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: 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
314
315 // LdaNull 312 // LdaNull
316 // 313 //
317 // Load Null into the accumulator. 314 // Load Null into the accumulator.
318 void Interpreter::DoLdaNull(InterpreterAssembler* assembler) { 315 void Interpreter::DoLdaNull(InterpreterAssembler* assembler) {
319 Node* null_value = __ HeapConstant(isolate_->factory()->null_value()); 316 Node* null_value = __ HeapConstant(isolate_->factory()->null_value());
320 __ SetAccumulator(null_value); 317 __ SetAccumulator(null_value);
321 __ Dispatch(); 318 __ Dispatch();
322 } 319 }
323 320
324 321
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // 375 //
379 // Stores the value of register <src> to register <dst>. 376 // Stores the value of register <src> to register <dst>.
380 void Interpreter::DoMov(InterpreterAssembler* assembler) { 377 void Interpreter::DoMov(InterpreterAssembler* assembler) {
381 Node* src_index = __ BytecodeOperandReg(0); 378 Node* src_index = __ BytecodeOperandReg(0);
382 Node* src_value = __ LoadRegister(src_index); 379 Node* src_value = __ LoadRegister(src_index);
383 Node* dst_index = __ BytecodeOperandReg(1); 380 Node* dst_index = __ BytecodeOperandReg(1);
384 __ StoreRegister(src_value, dst_index); 381 __ StoreRegister(src_value, dst_index);
385 __ Dispatch(); 382 __ Dispatch();
386 } 383 }
387 384
388 385 Node* Interpreter::BuildLoadGlobal(Callable ic,
389 void Interpreter::DoLoadGlobal(Callable ic, InterpreterAssembler* assembler) { 386 InterpreterAssembler* assembler) {
390 // Get the global object. 387 // Get the global object.
391 Node* context = __ GetContext(); 388 Node* context = __ GetContext();
392 Node* native_context = 389 Node* native_context =
393 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); 390 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX);
394 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); 391 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX);
395 392
396 // Load the global via the LoadIC. 393 // Load the global via the LoadIC.
397 Node* code_target = __ HeapConstant(ic.code()); 394 Node* code_target = __ HeapConstant(ic.code());
398 Node* constant_index = __ BytecodeOperandIdx(0); 395 Node* constant_index = __ BytecodeOperandIdx(0);
399 Node* name = __ LoadConstantPoolEntry(constant_index); 396 Node* name = __ LoadConstantPoolEntry(constant_index);
400 Node* raw_slot = __ BytecodeOperandIdx(1); 397 Node* raw_slot = __ BytecodeOperandIdx(1);
401 Node* smi_slot = __ SmiTag(raw_slot); 398 Node* smi_slot = __ SmiTag(raw_slot);
402 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 399 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
403 Node* result = __ CallStub(ic.descriptor(), code_target, context, global, 400 return __ CallStub(ic.descriptor(), code_target, context, global, name,
404 name, smi_slot, type_feedback_vector); 401 smi_slot, type_feedback_vector);
402 }
403
404 void Interpreter::DoLdaGlobal(Callable ic, InterpreterAssembler* assembler) {
rmcilroy 2016/05/17 15:49:33 I'd just remove these existing helpers - it's not
oth 2016/05/18 20:22:25 Done.
405 Node* result = BuildLoadGlobal(ic, assembler);
405 __ SetAccumulator(result); 406 __ SetAccumulator(result);
406 __ Dispatch(); 407 __ Dispatch();
407 } 408 }
408 409
409 // LdaGlobal <name_index> <slot> 410 // LdaGlobal <name_index> <slot>
410 // 411 //
411 // Load the global with name in constant pool entry <name_index> into the 412 // Load the global with name in constant pool entry <name_index> into the
412 // accumulator using FeedBackVector slot <slot> outside of a typeof. 413 // accumulator using FeedBackVector slot <slot> outside of a typeof.
413 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { 414 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) {
414 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, 415 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
415 UNINITIALIZED); 416 UNINITIALIZED);
416 DoLoadGlobal(ic, assembler); 417 DoLdaGlobal(ic, assembler);
417 } 418 }
418 419
419 // LdaGlobalInsideTypeof <name_index> <slot> 420 // LdaGlobalInsideTypeof <name_index> <slot>
420 // 421 //
421 // Load the global with name in constant pool entry <name_index> into the 422 // Load the global with name in constant pool entry <name_index> into the
422 // accumulator using FeedBackVector slot <slot> inside of a typeof. 423 // accumulator using FeedBackVector slot <slot> inside of a typeof.
423 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { 424 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) {
424 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, 425 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF,
425 UNINITIALIZED); 426 UNINITIALIZED);
426 DoLoadGlobal(ic, assembler); 427 DoLdaGlobal(ic, assembler);
427 } 428 }
428 429
429 void Interpreter::DoStoreGlobal(Callable ic, InterpreterAssembler* assembler) { 430 void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) {
430 // Get the global object. 431 // Get the global object.
431 Node* context = __ GetContext(); 432 Node* context = __ GetContext();
432 Node* native_context = 433 Node* native_context =
433 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); 434 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX);
434 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); 435 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX);
435 436
436 // Store the global via the StoreIC. 437 // Store the global via the StoreIC.
437 Node* code_target = __ HeapConstant(ic.code()); 438 Node* code_target = __ HeapConstant(ic.code());
438 Node* constant_index = __ BytecodeOperandIdx(0); 439 Node* constant_index = __ BytecodeOperandIdx(0);
439 Node* name = __ LoadConstantPoolEntry(constant_index); 440 Node* name = __ LoadConstantPoolEntry(constant_index);
440 Node* value = __ GetAccumulator(); 441 Node* value = __ GetAccumulator();
441 Node* raw_slot = __ BytecodeOperandIdx(1); 442 Node* raw_slot = __ BytecodeOperandIdx(1);
442 Node* smi_slot = __ SmiTag(raw_slot); 443 Node* smi_slot = __ SmiTag(raw_slot);
443 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 444 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
444 __ CallStub(ic.descriptor(), code_target, context, global, name, value, 445 __ CallStub(ic.descriptor(), code_target, context, global, name, value,
445 smi_slot, type_feedback_vector); 446 smi_slot, type_feedback_vector);
446 __ Dispatch(); 447 __ Dispatch();
447 } 448 }
448 449
449 450
450 // StaGlobalSloppy <name_index> <slot> 451 // StaGlobalSloppy <name_index> <slot>
451 // 452 //
452 // Store the value in the accumulator into the global with name in constant pool 453 // 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. 454 // entry <name_index> using FeedBackVector slot <slot> in sloppy mode.
454 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { 455 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) {
455 Callable ic = 456 Callable ic =
456 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); 457 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
457 DoStoreGlobal(ic, assembler); 458 DoStaGlobal(ic, assembler);
458 } 459 }
459 460
460 461
461 // StaGlobalStrict <name_index> <slot> 462 // StaGlobalStrict <name_index> <slot>
462 // 463 //
463 // Store the value in the accumulator into the global with name in constant pool 464 // 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. 465 // entry <name_index> using FeedBackVector slot <slot> in strict mode.
465 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { 466 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) {
466 Callable ic = 467 Callable ic =
467 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); 468 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
468 DoStoreGlobal(ic, assembler); 469 DoStaGlobal(ic, assembler);
470 }
471
472 compiler::Node* Interpreter::BuildLoadContextSlot(
473 InterpreterAssembler* assembler) {
474 Node* reg_index = __ BytecodeOperandReg(0);
475 Node* context = __ LoadRegister(reg_index);
476 Node* slot_index = __ BytecodeOperandIdx(1);
477 return __ LoadContextSlot(context, slot_index);
469 } 478 }
470 479
471 // LdaContextSlot <context> <slot_index> 480 // LdaContextSlot <context> <slot_index>
472 // 481 //
473 // Load the object in |slot_index| of |context| into the accumulator. 482 // Load the object in |slot_index| of |context| into the accumulator.
474 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { 483 void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) {
475 Node* reg_index = __ BytecodeOperandReg(0); 484 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); 485 __ SetAccumulator(result);
480 __ Dispatch(); 486 __ Dispatch();
481 } 487 }
482 488
483 // StaContextSlot <context> <slot_index> 489 // StaContextSlot <context> <slot_index>
484 // 490 //
485 // Stores the object in the accumulator into |slot_index| of |context|. 491 // Stores the object in the accumulator into |slot_index| of |context|.
486 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { 492 void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) {
487 Node* value = __ GetAccumulator(); 493 Node* value = __ GetAccumulator();
488 Node* reg_index = __ BytecodeOperandReg(0); 494 Node* reg_index = __ BytecodeOperandReg(0);
489 Node* context = __ LoadRegister(reg_index); 495 Node* context = __ LoadRegister(reg_index);
490 Node* slot_index = __ BytecodeOperandIdx(1); 496 Node* slot_index = __ BytecodeOperandIdx(1);
491 __ StoreContextSlot(context, slot_index, value); 497 __ StoreContextSlot(context, slot_index, value);
492 __ Dispatch(); 498 __ Dispatch();
493 } 499 }
494 500
495 void Interpreter::DoLoadLookupSlot(Runtime::FunctionId function_id, 501 void Interpreter::DoLdaLookupSlot(Runtime::FunctionId function_id,
496 InterpreterAssembler* assembler) { 502 InterpreterAssembler* assembler) {
497 Node* index = __ BytecodeOperandIdx(0); 503 Node* index = __ BytecodeOperandIdx(0);
498 Node* name = __ LoadConstantPoolEntry(index); 504 Node* name = __ LoadConstantPoolEntry(index);
499 Node* context = __ GetContext(); 505 Node* context = __ GetContext();
500 Node* result = __ CallRuntime(function_id, context, name); 506 Node* result = __ CallRuntime(function_id, context, name);
501 __ SetAccumulator(result); 507 __ SetAccumulator(result);
502 __ Dispatch(); 508 __ Dispatch();
503 } 509 }
504 510
505 // LdaLookupSlot <name_index> 511 // LdaLookupSlot <name_index>
506 // 512 //
507 // Lookup the object with the name in constant pool entry |name_index| 513 // Lookup the object with the name in constant pool entry |name_index|
508 // dynamically. 514 // dynamically.
509 void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) { 515 void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) {
510 DoLoadLookupSlot(Runtime::kLoadLookupSlot, assembler); 516 DoLdaLookupSlot(Runtime::kLoadLookupSlot, assembler);
511 } 517 }
512 518
513 // LdaLookupSlotInsideTypeof <name_index> 519 // LdaLookupSlotInsideTypeof <name_index>
514 // 520 //
515 // Lookup the object with the name in constant pool entry |name_index| 521 // Lookup the object with the name in constant pool entry |name_index|
516 // dynamically without causing a NoReferenceError. 522 // dynamically without causing a NoReferenceError.
517 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) { 523 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) {
518 DoLoadLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler); 524 DoLdaLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler);
519 } 525 }
520 526
521 void Interpreter::DoStoreLookupSlot(LanguageMode language_mode, 527 void Interpreter::DoStaLookupSlot(LanguageMode language_mode,
522 InterpreterAssembler* assembler) { 528 InterpreterAssembler* assembler) {
523 Node* value = __ GetAccumulator(); 529 Node* value = __ GetAccumulator();
524 Node* index = __ BytecodeOperandIdx(0); 530 Node* index = __ BytecodeOperandIdx(0);
525 Node* name = __ LoadConstantPoolEntry(index); 531 Node* name = __ LoadConstantPoolEntry(index);
526 Node* context = __ GetContext(); 532 Node* context = __ GetContext();
527 Node* result = __ CallRuntime(is_strict(language_mode) 533 Node* result = __ CallRuntime(is_strict(language_mode)
528 ? Runtime::kStoreLookupSlot_Strict 534 ? Runtime::kStoreLookupSlot_Strict
529 : Runtime::kStoreLookupSlot_Sloppy, 535 : Runtime::kStoreLookupSlot_Sloppy,
530 context, name, value); 536 context, name, value);
531 __ SetAccumulator(result); 537 __ SetAccumulator(result);
532 __ Dispatch(); 538 __ Dispatch();
533 } 539 }
534 540
535 // StaLookupSlotSloppy <name_index> 541 // StaLookupSlotSloppy <name_index>
536 // 542 //
537 // Store the object in accumulator to the object with the name in constant 543 // Store the object in accumulator to the object with the name in constant
538 // pool entry |name_index| in sloppy mode. 544 // pool entry |name_index| in sloppy mode.
539 void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) { 545 void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) {
540 DoStoreLookupSlot(LanguageMode::SLOPPY, assembler); 546 DoStaLookupSlot(LanguageMode::SLOPPY, assembler);
541 } 547 }
542 548
543 549
544 // StaLookupSlotStrict <name_index> 550 // StaLookupSlotStrict <name_index>
545 // 551 //
546 // Store the object in accumulator to the object with the name in constant 552 // Store the object in accumulator to the object with the name in constant
547 // pool entry |name_index| in strict mode. 553 // pool entry |name_index| in strict mode.
548 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { 554 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) {
549 DoStoreLookupSlot(LanguageMode::STRICT, assembler); 555 DoStaLookupSlot(LanguageMode::STRICT, assembler);
550 } 556 }
551 557
552 void Interpreter::DoLoadIC(Callable ic, InterpreterAssembler* assembler) { 558 Node* Interpreter::BuildLoadNamedProperty(Callable ic,
559 InterpreterAssembler* assembler) {
553 Node* code_target = __ HeapConstant(ic.code()); 560 Node* code_target = __ HeapConstant(ic.code());
554 Node* register_index = __ BytecodeOperandReg(0); 561 Node* register_index = __ BytecodeOperandReg(0);
555 Node* object = __ LoadRegister(register_index); 562 Node* object = __ LoadRegister(register_index);
556 Node* constant_index = __ BytecodeOperandIdx(1); 563 Node* constant_index = __ BytecodeOperandIdx(1);
557 Node* name = __ LoadConstantPoolEntry(constant_index); 564 Node* name = __ LoadConstantPoolEntry(constant_index);
558 Node* raw_slot = __ BytecodeOperandIdx(2); 565 Node* raw_slot = __ BytecodeOperandIdx(2);
559 Node* smi_slot = __ SmiTag(raw_slot); 566 Node* smi_slot = __ SmiTag(raw_slot);
560 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 567 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
561 Node* context = __ GetContext(); 568 Node* context = __ GetContext();
562 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, 569 return __ CallStub(ic.descriptor(), code_target, context, object, name,
563 name, smi_slot, type_feedback_vector); 570 smi_slot, type_feedback_vector);
571 }
572
573 // LdaNamedProperty <object> <name_index> <slot>
574 //
575 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
576 // constant pool entry <name_index>.
577 void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) {
578 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
579 UNINITIALIZED);
580 Node* result = BuildLoadNamedProperty(ic, assembler);
564 __ SetAccumulator(result); 581 __ SetAccumulator(result);
565 __ Dispatch(); 582 __ Dispatch();
566 } 583 }
567 584
568 // LoadIC <object> <name_index> <slot> 585 Node* Interpreter::BuildLoadKeyedProperty(Callable ic,
569 // 586 InterpreterAssembler* assembler) {
570 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
571 // constant pool entry <name_index>.
572 void Interpreter::DoLoadIC(InterpreterAssembler* assembler) {
573 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
574 UNINITIALIZED);
575 DoLoadIC(ic, assembler);
576 }
577
578 void Interpreter::DoKeyedLoadIC(Callable ic, InterpreterAssembler* assembler) {
579 Node* code_target = __ HeapConstant(ic.code()); 587 Node* code_target = __ HeapConstant(ic.code());
580 Node* reg_index = __ BytecodeOperandReg(0); 588 Node* reg_index = __ BytecodeOperandReg(0);
581 Node* object = __ LoadRegister(reg_index); 589 Node* object = __ LoadRegister(reg_index);
582 Node* name = __ GetAccumulator(); 590 Node* name = __ GetAccumulator();
583 Node* raw_slot = __ BytecodeOperandIdx(1); 591 Node* raw_slot = __ BytecodeOperandIdx(1);
584 Node* smi_slot = __ SmiTag(raw_slot); 592 Node* smi_slot = __ SmiTag(raw_slot);
585 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 593 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
586 Node* context = __ GetContext(); 594 Node* context = __ GetContext();
587 Node* result = __ CallStub(ic.descriptor(), code_target, context, object, 595 return __ CallStub(ic.descriptor(), code_target, context, object, name,
588 name, smi_slot, type_feedback_vector); 596 smi_slot, type_feedback_vector);
597 }
598
599 // LdaKeyedProperty <object> <slot>
600 //
601 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
602 // in the accumulator.
603 void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) {
604 Callable ic =
605 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED);
606 Node* result = BuildLoadKeyedProperty(ic, assembler);
589 __ SetAccumulator(result); 607 __ SetAccumulator(result);
590 __ Dispatch(); 608 __ Dispatch();
591 } 609 }
592 610
593 // KeyedLoadIC <object> <slot> 611 void Interpreter::DoStaNamedProperty(Callable ic,
594 // 612 InterpreterAssembler* assembler) {
595 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
596 // in the accumulator.
597 void Interpreter::DoKeyedLoadIC(InterpreterAssembler* assembler) {
598 Callable ic =
599 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED);
600 DoKeyedLoadIC(ic, assembler);
601 }
602
603 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) {
604 Node* code_target = __ HeapConstant(ic.code()); 613 Node* code_target = __ HeapConstant(ic.code());
605 Node* object_reg_index = __ BytecodeOperandReg(0); 614 Node* object_reg_index = __ BytecodeOperandReg(0);
606 Node* object = __ LoadRegister(object_reg_index); 615 Node* object = __ LoadRegister(object_reg_index);
607 Node* constant_index = __ BytecodeOperandIdx(1); 616 Node* constant_index = __ BytecodeOperandIdx(1);
608 Node* name = __ LoadConstantPoolEntry(constant_index); 617 Node* name = __ LoadConstantPoolEntry(constant_index);
609 Node* value = __ GetAccumulator(); 618 Node* value = __ GetAccumulator();
610 Node* raw_slot = __ BytecodeOperandIdx(2); 619 Node* raw_slot = __ BytecodeOperandIdx(2);
611 Node* smi_slot = __ SmiTag(raw_slot); 620 Node* smi_slot = __ SmiTag(raw_slot);
612 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 621 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
613 Node* context = __ GetContext(); 622 Node* context = __ GetContext();
614 __ CallStub(ic.descriptor(), code_target, context, object, name, value, 623 __ CallStub(ic.descriptor(), code_target, context, object, name, value,
615 smi_slot, type_feedback_vector); 624 smi_slot, type_feedback_vector);
616 __ Dispatch(); 625 __ Dispatch();
617 } 626 }
618 627
619 628 // StaNamedPropertySloppy <object> <name_index> <slot>
620 // StoreICSloppy <object> <name_index> <slot>
621 // 629 //
622 // Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and 630 // 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 631 // the name in constant pool entry <name_index> with the value in the
624 // accumulator. 632 // accumulator.
625 void Interpreter::DoStoreICSloppy(InterpreterAssembler* assembler) { 633 void Interpreter::DoStaNamedPropertySloppy(InterpreterAssembler* assembler) {
626 Callable ic = 634 Callable ic =
627 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); 635 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
628 DoStoreIC(ic, assembler); 636 DoStaNamedProperty(ic, assembler);
629 } 637 }
630 638
631 639 // StaNamedPropertyStrict <object> <name_index> <slot>
632 // StoreICStrict <object> <name_index> <slot>
633 // 640 //
634 // Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and 641 // 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 642 // the name in constant pool entry <name_index> with the value in the
636 // accumulator. 643 // accumulator.
637 void Interpreter::DoStoreICStrict(InterpreterAssembler* assembler) { 644 void Interpreter::DoStaNamedPropertyStrict(InterpreterAssembler* assembler) {
638 Callable ic = 645 Callable ic =
639 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); 646 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
640 DoStoreIC(ic, assembler); 647 DoStaNamedProperty(ic, assembler);
641 } 648 }
642 649
643 void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) { 650 void Interpreter::DoStaKeyedProperty(Callable ic,
651 InterpreterAssembler* assembler) {
644 Node* code_target = __ HeapConstant(ic.code()); 652 Node* code_target = __ HeapConstant(ic.code());
645 Node* object_reg_index = __ BytecodeOperandReg(0); 653 Node* object_reg_index = __ BytecodeOperandReg(0);
646 Node* object = __ LoadRegister(object_reg_index); 654 Node* object = __ LoadRegister(object_reg_index);
647 Node* name_reg_index = __ BytecodeOperandReg(1); 655 Node* name_reg_index = __ BytecodeOperandReg(1);
648 Node* name = __ LoadRegister(name_reg_index); 656 Node* name = __ LoadRegister(name_reg_index);
649 Node* value = __ GetAccumulator(); 657 Node* value = __ GetAccumulator();
650 Node* raw_slot = __ BytecodeOperandIdx(2); 658 Node* raw_slot = __ BytecodeOperandIdx(2);
651 Node* smi_slot = __ SmiTag(raw_slot); 659 Node* smi_slot = __ SmiTag(raw_slot);
652 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 660 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
653 Node* context = __ GetContext(); 661 Node* context = __ GetContext();
654 __ CallStub(ic.descriptor(), code_target, context, object, name, value, 662 __ CallStub(ic.descriptor(), code_target, context, object, name, value,
655 smi_slot, type_feedback_vector); 663 smi_slot, type_feedback_vector);
656 __ Dispatch(); 664 __ Dispatch();
657 } 665 }
658 666
659 667 // StaKeyedPropertySloppy <object> <key> <slot>
660 // KeyedStoreICSloppy <object> <key> <slot>
661 // 668 //
662 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> 669 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object>
663 // and the key <key> with the value in the accumulator. 670 // and the key <key> with the value in the accumulator.
664 void Interpreter::DoKeyedStoreICSloppy(InterpreterAssembler* assembler) { 671 void Interpreter::DoStaKeyedPropertySloppy(InterpreterAssembler* assembler) {
665 Callable ic = 672 Callable ic =
666 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); 673 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
667 DoKeyedStoreIC(ic, assembler); 674 DoStaKeyedProperty(ic, assembler);
668 } 675 }
669 676
670 677 // StaKeyedPropertyStrict <object> <key> <slot>
671 // KeyedStoreICStore <object> <key> <slot>
672 // 678 //
673 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> 679 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object>
674 // and the key <key> with the value in the accumulator. 680 // and the key <key> with the value in the accumulator.
675 void Interpreter::DoKeyedStoreICStrict(InterpreterAssembler* assembler) { 681 void Interpreter::DoStaKeyedPropertyStrict(InterpreterAssembler* assembler) {
676 Callable ic = 682 Callable ic =
677 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); 683 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
678 DoKeyedStoreIC(ic, assembler); 684 DoStaKeyedProperty(ic, assembler);
679 } 685 }
680 686
681 // PushContext <context> 687 // PushContext <context>
682 // 688 //
683 // Saves the current context in <context>, and pushes the accumulator as the 689 // Saves the current context in <context>, and pushes the accumulator as the
684 // new current context. 690 // new current context.
685 void Interpreter::DoPushContext(InterpreterAssembler* assembler) { 691 void Interpreter::DoPushContext(InterpreterAssembler* assembler) {
686 Node* reg_index = __ BytecodeOperandReg(0); 692 Node* reg_index = __ BytecodeOperandReg(0);
687 Node* new_context = __ GetAccumulator(); 693 Node* new_context = __ GetAccumulator();
688 Node* old_context = __ GetContext(); 694 Node* old_context = __ GetContext();
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 // An invalid bytecode aborting execution if dispatched. 1790 // An invalid bytecode aborting execution if dispatched.
1785 void Interpreter::DoIllegal(InterpreterAssembler* assembler) { 1791 void Interpreter::DoIllegal(InterpreterAssembler* assembler) {
1786 __ Abort(kInvalidBytecode); 1792 __ Abort(kInvalidBytecode);
1787 } 1793 }
1788 1794
1789 // Nop 1795 // Nop
1790 // 1796 //
1791 // No operation. 1797 // No operation.
1792 void Interpreter::DoNop(InterpreterAssembler* assembler) { __ Dispatch(); } 1798 void Interpreter::DoNop(InterpreterAssembler* assembler) { __ Dispatch(); }
1793 1799
1800 // LdrUndefined <reg>
1801 //
1802 // Loads undefined into the accumulator and |reg|.
rmcilroy 2016/05/17 15:49:33 nit - also group these near Lda variants please
oth 2016/05/18 20:22:25 Done.
1803 void Interpreter::DoLdrUndefined(InterpreterAssembler* assembler) {
1804 Node* result = BuildLoadUndefined(assembler);
1805 Node* destination = __ BytecodeOperandReg(0);
1806 __ StoreRegister(result, destination);
1807 __ Dispatch();
1808 }
1809
1810 // LdrContextSlot <context> <slot_index> <reg>
1811 //
1812 // Load the object in <slot_index> of <context> into register <reg>.
1813 void Interpreter::DoLdrContextSlot(InterpreterAssembler* assembler) {
1814 Node* result = BuildLoadContextSlot(assembler);
1815 Node* destination = __ BytecodeOperandReg(2);
1816 __ StoreRegister(result, destination);
1817 __ Dispatch();
1818 }
1819
1820 // LdrGlobal <name_index> <slot> <reg>
1821 //
1822 // Load the global with name in constant pool entry <name_index> into
1823 // register <reg> using FeedBackVector slot <slot> outside of a typeof.
1824 void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) {
1825 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
1826 UNINITIALIZED);
1827 Node* result = BuildLoadGlobal(ic, assembler);
1828 Node* destination = __ BytecodeOperandReg(2);
1829 __ StoreRegister(result, destination);
1830 __ Dispatch();
1831 }
1832
1833 // LdrNamedProperty <object> <name_index> <slot> <reg>
1834 //
1835 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
1836 // constant pool entry <name_index> and puts the result into register <reg>.
1837 void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) {
1838 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
1839 UNINITIALIZED);
1840 Node* result = BuildLoadNamedProperty(ic, assembler);
1841 Node* destination = __ BytecodeOperandReg(3);
1842 __ StoreRegister(result, destination);
1843 __ Dispatch();
1844 }
1845
1846 // LdrKeyedProperty <object> <slot> <reg>
1847 //
1848 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
1849 // in the accumulator and puts the result in register <reg>.
1850 void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) {
1851 Callable ic =
1852 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED);
1853 Node* result = BuildLoadKeyedProperty(ic, assembler);
1854 Node* destination = __ BytecodeOperandReg(2);
1855 __ StoreRegister(result, destination);
1856 __ Dispatch();
1857 }
1858
1794 // SuspendGenerator <generator> 1859 // SuspendGenerator <generator>
1795 // 1860 //
1796 // Exports the register file and stores it into the generator. Also stores the 1861 // Exports the register file and stores it into the generator. Also stores the
1797 // current context and the state given in the accumulator into the generator. 1862 // current context and the state given in the accumulator into the generator.
1798 void Interpreter::DoSuspendGenerator(InterpreterAssembler* assembler) { 1863 void Interpreter::DoSuspendGenerator(InterpreterAssembler* assembler) {
1799 Node* generator_reg = __ BytecodeOperandReg(0); 1864 Node* generator_reg = __ BytecodeOperandReg(0);
1800 Node* generator = __ LoadRegister(generator_reg); 1865 Node* generator = __ LoadRegister(generator_reg);
1801 1866
1802 Node* array = 1867 Node* array =
1803 __ LoadObjectField(generator, JSGeneratorObject::kOperandStackOffset); 1868 __ LoadObjectField(generator, JSGeneratorObject::kOperandStackOffset);
(...skipping 25 matching lines...) Expand all
1829 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 1894 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
1830 __ SmiTag(new_state)); 1895 __ SmiTag(new_state));
1831 __ SetAccumulator(old_state); 1896 __ SetAccumulator(old_state);
1832 1897
1833 __ Dispatch(); 1898 __ Dispatch();
1834 } 1899 }
1835 1900
1836 } // namespace interpreter 1901 } // namespace interpreter
1837 } // namespace internal 1902 } // namespace internal
1838 } // namespace v8 1903 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698