OLD | NEW |
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 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 // | 418 // |
419 // Stores the value of register <src> to register <dst>. | 419 // Stores the value of register <src> to register <dst>. |
420 void Interpreter::DoMov(InterpreterAssembler* assembler) { | 420 void Interpreter::DoMov(InterpreterAssembler* assembler) { |
421 Node* src_index = __ BytecodeOperandReg(0); | 421 Node* src_index = __ BytecodeOperandReg(0); |
422 Node* src_value = __ LoadRegister(src_index); | 422 Node* src_value = __ LoadRegister(src_index); |
423 Node* dst_index = __ BytecodeOperandReg(1); | 423 Node* dst_index = __ BytecodeOperandReg(1); |
424 __ StoreRegister(src_value, dst_index); | 424 __ StoreRegister(src_value, dst_index); |
425 __ Dispatch(); | 425 __ Dispatch(); |
426 } | 426 } |
427 | 427 |
428 Node* Interpreter::BuildLoadGlobal(Callable ic, Node* context, | 428 Node* Interpreter::BuildLoadGlobal(Callable ic, Node* context, Node* name_index, |
429 Node* feedback_slot, | 429 Node* feedback_slot, |
430 InterpreterAssembler* assembler) { | 430 InterpreterAssembler* assembler) { |
431 typedef LoadGlobalWithVectorDescriptor Descriptor; | 431 typedef LoadGlobalWithVectorDescriptor Descriptor; |
432 | 432 |
433 // Load the global via the LoadGlobalIC. | 433 // Load the global via the LoadGlobalIC. |
434 Node* code_target = __ HeapConstant(ic.code()); | 434 Node* code_target = __ HeapConstant(ic.code()); |
| 435 Node* name = __ LoadConstantPoolEntry(name_index); |
435 Node* smi_slot = __ SmiTag(feedback_slot); | 436 Node* smi_slot = __ SmiTag(feedback_slot); |
436 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 437 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
437 return __ CallStub(ic.descriptor(), code_target, context, | 438 return __ CallStub(ic.descriptor(), code_target, context, |
| 439 Arg(Descriptor::kName, name), |
438 Arg(Descriptor::kSlot, smi_slot), | 440 Arg(Descriptor::kSlot, smi_slot), |
439 Arg(Descriptor::kVector, type_feedback_vector)); | 441 Arg(Descriptor::kVector, type_feedback_vector)); |
440 } | 442 } |
441 | 443 |
442 // LdaGlobal <slot> | 444 // LdaGlobal <name_index> <slot> |
443 // | 445 // |
444 // Load the global with name in constant pool entry <name_index> into the | 446 // Load the global with name in constant pool entry <name_index> into the |
445 // accumulator using FeedBackVector slot <slot> outside of a typeof. | 447 // accumulator using FeedBackVector slot <slot> outside of a typeof. |
446 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { | 448 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { |
447 Callable ic = | 449 Callable ic = |
448 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); | 450 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); |
449 | 451 |
450 Node* context = __ GetContext(); | 452 Node* context = __ GetContext(); |
451 | 453 |
452 Node* raw_slot = __ BytecodeOperandIdx(0); | 454 Node* name_index = __ BytecodeOperandIdx(0); |
453 Node* result = BuildLoadGlobal(ic, context, raw_slot, assembler); | 455 Node* raw_slot = __ BytecodeOperandIdx(1); |
| 456 Node* result = BuildLoadGlobal(ic, context, name_index, raw_slot, assembler); |
454 __ SetAccumulator(result); | 457 __ SetAccumulator(result); |
455 __ Dispatch(); | 458 __ Dispatch(); |
456 } | 459 } |
457 | 460 |
458 // LdaGlobalInsideTypeof <slot> | 461 // LdaGlobalInsideTypeof <name_index> <slot> |
459 // | 462 // |
460 // Load the global with name in constant pool entry <name_index> into the | 463 // Load the global with name in constant pool entry <name_index> into the |
461 // accumulator using FeedBackVector slot <slot> inside of a typeof. | 464 // accumulator using FeedBackVector slot <slot> inside of a typeof. |
462 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { | 465 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { |
463 Callable ic = | 466 Callable ic = |
464 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, INSIDE_TYPEOF); | 467 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, INSIDE_TYPEOF); |
465 | 468 |
466 Node* context = __ GetContext(); | 469 Node* context = __ GetContext(); |
467 | 470 |
468 Node* raw_slot = __ BytecodeOperandIdx(0); | 471 Node* name_index = __ BytecodeOperandIdx(0); |
469 Node* result = BuildLoadGlobal(ic, context, raw_slot, assembler); | 472 Node* raw_slot = __ BytecodeOperandIdx(1); |
| 473 Node* result = BuildLoadGlobal(ic, context, name_index, raw_slot, assembler); |
470 __ SetAccumulator(result); | 474 __ SetAccumulator(result); |
471 __ Dispatch(); | 475 __ Dispatch(); |
472 } | 476 } |
473 | 477 |
474 void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { | 478 void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { |
475 typedef StoreWithVectorDescriptor Descriptor; | 479 typedef StoreWithVectorDescriptor Descriptor; |
476 // Get the global object. | 480 // Get the global object. |
477 Node* context = __ GetContext(); | 481 Node* context = __ GetContext(); |
478 Node* native_context = __ LoadNativeContext(context); | 482 Node* native_context = __ LoadNativeContext(context); |
479 Node* global = | 483 Node* global = |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 | 653 |
650 // Check for context extensions to allow the fast path | 654 // Check for context extensions to allow the fast path |
651 __ GotoIfHasContextExtensionUpToDepth(context, depth, &slowpath); | 655 __ GotoIfHasContextExtensionUpToDepth(context, depth, &slowpath); |
652 | 656 |
653 // Fast path does a normal load global | 657 // Fast path does a normal load global |
654 { | 658 { |
655 Callable ic = CodeFactory::LoadGlobalICInOptimizedCode( | 659 Callable ic = CodeFactory::LoadGlobalICInOptimizedCode( |
656 isolate_, function_id == Runtime::kLoadLookupSlotInsideTypeof | 660 isolate_, function_id == Runtime::kLoadLookupSlotInsideTypeof |
657 ? INSIDE_TYPEOF | 661 ? INSIDE_TYPEOF |
658 : NOT_INSIDE_TYPEOF); | 662 : NOT_INSIDE_TYPEOF); |
659 Node* result = BuildLoadGlobal(ic, context, feedback_slot, assembler); | 663 Node* result = |
| 664 BuildLoadGlobal(ic, context, name_index, feedback_slot, assembler); |
660 __ SetAccumulator(result); | 665 __ SetAccumulator(result); |
661 __ Dispatch(); | 666 __ Dispatch(); |
662 } | 667 } |
663 | 668 |
664 // Slow path when we have to call out to the runtime | 669 // Slow path when we have to call out to the runtime |
665 __ Bind(&slowpath); | 670 __ Bind(&slowpath); |
666 { | 671 { |
667 Node* name = __ LoadConstantPoolEntry(name_index); | 672 Node* name = __ LoadConstantPoolEntry(name_index); |
668 Node* result = __ CallRuntime(function_id, context, name); | 673 Node* result = __ CallRuntime(function_id, context, name); |
669 __ SetAccumulator(result); | 674 __ SetAccumulator(result); |
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2705 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2710 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2706 __ SmiTag(new_state)); | 2711 __ SmiTag(new_state)); |
2707 __ SetAccumulator(old_state); | 2712 __ SetAccumulator(old_state); |
2708 | 2713 |
2709 __ Dispatch(); | 2714 __ Dispatch(); |
2710 } | 2715 } |
2711 | 2716 |
2712 } // namespace interpreter | 2717 } // namespace interpreter |
2713 } // namespace internal | 2718 } // namespace internal |
2714 } // namespace v8 | 2719 } // namespace v8 |
OLD | NEW |