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

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

Issue 1373903005: [Interpreter] Add for/while/do support to the bytecode generator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. 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') | src/interpreter/control-flow-builders.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/bytecodes.h" 5 #include "src/interpreter/bytecodes.h"
6 6
7 #include "src/frames.h" 7 #include "src/frames.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 // static 97 // static
98 int Bytecodes::MaximumNumberOfOperands() { return kMaxOperands; } 98 int Bytecodes::MaximumNumberOfOperands() { return kMaxOperands; }
99 99
100 100
101 // static 101 // static
102 int Bytecodes::MaximumSize() { return 1 + kMaxOperands; } 102 int Bytecodes::MaximumSize() { return 1 + kMaxOperands; }
103 103
104 104
105 // static 105 // static
106 bool Bytecodes::IsJump(Bytecode bytecode) {
107 return bytecode == Bytecode::kJump || bytecode == Bytecode::kJumpIfTrue ||
108 bytecode == Bytecode::kJumpIfFalse;
109 }
110
111
112 // static
113 bool Bytecodes::IsJumpConstant(Bytecode bytecode) {
114 return bytecode == Bytecode::kJumpConstant ||
115 bytecode == Bytecode::kJumpIfTrueConstant ||
116 bytecode == Bytecode::kJumpIfFalseConstant;
117 }
118
119
120 // static
106 std::ostream& Bytecodes::Decode(std::ostream& os, const uint8_t* bytecode_start, 121 std::ostream& Bytecodes::Decode(std::ostream& os, const uint8_t* bytecode_start,
107 int parameter_count) { 122 int parameter_count) {
108 Vector<char> buf = Vector<char>::New(50); 123 Vector<char> buf = Vector<char>::New(50);
109 124
110 Bytecode bytecode = Bytecodes::FromByte(bytecode_start[0]); 125 Bytecode bytecode = Bytecodes::FromByte(bytecode_start[0]);
111 int bytecode_size = Bytecodes::Size(bytecode); 126 int bytecode_size = Bytecodes::Size(bytecode);
112 127
113 for (int i = 0; i < bytecode_size; i++) { 128 for (int i = 0; i < bytecode_size; i++) {
114 SNPrintF(buf, "%02x ", bytecode_start[i]); 129 SNPrintF(buf, "%02x ", bytecode_start[i]);
115 os << buf.start(); 130 os << buf.start();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 uint8_t Register::ToOperand() const { return static_cast<uint8_t>(-index_); } 219 uint8_t Register::ToOperand() const { return static_cast<uint8_t>(-index_); }
205 220
206 221
207 Register Register::FromOperand(uint8_t operand) { 222 Register Register::FromOperand(uint8_t operand) {
208 return Register(-static_cast<int8_t>(operand)); 223 return Register(-static_cast<int8_t>(operand));
209 } 224 }
210 225
211 } // namespace interpreter 226 } // namespace interpreter
212 } // namespace internal 227 } // namespace internal
213 } // namespace v8 228 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/interpreter/control-flow-builders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698