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

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: 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
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 4f961318085e12bbf63f5d336d006ddda14c909d..dafb6117b649ce77bf5d706448d81f488b56046a 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -67,7 +67,7 @@ bool Interpreter::IsInterpreterTableInitialized(
//
// Load literal '0' into the accumulator.
void Interpreter::DoLdaZero(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ __ SetAccumulator(__ NumberConstant(0.0));
__ Dispatch();
}
@@ -76,7 +76,8 @@ 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);
+ __ SetAccumulator(__ SmiTag(raw_int));
__ Dispatch();
}
@@ -85,7 +86,8 @@ void Interpreter::DoLdaSmi8(compiler::InterpreterAssembler* assembler) {
//
// Load Undefined into the accumulator.
void Interpreter::DoLdaUndefined(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ __ SetAccumulator(__ HeapConstant(Unique<HeapObject>::CreateImmovable(
+ isolate_->factory()->undefined_value())));
__ Dispatch();
}
@@ -94,7 +96,8 @@ void Interpreter::DoLdaUndefined(compiler::InterpreterAssembler* assembler) {
//
// Load Null into the accumulator.
void Interpreter::DoLdaNull(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ __ SetAccumulator(__ HeapConstant(
+ Unique<HeapObject>::CreateImmovable(isolate_->factory()->null_value())));
__ Dispatch();
}
@@ -103,7 +106,8 @@ void Interpreter::DoLdaNull(compiler::InterpreterAssembler* assembler) {
//
// Load TheHole into the accumulator.
void Interpreter::DoLdaTheHole(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ __ SetAccumulator(__ HeapConstant(Unique<HeapObject>::CreateImmovable(
+ isolate_->factory()->the_hole_value())));
__ Dispatch();
}
@@ -112,7 +116,8 @@ void Interpreter::DoLdaTheHole(compiler::InterpreterAssembler* assembler) {
//
// Load True into the accumulator.
void Interpreter::DoLdaTrue(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ __ SetAccumulator(__ HeapConstant(
+ Unique<HeapObject>::CreateImmovable(isolate_->factory()->true_value())));
__ Dispatch();
}
@@ -121,7 +126,8 @@ void Interpreter::DoLdaTrue(compiler::InterpreterAssembler* assembler) {
//
// Load False into the accumulator.
void Interpreter::DoLdaFalse(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ __ SetAccumulator(__ HeapConstant(
+ Unique<HeapObject>::CreateImmovable(isolate_->factory()->false_value())));
__ Dispatch();
}
@@ -130,7 +136,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();
}
@@ -139,7 +146,7 @@ void Interpreter::DoLdar(compiler::InterpreterAssembler* assembler) {
//
// Store accumulator to register <dst>.
void Interpreter::DoStar(compiler::InterpreterAssembler* assembler) {
- // TODO(rmcilroy) Implement.
+ __ StoreRegister(__ GetAccumulator(), __ BytecodeOperandReg(0));
Michael Starzinger 2015/08/17 08:22:34 This pattern looks dangerous, note that C++ does n
rmcilroy 2015/08/18 13:06:22 Yeah good point. Note, in this case it doesn't mat
__ Dispatch();
}

Powered by Google App Engine
This is Rietveld 408576698