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

Side by Side Diff: src/virtual-frame-ia32.h

Issue 13665: Allow non-spilled frames into VisitCompareOperation, and allow them... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: '' Created 12 years 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 | Annotate | Revision Log
« no previous file with comments | « src/codegen-ia32.cc ('k') | src/virtual-frame-ia32.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 22 matching lines...) Expand all
33 33
34 namespace v8 { namespace internal { 34 namespace v8 { namespace internal {
35 35
36 36
37 // The code generator's view of a frame element, when it wants to use it. 37 // The code generator's view of a frame element, when it wants to use it.
38 // 38 //
39 // A Result can be a register or a constant. 39 // A Result can be a register or a constant.
40 class Result BASE_EMBEDDED { 40 class Result BASE_EMBEDDED {
41 public: 41 public:
42 // Construct a register Result. 42 // Construct a register Result.
43 explicit Result(Register reg, CodeGenerator* cgen); 43 Result(Register reg, CodeGenerator* cgen);
44 44
45 // Construct a Result whose value is a compile-time constant. 45 // Construct a Result whose value is a compile-time constant.
46 Result(Handle<Object> value, CodeGenerator * cgen) : 46 Result(Handle<Object> value, CodeGenerator * cgen) :
47 type_(CONSTANT), 47 type_(CONSTANT),
48 cgen_(cgen) { 48 cgen_(cgen) {
49 data_.handle_ = value.location(); 49 data_.handle_ = value.location();
50 } 50 }
51 51
52 ~Result() { 52 ~Result() {
53 // We have called Unuse() before Result goes out of scope. 53 if (is_register()) {
54 ASSERT(!is_register() || reg().is(no_reg)); 54 Unuse();
55 }
55 } 56 }
56 57
57 void Unuse(); 58 void Unuse();
58 59
59 bool is_register() const { return type() == REGISTER; } 60 bool is_register() const { return type() == REGISTER; }
60 bool is_constant() const { return type() == CONSTANT; } 61 bool is_constant() const { return type() == CONSTANT; }
62 bool is_valid() const { return type() != INVALID; }
61 63
62 Register reg() const { 64 Register reg() const {
63 ASSERT(type() == REGISTER); 65 ASSERT(type() == REGISTER);
64 return data_.reg_; 66 return data_.reg_;
65 } 67 }
66 68
67 Handle<Object> handle() const { 69 Handle<Object> handle() const {
68 ASSERT(type() == CONSTANT); 70 ASSERT(type() == CONSTANT);
69 return Handle<Object>(data_.handle_); 71 return Handle<Object>(data_.handle_);
70 } 72 }
71 73
74 // Change a result to a register result. If the result is not already
75 // in a register, allocate a register from the code generator, and emit
76 // code to move the value into that register.
77 void ToRegister();
72 private: 78 private:
73 enum Type { REGISTER, CONSTANT }; 79 enum Type {
80 REGISTER,
81 CONSTANT,
82 INVALID
83 };
74 84
75 Type type_; 85 Type type_;
76 86
77 Type type() const { return type_; } 87 Type type() const { return type_; }
78 88
79 union { 89 union {
80 Register reg_; 90 Register reg_;
81 Object** handle_; 91 Object** handle_;
82 } data_; 92 } data_;
83 93
84 CodeGenerator* cgen_; 94 CodeGenerator* cgen_;
85 }; 95 };
86 96
87 97
88 // A result in a register just means that the value can be read from the registe r
89
90
91 // ------------------------------------------------------------------------- 98 // -------------------------------------------------------------------------
92 // Virtual frame elements 99 // Virtual frame elements
93 // 100 //
94 // The internal elements of the virtual frames. There are several kinds of 101 // The internal elements of the virtual frames. There are several kinds of
95 // elements: 102 // elements:
96 // * Memory: an element that resides in the actual frame. Its address is 103 // * Memory: an element that resides in the actual frame. Its address is
97 // given by its position in the virtual frame. 104 // given by its position in the virtual frame.
98 // * Register: an element that resides in a register. 105 // * Register: an element that resides in a register.
99 // * Constant: an element whose value is known at compile time. 106 // * Constant: an element whose value is known at compile time.
100 107
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 // This is because some new memory-to-register moves are 475 // This is because some new memory-to-register moves are
469 // created in order to break cycles of register moves. 476 // created in order to break cycles of register moves.
470 // Used in the implementation of MergeTo(). 477 // Used in the implementation of MergeTo().
471 void MergeMoveRegistersToRegisters(VirtualFrame *expected); 478 void MergeMoveRegistersToRegisters(VirtualFrame *expected);
472 }; 479 };
473 480
474 481
475 } } // namespace v8::internal 482 } } // namespace v8::internal
476 483
477 #endif // V8_VIRTUAL_FRAME_IA32_H_ 484 #endif // V8_VIRTUAL_FRAME_IA32_H_
OLDNEW
« no previous file with comments | « src/codegen-ia32.cc ('k') | src/virtual-frame-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698