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