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

Side by Side Diff: src/interpreter/bytecode-array-builder.cc

Issue 1300813005: [Interpreter] Add implementations of arithmetic binary op bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@mstar_v8h
Patch Set: Fix unittest too... Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/compiler/raw-machine-assembler.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bytecode-array-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace interpreter { 9 namespace interpreter {
10 10
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 Bytecode BytecodeArrayBuilder::BytecodeForBinaryOperation(Token::Value op) { 186 Bytecode BytecodeArrayBuilder::BytecodeForBinaryOperation(Token::Value op) {
187 switch (op) { 187 switch (op) {
188 case Token::Value::ADD: 188 case Token::Value::ADD:
189 return Bytecode::kAdd; 189 return Bytecode::kAdd;
190 case Token::Value::SUB: 190 case Token::Value::SUB:
191 return Bytecode::kSub; 191 return Bytecode::kSub;
192 case Token::Value::MUL: 192 case Token::Value::MUL:
193 return Bytecode::kMul; 193 return Bytecode::kMul;
194 case Token::Value::DIV: 194 case Token::Value::DIV:
195 return Bytecode::kDiv; 195 return Bytecode::kDiv;
196 case Token::Value::MOD:
197 return Bytecode::kMod;
196 default: 198 default:
197 UNIMPLEMENTED(); 199 UNIMPLEMENTED();
198 return static_cast<Bytecode>(-1); 200 return static_cast<Bytecode>(-1);
199 } 201 }
200 } 202 }
201 203
202 204
203 TemporaryRegisterScope::TemporaryRegisterScope(BytecodeArrayBuilder* builder) 205 TemporaryRegisterScope::TemporaryRegisterScope(BytecodeArrayBuilder* builder)
204 : builder_(builder), count_(0), last_register_index_(-1) {} 206 : builder_(builder), count_(0), last_register_index_(-1) {}
205 207
206 208
207 TemporaryRegisterScope::~TemporaryRegisterScope() { 209 TemporaryRegisterScope::~TemporaryRegisterScope() {
208 while (count_-- != 0) { 210 while (count_-- != 0) {
209 builder_->ReturnTemporaryRegister(last_register_index_--); 211 builder_->ReturnTemporaryRegister(last_register_index_--);
210 } 212 }
211 } 213 }
212 214
213 215
214 Register TemporaryRegisterScope::NewRegister() { 216 Register TemporaryRegisterScope::NewRegister() {
215 count_++; 217 count_++;
216 last_register_index_ = builder_->BorrowTemporaryRegister(); 218 last_register_index_ = builder_->BorrowTemporaryRegister();
217 return Register(last_register_index_); 219 return Register(last_register_index_);
218 } 220 }
219 221
220 } // namespace interpreter 222 } // namespace interpreter
221 } // namespace internal 223 } // namespace internal
222 } // namespace v8 224 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698