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 // LdaLookupSlot <name_index> <context> |
| 427 // |
| 428 // Lookup the object with the name in constant pool entry |name_index| |
| 429 // dynamically. |
| 430 void Interpreter::DoLdaLookupSlot(compiler::InterpreterAssembler* assembler) { |
| 431 Node* index = __ BytecodeOperandIdx(0); |
| 432 Node* name = __ LoadConstantPoolEntry(index); |
| 433 Node* reg_index = __ BytecodeOperandReg(1); |
| 434 Node* context = __ LoadRegister(reg_index); |
| 435 Node* result = |
| 436 __ CallRuntime(Runtime::kInterpreterLoadLookupSlotCallee, context, name); |
| 437 __ SetAccumulator(result); |
| 438 __ Dispatch(); |
| 439 } |
| 440 |
| 441 |
| 442 // LdaLookupSlotInsideTypeof <name_index> <context> |
| 443 // |
| 444 // Lookup the object with the name in constant pool entry |name_index| |
| 445 // dynamically without causing a NoReferenceError. |
| 446 void Interpreter::DoLdaLookupSlotInsideTypeof( |
| 447 compiler::InterpreterAssembler* assembler) { |
| 448 Node* index = __ BytecodeOperandIdx(0); |
| 449 Node* name = __ LoadConstantPoolEntry(index); |
| 450 Node* reg_index = __ BytecodeOperandReg(1); |
| 451 Node* context = __ LoadRegister(reg_index); |
| 452 Node* result = __ CallRuntime( |
| 453 Runtime::kInterpreterLoadLookupSlotNoReferenceErrorValue, context, name); |
| 454 __ SetAccumulator(result); |
| 455 __ Dispatch(); |
| 456 } |
| 457 |
| 458 |
| 459 // StaLookupSlotSloppy <name_index> <context> |
| 460 // |
| 461 // Store the object in accumulator to the object with the name in constant |
| 462 // pool entry |name_index| in sloppy mode. |
| 463 void Interpreter::DoStaLookupSlotSloppy( |
| 464 compiler::InterpreterAssembler* assembler) { |
| 465 Node* value = __ GetAccumulator(); |
| 466 Node* index = __ BytecodeOperandIdx(0); |
| 467 Node* name = __ LoadConstantPoolEntry(index); |
| 468 Node* reg_index = __ BytecodeOperandReg(1); |
| 469 Node* context = __ LoadRegister(reg_index); |
| 470 Node* language_mode = __ NumberConstant(LanguageMode::SLOPPY); |
| 471 Node* result = __ CallRuntime(Runtime::kStoreLookupSlot, value, context, name, |
| 472 language_mode); |
| 473 __ SetAccumulator(result); |
| 474 __ Dispatch(); |
| 475 } |
| 476 |
| 477 |
| 478 // StaLookupSlotStrict <name_index> <context> |
| 479 // |
| 480 // Store the object in accumulator to the object with the name in constant |
| 481 // pool entry |name_index| in strict mode. |
| 482 void Interpreter::DoStaLookupSlotStrict( |
| 483 compiler::InterpreterAssembler* assembler) { |
| 484 Node* value = __ GetAccumulator(); |
| 485 Node* index = __ BytecodeOperandIdx(0); |
| 486 Node* name = __ LoadConstantPoolEntry(index); |
| 487 Node* reg_index = __ BytecodeOperandReg(1); |
| 488 Node* context = __ LoadRegister(reg_index); |
| 489 Node* language_mode = __ NumberConstant(LanguageMode::STRICT); |
| 490 Node* result = __ CallRuntime(Runtime::kStoreLookupSlot, value, context, name, |
| 491 language_mode); |
| 492 __ SetAccumulator(result); |
| 493 __ Dispatch(); |
| 494 } |
| 495 |
| 496 |
426 void Interpreter::DoLoadIC(Callable ic, | 497 void Interpreter::DoLoadIC(Callable ic, |
427 compiler::InterpreterAssembler* assembler) { | 498 compiler::InterpreterAssembler* assembler) { |
428 Node* code_target = __ HeapConstant(ic.code()); | 499 Node* code_target = __ HeapConstant(ic.code()); |
429 Node* register_index = __ BytecodeOperandReg(0); | 500 Node* register_index = __ BytecodeOperandReg(0); |
430 Node* object = __ LoadRegister(register_index); | 501 Node* object = __ LoadRegister(register_index); |
431 Node* constant_index = __ BytecodeOperandIdx(1); | 502 Node* constant_index = __ BytecodeOperandIdx(1); |
432 Node* name = __ LoadConstantPoolEntry(constant_index); | 503 Node* name = __ LoadConstantPoolEntry(constant_index); |
433 Node* raw_slot = __ BytecodeOperandIdx(2); | 504 Node* raw_slot = __ BytecodeOperandIdx(2); |
434 Node* smi_slot = __ SmiTag(raw_slot); | 505 Node* smi_slot = __ SmiTag(raw_slot); |
435 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 506 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); | 1568 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); |
1498 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); | 1569 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); |
1499 __ SetAccumulator(result); | 1570 __ SetAccumulator(result); |
1500 __ Dispatch(); | 1571 __ Dispatch(); |
1501 } | 1572 } |
1502 | 1573 |
1503 | 1574 |
1504 } // namespace interpreter | 1575 } // namespace interpreter |
1505 } // namespace internal | 1576 } // namespace internal |
1506 } // namespace v8 | 1577 } // namespace v8 |
OLD | NEW |