| 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/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/compiler/interpreter-assembler.h" | 9 #include "src/compiler/interpreter-assembler.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 void Interpreter::DoStaContextSlot(compiler::InterpreterAssembler* assembler) { | 416 void Interpreter::DoStaContextSlot(compiler::InterpreterAssembler* assembler) { |
| 417 Node* value = __ GetAccumulator(); | 417 Node* value = __ GetAccumulator(); |
| 418 Node* reg_index = __ BytecodeOperandReg(0); | 418 Node* reg_index = __ BytecodeOperandReg(0); |
| 419 Node* context = __ LoadRegister(reg_index); | 419 Node* context = __ LoadRegister(reg_index); |
| 420 Node* slot_index = __ BytecodeOperandIdx(1); | 420 Node* slot_index = __ BytecodeOperandIdx(1); |
| 421 __ StoreContextSlot(context, slot_index, value); | 421 __ StoreContextSlot(context, slot_index, value); |
| 422 __ Dispatch(); | 422 __ Dispatch(); |
| 423 } | 423 } |
| 424 | 424 |
| 425 | 425 |
| 426 void Interpreter::LdaLookupSlotHelper( |
| 427 Runtime::FunctionId function_id, |
| 428 compiler::InterpreterAssembler* assembler) { |
| 429 Node* index = __ BytecodeOperandIdx(0); |
| 430 Node* name = __ LoadConstantPoolEntry(index); |
| 431 Node* context = __ GetContext(); |
| 432 Node* result_pair = __ CallRuntime(function_id, context, name); |
| 433 Node* result = __ Projection(0, result_pair); |
| 434 __ SetAccumulator(result); |
| 435 __ Dispatch(); |
| 436 } |
| 437 |
| 438 |
| 439 // LdaLookupSlot <name_index> |
| 440 // |
| 441 // Lookup the object with the name in constant pool entry |name_index| |
| 442 // dynamically. |
| 443 void Interpreter::DoLdaLookupSlot(compiler::InterpreterAssembler* assembler) { |
| 444 LdaLookupSlotHelper(Runtime::kLoadLookupSlot, assembler); |
| 445 } |
| 446 |
| 447 |
| 448 // LdaLookupSlotInsideTypeof <name_index> |
| 449 // |
| 450 // Lookup the object with the name in constant pool entry |name_index| |
| 451 // dynamically without causing a NoReferenceError. |
| 452 void Interpreter::DoLdaLookupSlotInsideTypeof( |
| 453 compiler::InterpreterAssembler* assembler) { |
| 454 LdaLookupSlotHelper(Runtime::kLoadLookupSlotNoReferenceError, assembler); |
| 455 } |
| 456 |
| 457 |
| 458 void Interpreter::StaLookupSlotHelper( |
| 459 LanguageMode language_mode, compiler::InterpreterAssembler* assembler) { |
| 460 Node* value = __ GetAccumulator(); |
| 461 Node* index = __ BytecodeOperandIdx(0); |
| 462 Node* name = __ LoadConstantPoolEntry(index); |
| 463 Node* context = __ GetContext(); |
| 464 Node* language_mode_node = __ NumberConstant(language_mode); |
| 465 Node* result = __ CallRuntime(Runtime::kStoreLookupSlot, value, context, name, |
| 466 language_mode_node); |
| 467 __ SetAccumulator(result); |
| 468 __ Dispatch(); |
| 469 } |
| 470 |
| 471 |
| 472 // StaLookupSlotSloppy <name_index> |
| 473 // |
| 474 // Store the object in accumulator to the object with the name in constant |
| 475 // pool entry |name_index| in sloppy mode. |
| 476 void Interpreter::DoStaLookupSlotSloppy( |
| 477 compiler::InterpreterAssembler* assembler) { |
| 478 StaLookupSlotHelper(LanguageMode::SLOPPY, assembler); |
| 479 } |
| 480 |
| 481 |
| 482 // StaLookupSlotStrict <name_index> |
| 483 // |
| 484 // Store the object in accumulator to the object with the name in constant |
| 485 // pool entry |name_index| in strict mode. |
| 486 void Interpreter::DoStaLookupSlotStrict( |
| 487 compiler::InterpreterAssembler* assembler) { |
| 488 StaLookupSlotHelper(LanguageMode::STRICT, assembler); |
| 489 } |
| 490 |
| 491 |
| 426 void Interpreter::DoLoadIC(Callable ic, | 492 void Interpreter::DoLoadIC(Callable ic, |
| 427 compiler::InterpreterAssembler* assembler) { | 493 compiler::InterpreterAssembler* assembler) { |
| 428 Node* code_target = __ HeapConstant(ic.code()); | 494 Node* code_target = __ HeapConstant(ic.code()); |
| 429 Node* register_index = __ BytecodeOperandReg(0); | 495 Node* register_index = __ BytecodeOperandReg(0); |
| 430 Node* object = __ LoadRegister(register_index); | 496 Node* object = __ LoadRegister(register_index); |
| 431 Node* constant_index = __ BytecodeOperandIdx(1); | 497 Node* constant_index = __ BytecodeOperandIdx(1); |
| 432 Node* name = __ LoadConstantPoolEntry(constant_index); | 498 Node* name = __ LoadConstantPoolEntry(constant_index); |
| 433 Node* raw_slot = __ BytecodeOperandIdx(2); | 499 Node* raw_slot = __ BytecodeOperandIdx(2); |
| 434 Node* smi_slot = __ SmiTag(raw_slot); | 500 Node* smi_slot = __ SmiTag(raw_slot); |
| 435 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 501 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); | 1563 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); |
| 1498 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); | 1564 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); |
| 1499 __ SetAccumulator(result); | 1565 __ SetAccumulator(result); |
| 1500 __ Dispatch(); | 1566 __ Dispatch(); |
| 1501 } | 1567 } |
| 1502 | 1568 |
| 1503 | 1569 |
| 1504 } // namespace interpreter | 1570 } // namespace interpreter |
| 1505 } // namespace internal | 1571 } // namespace internal |
| 1506 } // namespace v8 | 1572 } // namespace v8 |
| OLD | NEW |