Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: src/interpreter/interpreter.cc

Issue 1294793002: [Interpreter] Add implementations for load immediate bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@interpreter_accum
Patch Set: Rebased Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/interpreter-assembler.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 6167efe4befc7e1e60f2b2d79d563d66c86a40b8..565fa0c443942b5746884904b8deed87d4ff4a8f 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -89,7 +89,8 @@ bool Interpreter::IsInterpreterTableInitialized(
//
// Load literal '0' into the accumulator.
void Interpreter::DoLdaZero(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ Node* zero_value = __ NumberConstant(0.0);
+ __ SetAccumulator(zero_value);
__ Dispatch();
}
@@ -98,7 +99,9 @@ void Interpreter::DoLdaZero(compiler::InterpreterAssembler* assembler) {
//
// Load an 8-bit integer literal into the accumulator as a Smi.
void Interpreter::DoLdaSmi8(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement 8-bit integer to SMI promotion.
+ Node* raw_int = __ BytecodeOperandImm8(0);
+ Node* smi_int = __ SmiTag(raw_int);
+ __ SetAccumulator(smi_int);
__ Dispatch();
}
@@ -107,7 +110,9 @@ void Interpreter::DoLdaSmi8(compiler::InterpreterAssembler* assembler) {
//
// Load Undefined into the accumulator.
void Interpreter::DoLdaUndefined(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ Node* undefined_value = __ HeapConstant(Unique<HeapObject>::CreateImmovable(
+ isolate_->factory()->undefined_value()));
+ __ SetAccumulator(undefined_value);
__ Dispatch();
}
@@ -116,7 +121,9 @@ void Interpreter::DoLdaUndefined(compiler::InterpreterAssembler* assembler) {
//
// Load Null into the accumulator.
void Interpreter::DoLdaNull(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ Node* null_value = __ HeapConstant(
+ Unique<HeapObject>::CreateImmovable(isolate_->factory()->null_value()));
+ __ SetAccumulator(null_value);
__ Dispatch();
}
@@ -125,7 +132,9 @@ void Interpreter::DoLdaNull(compiler::InterpreterAssembler* assembler) {
//
// Load TheHole into the accumulator.
void Interpreter::DoLdaTheHole(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ Node* the_hole_value = __ HeapConstant(Unique<HeapObject>::CreateImmovable(
+ isolate_->factory()->the_hole_value()));
+ __ SetAccumulator(the_hole_value);
__ Dispatch();
}
@@ -134,7 +143,9 @@ void Interpreter::DoLdaTheHole(compiler::InterpreterAssembler* assembler) {
//
// Load True into the accumulator.
void Interpreter::DoLdaTrue(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ Node* true_value = __ HeapConstant(
+ Unique<HeapObject>::CreateImmovable(isolate_->factory()->true_value()));
+ __ SetAccumulator(true_value);
__ Dispatch();
}
@@ -143,7 +154,9 @@ void Interpreter::DoLdaTrue(compiler::InterpreterAssembler* assembler) {
//
// Load False into the accumulator.
void Interpreter::DoLdaFalse(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ Node* false_value = __ HeapConstant(
+ Unique<HeapObject>::CreateImmovable(isolate_->factory()->false_value()));
+ __ SetAccumulator(false_value);
__ Dispatch();
}
@@ -152,7 +165,8 @@ void Interpreter::DoLdaFalse(compiler::InterpreterAssembler* assembler) {
//
// Load accumulator with value from register <src>.
void Interpreter::DoLdar(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ Node* value = __ LoadRegister(__ BytecodeOperandReg(0));
+ __ SetAccumulator(value);
__ Dispatch();
}
@@ -161,7 +175,9 @@ void Interpreter::DoLdar(compiler::InterpreterAssembler* assembler) {
//
// Store accumulator to register <dst>.
void Interpreter::DoStar(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ Node* reg_index = __ BytecodeOperandReg(0);
+ Node* accumulator = __ GetAccumulator();
+ __ StoreRegister(accumulator, reg_index);
__ Dispatch();
}
« no previous file with comments | « src/compiler/interpreter-assembler.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698