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

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

Issue 1604923002: [Interpreter] Always store current context in the frames context slot. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_fix_block_context_scope
Patch Set: Rebase Created 4 years, 11 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/interpreter.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/bytecodes.h" 5 #include "src/interpreter/bytecodes.h"
6 6
7 #include "src/frames.h" 7 #include "src/frames.h"
8 #include "src/interpreter/bytecode-traits.h" 8 #include "src/interpreter/bytecode-traits.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 os << "[" << ReadUnalignedUInt16(operand_start) << "]"; 287 os << "[" << ReadUnalignedUInt16(operand_start) << "]";
288 break; 288 break;
289 case interpreter::OperandType::kImm8: 289 case interpreter::OperandType::kImm8:
290 os << "#" << static_cast<int>(static_cast<int8_t>(*operand_start)); 290 os << "#" << static_cast<int>(static_cast<int8_t>(*operand_start));
291 break; 291 break;
292 case interpreter::OperandType::kMaybeReg8: 292 case interpreter::OperandType::kMaybeReg8:
293 case interpreter::OperandType::kMaybeReg16: 293 case interpreter::OperandType::kMaybeReg16:
294 case interpreter::OperandType::kReg8: 294 case interpreter::OperandType::kReg8:
295 case interpreter::OperandType::kReg16: { 295 case interpreter::OperandType::kReg16: {
296 Register reg = DecodeRegister(operand_start, op_type); 296 Register reg = DecodeRegister(operand_start, op_type);
297 if (reg.is_function_context()) { 297 if (reg.is_current_context()) {
298 os << "<context>"; 298 os << "<context>";
299 } else if (reg.is_function_closure()) { 299 } else if (reg.is_function_closure()) {
300 os << "<closure>"; 300 os << "<closure>";
301 } else if (reg.is_new_target()) { 301 } else if (reg.is_new_target()) {
302 os << "<new.target>"; 302 os << "<new.target>";
303 } else if (reg.is_parameter()) { 303 } else if (reg.is_parameter()) {
304 int parameter_index = reg.ToParameterIndex(parameter_count); 304 int parameter_index = reg.ToParameterIndex(parameter_count);
305 if (parameter_index == 0) { 305 if (parameter_index == 0) {
306 os << "<this>"; 306 os << "<this>";
307 } else { 307 } else {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size) { 352 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size) {
353 return os << Bytecodes::OperandSizeToString(operand_size); 353 return os << Bytecodes::OperandSizeToString(operand_size);
354 } 354 }
355 355
356 356
357 static const int kLastParamRegisterIndex = 357 static const int kLastParamRegisterIndex =
358 -InterpreterFrameConstants::kLastParamFromRegisterPointer / kPointerSize; 358 -InterpreterFrameConstants::kLastParamFromRegisterPointer / kPointerSize;
359 static const int kFunctionClosureRegisterIndex = 359 static const int kFunctionClosureRegisterIndex =
360 -InterpreterFrameConstants::kFunctionFromRegisterPointer / kPointerSize; 360 -InterpreterFrameConstants::kFunctionFromRegisterPointer / kPointerSize;
361 static const int kFunctionContextRegisterIndex = 361 static const int kCurrentContextRegisterIndex =
362 -InterpreterFrameConstants::kContextFromRegisterPointer / kPointerSize; 362 -InterpreterFrameConstants::kContextFromRegisterPointer / kPointerSize;
363 static const int kNewTargetRegisterIndex = 363 static const int kNewTargetRegisterIndex =
364 -InterpreterFrameConstants::kNewTargetFromRegisterPointer / kPointerSize; 364 -InterpreterFrameConstants::kNewTargetFromRegisterPointer / kPointerSize;
365 365
366 366
367 // Registers occupy range 0-127 in 8-bit value leaving 128 unused values. 367 // Registers occupy range 0-127 in 8-bit value leaving 128 unused values.
368 // Parameter indices are biased with the negative value kLastParamRegisterIndex 368 // Parameter indices are biased with the negative value kLastParamRegisterIndex
369 // for ease of access in the interpreter. 369 // for ease of access in the interpreter.
370 static const int kMaxParameterIndex = 128 + kLastParamRegisterIndex; 370 static const int kMaxParameterIndex = 128 + kLastParamRegisterIndex;
371 371
(...skipping 18 matching lines...) Expand all
390 Register Register::function_closure() { 390 Register Register::function_closure() {
391 return Register(kFunctionClosureRegisterIndex); 391 return Register(kFunctionClosureRegisterIndex);
392 } 392 }
393 393
394 394
395 bool Register::is_function_closure() const { 395 bool Register::is_function_closure() const {
396 return index() == kFunctionClosureRegisterIndex; 396 return index() == kFunctionClosureRegisterIndex;
397 } 397 }
398 398
399 399
400 Register Register::function_context() { 400 Register Register::current_context() {
401 return Register(kFunctionContextRegisterIndex); 401 return Register(kCurrentContextRegisterIndex);
402 } 402 }
403 403
404 404
405 bool Register::is_function_context() const { 405 bool Register::is_current_context() const {
406 return index() == kFunctionContextRegisterIndex; 406 return index() == kCurrentContextRegisterIndex;
407 } 407 }
408 408
409 409
410 Register Register::new_target() { return Register(kNewTargetRegisterIndex); } 410 Register Register::new_target() { return Register(kNewTargetRegisterIndex); }
411 411
412 412
413 bool Register::is_new_target() const { 413 bool Register::is_new_target() const {
414 return index() == kNewTargetRegisterIndex; 414 return index() == kNewTargetRegisterIndex;
415 } 415 }
416 416
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 465 }
466 if (reg5.is_valid() && reg4.index() + 1 != reg5.index()) { 466 if (reg5.is_valid() && reg4.index() + 1 != reg5.index()) {
467 return false; 467 return false;
468 } 468 }
469 return true; 469 return true;
470 } 470 }
471 471
472 } // namespace interpreter 472 } // namespace interpreter
473 } // namespace internal 473 } // namespace internal
474 } // namespace v8 474 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698