| 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 "src/ast/prettyprinter.h" | 7 #include "src/ast/prettyprinter.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 // Stores the object in the accumulator into |slot_index| of |context|. | 460 // Stores the object in the accumulator into |slot_index| of |context|. |
| 461 void Interpreter::DoStaContextSlotWide(InterpreterAssembler* assembler) { | 461 void Interpreter::DoStaContextSlotWide(InterpreterAssembler* assembler) { |
| 462 DoStaContextSlot(assembler); | 462 DoStaContextSlot(assembler); |
| 463 } | 463 } |
| 464 | 464 |
| 465 void Interpreter::DoLoadLookupSlot(Runtime::FunctionId function_id, | 465 void Interpreter::DoLoadLookupSlot(Runtime::FunctionId function_id, |
| 466 InterpreterAssembler* assembler) { | 466 InterpreterAssembler* assembler) { |
| 467 Node* index = __ BytecodeOperandIdx(0); | 467 Node* index = __ BytecodeOperandIdx(0); |
| 468 Node* name = __ LoadConstantPoolEntry(index); | 468 Node* name = __ LoadConstantPoolEntry(index); |
| 469 Node* context = __ GetContext(); | 469 Node* context = __ GetContext(); |
| 470 Node* result_pair = __ CallRuntime(function_id, context, context, name); | 470 Node* result = __ CallRuntime(function_id, context, name); |
| 471 Node* result = __ Projection(0, result_pair); | |
| 472 __ SetAccumulator(result); | 471 __ SetAccumulator(result); |
| 473 __ Dispatch(); | 472 __ Dispatch(); |
| 474 } | 473 } |
| 475 | 474 |
| 476 | 475 |
| 477 // LdaLookupSlot <name_index> | 476 // LdaLookupSlot <name_index> |
| 478 // | 477 // |
| 479 // Lookup the object with the name in constant pool entry |name_index| | 478 // Lookup the object with the name in constant pool entry |name_index| |
| 480 // dynamically. | 479 // dynamically. |
| 481 void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) { | 480 void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) { |
| 482 DoLoadLookupSlot(Runtime::kLoadLookupSlot, assembler); | 481 DoLoadLookupSlot(Runtime::kLoadLookupSlot, assembler); |
| 483 } | 482 } |
| 484 | 483 |
| 485 | 484 |
| 486 // LdaLookupSlotInsideTypeof <name_index> | 485 // LdaLookupSlotInsideTypeof <name_index> |
| 487 // | 486 // |
| 488 // Lookup the object with the name in constant pool entry |name_index| | 487 // Lookup the object with the name in constant pool entry |name_index| |
| 489 // dynamically without causing a NoReferenceError. | 488 // dynamically without causing a NoReferenceError. |
| 490 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) { | 489 void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) { |
| 491 DoLoadLookupSlot(Runtime::kLoadLookupSlotNoReferenceError, assembler); | 490 DoLoadLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler); |
| 492 } | 491 } |
| 493 | 492 |
| 494 | 493 |
| 495 // LdaLookupSlotWide <name_index> | 494 // LdaLookupSlotWide <name_index> |
| 496 // | 495 // |
| 497 // Lookup the object with the name in constant pool entry |name_index| | 496 // Lookup the object with the name in constant pool entry |name_index| |
| 498 // dynamically. | 497 // dynamically. |
| 499 void Interpreter::DoLdaLookupSlotWide(InterpreterAssembler* assembler) { | 498 void Interpreter::DoLdaLookupSlotWide(InterpreterAssembler* assembler) { |
| 500 DoLdaLookupSlot(assembler); | 499 DoLdaLookupSlot(assembler); |
| 501 } | 500 } |
| 502 | 501 |
| 503 | 502 |
| 504 // LdaLookupSlotInsideTypeofWide <name_index> | 503 // LdaLookupSlotInsideTypeofWide <name_index> |
| 505 // | 504 // |
| 506 // Lookup the object with the name in constant pool entry |name_index| | 505 // Lookup the object with the name in constant pool entry |name_index| |
| 507 // dynamically without causing a NoReferenceError. | 506 // dynamically without causing a NoReferenceError. |
| 508 void Interpreter::DoLdaLookupSlotInsideTypeofWide( | 507 void Interpreter::DoLdaLookupSlotInsideTypeofWide( |
| 509 InterpreterAssembler* assembler) { | 508 InterpreterAssembler* assembler) { |
| 510 DoLdaLookupSlotInsideTypeof(assembler); | 509 DoLdaLookupSlotInsideTypeof(assembler); |
| 511 } | 510 } |
| 512 | 511 |
| 513 void Interpreter::DoStoreLookupSlot(LanguageMode language_mode, | 512 void Interpreter::DoStoreLookupSlot(LanguageMode language_mode, |
| 514 InterpreterAssembler* assembler) { | 513 InterpreterAssembler* assembler) { |
| 515 Node* value = __ GetAccumulator(); | 514 Node* value = __ GetAccumulator(); |
| 516 Node* index = __ BytecodeOperandIdx(0); | 515 Node* index = __ BytecodeOperandIdx(0); |
| 517 Node* name = __ LoadConstantPoolEntry(index); | 516 Node* name = __ LoadConstantPoolEntry(index); |
| 518 Node* context = __ GetContext(); | 517 Node* context = __ GetContext(); |
| 519 Node* language_mode_node = __ NumberConstant(language_mode); | 518 Node* result = __ CallRuntime(is_strict(language_mode) |
| 520 Node* result = __ CallRuntime(Runtime::kStoreLookupSlot, context, value, | 519 ? Runtime::kStoreLookupSlot_Strict |
| 521 context, name, language_mode_node); | 520 : Runtime::kStoreLookupSlot_Sloppy, |
| 521 context, name, value); |
| 522 __ SetAccumulator(result); | 522 __ SetAccumulator(result); |
| 523 __ Dispatch(); | 523 __ Dispatch(); |
| 524 } | 524 } |
| 525 | 525 |
| 526 | 526 |
| 527 // StaLookupSlotSloppy <name_index> | 527 // StaLookupSlotSloppy <name_index> |
| 528 // | 528 // |
| 529 // Store the object in accumulator to the object with the name in constant | 529 // Store the object in accumulator to the object with the name in constant |
| 530 // pool entry |name_index| in sloppy mode. | 530 // pool entry |name_index| in sloppy mode. |
| 531 void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) { | 531 void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) { |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 | 1022 |
| 1023 // DeleteLookupSlot | 1023 // DeleteLookupSlot |
| 1024 // | 1024 // |
| 1025 // Delete the variable with the name specified in the accumulator by dynamically | 1025 // Delete the variable with the name specified in the accumulator by dynamically |
| 1026 // looking it up. | 1026 // looking it up. |
| 1027 void Interpreter::DoDeleteLookupSlot(InterpreterAssembler* assembler) { | 1027 void Interpreter::DoDeleteLookupSlot(InterpreterAssembler* assembler) { |
| 1028 Node* name = __ GetAccumulator(); | 1028 Node* name = __ GetAccumulator(); |
| 1029 Node* context = __ GetContext(); | 1029 Node* context = __ GetContext(); |
| 1030 Node* result = | 1030 Node* result = __ CallRuntime(Runtime::kDeleteLookupSlot, context, name); |
| 1031 __ CallRuntime(Runtime::kDeleteLookupSlot, context, context, name); | |
| 1032 __ SetAccumulator(result); | 1031 __ SetAccumulator(result); |
| 1033 __ Dispatch(); | 1032 __ Dispatch(); |
| 1034 } | 1033 } |
| 1035 | 1034 |
| 1036 void Interpreter::DoJSCall(InterpreterAssembler* assembler) { | 1035 void Interpreter::DoJSCall(InterpreterAssembler* assembler) { |
| 1037 Node* function_reg = __ BytecodeOperandReg(0); | 1036 Node* function_reg = __ BytecodeOperandReg(0); |
| 1038 Node* function = __ LoadRegister(function_reg); | 1037 Node* function = __ LoadRegister(function_reg); |
| 1039 Node* receiver_reg = __ BytecodeOperandReg(1); | 1038 Node* receiver_reg = __ BytecodeOperandReg(1); |
| 1040 Node* receiver_arg = __ RegisterLocation(receiver_reg); | 1039 Node* receiver_arg = __ RegisterLocation(receiver_reg); |
| 1041 Node* receiver_args_count = __ BytecodeOperandCount(2); | 1040 Node* receiver_args_count = __ BytecodeOperandCount(2); |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1888 Node* index = __ LoadRegister(index_reg); | 1887 Node* index = __ LoadRegister(index_reg); |
| 1889 Node* context = __ GetContext(); | 1888 Node* context = __ GetContext(); |
| 1890 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); | 1889 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); |
| 1891 __ SetAccumulator(result); | 1890 __ SetAccumulator(result); |
| 1892 __ Dispatch(); | 1891 __ Dispatch(); |
| 1893 } | 1892 } |
| 1894 | 1893 |
| 1895 } // namespace interpreter | 1894 } // namespace interpreter |
| 1896 } // namespace internal | 1895 } // namespace internal |
| 1897 } // namespace v8 | 1896 } // namespace v8 |
| OLD | NEW |