OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/interpreter/bytecode-array-builder.h" | 7 #include "src/interpreter/bytecode-array-builder.h" |
8 #include "src/interpreter/bytecode-array-iterator.h" | 8 #include "src/interpreter/bytecode-array-iterator.h" |
9 #include "src/interpreter/bytecode-label.h" | 9 #include "src/interpreter/bytecode-label.h" |
10 #include "src/interpreter/bytecode-register-allocator.h" | 10 #include "src/interpreter/bytecode-register-allocator.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 .LoadNull() | 201 .LoadNull() |
202 .CompareOperation(Token::Value::EQ, reg, 1); | 202 .CompareOperation(Token::Value::EQ, reg, 1); |
203 | 203 |
204 // Emit conversion operator invocations. | 204 // Emit conversion operator invocations. |
205 builder.ConvertAccumulatorToNumber(reg) | 205 builder.ConvertAccumulatorToNumber(reg) |
206 .ConvertAccumulatorToObject(reg) | 206 .ConvertAccumulatorToObject(reg) |
207 .ConvertAccumulatorToName(reg); | 207 .ConvertAccumulatorToName(reg); |
208 | 208 |
209 // Short jumps with Imm8 operands | 209 // Short jumps with Imm8 operands |
210 { | 210 { |
211 BytecodeLabel start, after_jump1, after_jump2, after_jump3, after_jump4; | 211 BytecodeLabel start, after_jump1, after_jump2, after_jump3, after_jump4, |
| 212 after_jump5; |
212 builder.Bind(&start) | 213 builder.Bind(&start) |
213 .Jump(&after_jump1) | 214 .Jump(&after_jump1) |
214 .Bind(&after_jump1) | 215 .Bind(&after_jump1) |
215 .JumpIfNull(&after_jump2) | 216 .JumpIfNull(&after_jump2) |
216 .Bind(&after_jump2) | 217 .Bind(&after_jump2) |
217 .JumpIfUndefined(&after_jump3) | 218 .JumpIfUndefined(&after_jump3) |
218 .Bind(&after_jump3) | 219 .Bind(&after_jump3) |
219 .JumpIfNotHole(&after_jump4) | 220 .JumpIfNotHole(&after_jump4) |
220 .Bind(&after_jump4) | 221 .Bind(&after_jump4) |
| 222 .JumpIfJSReceiver(&after_jump5) |
| 223 .Bind(&after_jump5) |
221 .JumpLoop(&start, 0); | 224 .JumpLoop(&start, 0); |
222 } | 225 } |
223 | 226 |
224 // Longer jumps with constant operands | 227 // Longer jumps with constant operands |
225 BytecodeLabel end[8]; | 228 BytecodeLabel end[9]; |
226 { | 229 { |
227 BytecodeLabel after_jump; | 230 BytecodeLabel after_jump; |
228 builder.Jump(&end[0]) | 231 builder.Jump(&end[0]) |
229 .Bind(&after_jump) | 232 .Bind(&after_jump) |
230 .LoadTrue() | 233 .LoadTrue() |
231 .JumpIfTrue(&end[1]) | 234 .JumpIfTrue(&end[1]) |
232 .LoadTrue() | 235 .LoadTrue() |
233 .JumpIfFalse(&end[2]) | 236 .JumpIfFalse(&end[2]) |
234 .LoadLiteral(Smi::kZero) | 237 .LoadLiteral(Smi::kZero) |
235 .JumpIfTrue(&end[3]) | 238 .JumpIfTrue(&end[3]) |
236 .LoadLiteral(Smi::kZero) | 239 .LoadLiteral(Smi::kZero) |
237 .JumpIfFalse(&end[4]) | 240 .JumpIfFalse(&end[4]) |
238 .JumpIfNull(&end[5]) | 241 .JumpIfNull(&end[5]) |
239 .JumpIfUndefined(&end[6]) | 242 .JumpIfUndefined(&end[6]) |
240 .JumpIfNotHole(&end[7]); | 243 .JumpIfNotHole(&end[7]) |
| 244 .LoadLiteral(factory->prototype_string()) |
| 245 .JumpIfJSReceiver(&end[8]); |
241 } | 246 } |
242 | 247 |
243 // Perform an operation that returns boolean value to | 248 // Perform an operation that returns boolean value to |
244 // generate JumpIfTrue/False | 249 // generate JumpIfTrue/False |
245 { | 250 { |
246 BytecodeLabel after_jump1, after_jump2; | 251 BytecodeLabel after_jump1, after_jump2; |
247 builder.CompareOperation(Token::Value::EQ, reg, 1) | 252 builder.CompareOperation(Token::Value::EQ, reg, 1) |
248 .JumpIfTrue(&after_jump1) | 253 .JumpIfTrue(&after_jump1) |
249 .Bind(&after_jump1) | 254 .Bind(&after_jump1) |
250 .CompareOperation(Token::Value::EQ, reg, 2) | 255 .CompareOperation(Token::Value::EQ, reg, 2) |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 iterator.Advance(); | 742 iterator.Advance(); |
738 } | 743 } |
739 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 744 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
740 iterator.Advance(); | 745 iterator.Advance(); |
741 CHECK(iterator.done()); | 746 CHECK(iterator.done()); |
742 } | 747 } |
743 | 748 |
744 } // namespace interpreter | 749 } // namespace interpreter |
745 } // namespace internal | 750 } // namespace internal |
746 } // namespace v8 | 751 } // namespace v8 |
OLD | NEW |