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

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1392913002: [Interpreter] Adds shift operators to interpreter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed a typo in comment Created 5 years, 2 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/interpreter/bytecodes.h ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('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/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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 368
369 369
370 // Mod <src> 370 // Mod <src>
371 // 371 //
372 // Modulo register <src> by accumulator. 372 // Modulo register <src> by accumulator.
373 void Interpreter::DoMod(compiler::InterpreterAssembler* assembler) { 373 void Interpreter::DoMod(compiler::InterpreterAssembler* assembler) {
374 DoBinaryOp(Runtime::kModulus, assembler); 374 DoBinaryOp(Runtime::kModulus, assembler);
375 } 375 }
376 376
377 377
378 // ShiftLeft <src>
379 //
380 // Left shifts accumulator by the count specified in register <src>.
rmcilroy 2015/10/08 14:53:07 "accumulator" -> "the accumulator"
oth 2015/10/08 16:11:38 Shouldn't it be Left shifts the register <src> by
381 // accumulator is converted to a int32 and register <src> to uint32
rmcilroy 2015/10/08 14:53:07 nit "accumulator" -> "The accumulator" (it's the s
rmcilroy 2015/10/08 14:53:07 nit - a int32 -> an int32
382 // before the operation. 5 lsb bits from register <src> are used as count.
rmcilroy 2015/10/08 14:53:07 nit - move "." from after "count" to after "0x1F)"
383 // i.e. accumulator << (<src> & 0x1F)
384 void Interpreter::DoShiftLeft(compiler::InterpreterAssembler* assembler) {
385 DoBinaryOp(Runtime::kShiftLeft, assembler);
386 }
387
388
389 // ShiftRight <src>
390 //
391 // Right shifts accumulator by the count specified in register <src>.
392 // Result is sign extended.
rmcilroy 2015/10/08 14:53:07 Same comments here. Also, either bring the next se
393 // accumulator is converted to a int32 and register <src> to uint32
394 // before the operation. 5 lsb bits from register <src> are used as count.
395 // i.e. accumulator >> (<src> & 0x1F)
396 void Interpreter::DoShiftRight(compiler::InterpreterAssembler* assembler) {
397 DoBinaryOp(Runtime::kShiftRight, assembler);
398 }
399
400
401 // ShiftRightLogical <src>
402 //
403 // Right Shifts accumulator by the count specified in register <src>.
404 // Result is zero-filled.
rmcilroy 2015/10/08 14:53:07 ditto
405 // accumulator and register <src> are converted to uint32 before the operation
406 // lsb bits from register <src> are used as count.
407 // i.e. accumulator >> (<src> & 0x1F)
408 void Interpreter::DoShiftRightLogical(
409 compiler::InterpreterAssembler* assembler) {
410 DoBinaryOp(Runtime::kShiftRightLogical, assembler);
411 }
412
413
378 // LogicalNot 414 // LogicalNot
379 // 415 //
380 // Perform logical-not on the accumulator, first casting the 416 // Perform logical-not on the accumulator, first casting the
381 // accumulator to a boolean value if required. 417 // accumulator to a boolean value if required.
382 void Interpreter::DoLogicalNot(compiler::InterpreterAssembler* assembler) { 418 void Interpreter::DoLogicalNot(compiler::InterpreterAssembler* assembler) {
383 Node* accumulator = __ GetAccumulator(); 419 Node* accumulator = __ GetAccumulator();
384 Node* result = __ CallRuntime(Runtime::kInterpreterLogicalNot, accumulator); 420 Node* result = __ CallRuntime(Runtime::kInterpreterLogicalNot, accumulator);
385 __ SetAccumulator(result); 421 __ SetAccumulator(result);
386 __ Dispatch(); 422 __ Dispatch();
387 } 423 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 // 644 //
609 // Return the value in the accumulator. 645 // Return the value in the accumulator.
610 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { 646 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
611 __ Return(); 647 __ Return();
612 } 648 }
613 649
614 650
615 } // namespace interpreter 651 } // namespace interpreter
616 } // namespace internal 652 } // namespace internal
617 } // namespace v8 653 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698