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

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

Issue 1894063002: [Interpreter] Remove register file register and replace with LoadParentFramePointer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix gcc Created 4 years, 8 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/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.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 #ifndef V8_INTERPRETER_BYTECODES_H_ 5 #ifndef V8_INTERPRETER_BYTECODES_H_
6 #define V8_INTERPRETER_BYTECODES_H_ 6 #define V8_INTERPRETER_BYTECODES_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 // Clients of this interface shouldn't depend on lots of interpreter internals. 10 // Clients of this interface shouldn't depend on lots of interpreter internals.
11 // Do not include anything from src/interpreter here! 11 // Do not include anything from src/interpreter here!
12 #include "src/frames.h"
12 #include "src/utils.h" 13 #include "src/utils.h"
13 14
14 namespace v8 { 15 namespace v8 {
15 namespace internal { 16 namespace internal {
16 namespace interpreter { 17 namespace interpreter {
17 18
18 #define INVALID_OPERAND_TYPE_LIST(V) V(None, OperandTypeInfo::kNone) 19 #define INVALID_OPERAND_TYPE_LIST(V) V(None, OperandTypeInfo::kNone)
19 20
20 #define REGISTER_INPUT_OPERAND_TYPE_LIST(V) \ 21 #define REGISTER_INPUT_OPERAND_TYPE_LIST(V) \
21 V(MaybeReg, OperandTypeInfo::kScalableSignedByte) \ 22 V(MaybeReg, OperandTypeInfo::kScalableSignedByte) \
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 329
329 // An interpreter Register which is located in the function's Register file 330 // An interpreter Register which is located in the function's Register file
330 // in its stack-frame. Register hold parameters, this, and expression values. 331 // in its stack-frame. Register hold parameters, this, and expression values.
331 class Register { 332 class Register {
332 public: 333 public:
333 explicit Register(int index = kInvalidIndex) : index_(index) {} 334 explicit Register(int index = kInvalidIndex) : index_(index) {}
334 335
335 int index() const { return index_; } 336 int index() const { return index_; }
336 bool is_parameter() const { return index() < 0; } 337 bool is_parameter() const { return index() < 0; }
337 bool is_valid() const { return index_ != kInvalidIndex; } 338 bool is_valid() const { return index_ != kInvalidIndex; }
338 bool is_byte_operand() const;
339 bool is_short_operand() const;
340 339
341 static Register FromParameterIndex(int index, int parameter_count); 340 static Register FromParameterIndex(int index, int parameter_count);
342 int ToParameterIndex(int parameter_count) const; 341 int ToParameterIndex(int parameter_count) const;
343 342
344 // Returns an invalid register. 343 // Returns an invalid register.
345 static Register invalid_value() { return Register(); } 344 static Register invalid_value() { return Register(); }
346 345
347 // Returns the register for the function's closure object. 346 // Returns the register for the function's closure object.
348 static Register function_closure(); 347 static Register function_closure();
349 bool is_function_closure() const; 348 bool is_function_closure() const;
350 349
351 // Returns the register which holds the current context object. 350 // Returns the register which holds the current context object.
352 static Register current_context(); 351 static Register current_context();
353 bool is_current_context() const; 352 bool is_current_context() const;
354 353
355 // Returns the register for the incoming new target value. 354 // Returns the register for the incoming new target value.
356 static Register new_target(); 355 static Register new_target();
357 bool is_new_target() const; 356 bool is_new_target() const;
358 357
359 int32_t ToOperand() const { return -index_; } 358 // Returns the register for the bytecode array.
360 static Register FromOperand(int32_t operand) { return Register(-operand); } 359 static Register bytecode_array();
360 bool is_bytecode_array() const;
361
362 // Returns the register for the saved bytecode offset.
363 static Register bytecode_offset();
364 bool is_bytecode_offset() const;
365
366 OperandSize SizeOfOperand() const;
367
368 int32_t ToOperand() const { return kRegisterFileStartOffset - index_; }
369 static Register FromOperand(int32_t operand) {
370 return Register(kRegisterFileStartOffset - operand);
371 }
361 372
362 static bool AreContiguous(Register reg1, Register reg2, 373 static bool AreContiguous(Register reg1, Register reg2,
363 Register reg3 = Register(), 374 Register reg3 = Register(),
364 Register reg4 = Register(), 375 Register reg4 = Register(),
365 Register reg5 = Register()); 376 Register reg5 = Register());
366 377
367 std::string ToString(int parameter_count); 378 std::string ToString(int parameter_count);
368 379
369 bool operator==(const Register& other) const { 380 bool operator==(const Register& other) const {
370 return index() == other.index(); 381 return index() == other.index();
371 } 382 }
372 bool operator!=(const Register& other) const { 383 bool operator!=(const Register& other) const {
373 return index() != other.index(); 384 return index() != other.index();
374 } 385 }
375 bool operator<(const Register& other) const { 386 bool operator<(const Register& other) const {
376 return index() < other.index(); 387 return index() < other.index();
377 } 388 }
378 bool operator<=(const Register& other) const { 389 bool operator<=(const Register& other) const {
379 return index() <= other.index(); 390 return index() <= other.index();
380 } 391 }
381 bool operator>(const Register& other) const { 392 bool operator>(const Register& other) const {
382 return index() > other.index(); 393 return index() > other.index();
383 } 394 }
384 bool operator>=(const Register& other) const { 395 bool operator>=(const Register& other) const {
385 return index() >= other.index(); 396 return index() >= other.index();
386 } 397 }
387 398
388 private: 399 private:
389 static const int kInvalidIndex = kMaxInt; 400 static const int kInvalidIndex = kMaxInt;
401 static const int kRegisterFileStartOffset =
402 InterpreterFrameConstants::kRegisterFileFromFp / kPointerSize;
390 403
391 void* operator new(size_t size); 404 void* operator new(size_t size);
392 void operator delete(void* p); 405 void operator delete(void* p);
393 406
394 int index_; 407 int index_;
395 }; 408 };
396 409
397 410
398 class Bytecodes { 411 class Bytecodes {
399 public: 412 public:
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); 583 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use);
571 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); 584 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale);
572 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); 585 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size);
573 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); 586 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type);
574 587
575 } // namespace interpreter 588 } // namespace interpreter
576 } // namespace internal 589 } // namespace internal
577 } // namespace v8 590 } // namespace v8
578 591
579 #endif // V8_INTERPRETER_BYTECODES_H_ 592 #endif // V8_INTERPRETER_BYTECODES_H_
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698