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

Side by Side Diff: src/arm/codegen-arm.h

Issue 362004: Remove the typeof state threaded through the code generator. It was... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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 | « no previous file | src/arm/codegen-arm.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 bool is_illegal() const { return type_ == ILLEGAL; } 70 bool is_illegal() const { return type_ == ILLEGAL; }
71 bool is_slot() const { return type_ == SLOT; } 71 bool is_slot() const { return type_ == SLOT; }
72 bool is_property() const { return type_ == NAMED || type_ == KEYED; } 72 bool is_property() const { return type_ == NAMED || type_ == KEYED; }
73 73
74 // Return the name. Only valid for named property references. 74 // Return the name. Only valid for named property references.
75 Handle<String> GetName(); 75 Handle<String> GetName();
76 76
77 // Generate code to push the value of the reference on top of the 77 // Generate code to push the value of the reference on top of the
78 // expression stack. The reference is expected to be already on top of 78 // expression stack. The reference is expected to be already on top of
79 // the expression stack, and it is left in place with its value above it. 79 // the expression stack, and it is left in place with its value above it.
80 void GetValue(TypeofState typeof_state); 80 void GetValue();
81 81
82 // Generate code to push the value of a reference on top of the expression 82 // Generate code to push the value of a reference on top of the expression
83 // stack and then spill the stack frame. This function is used temporarily 83 // stack and then spill the stack frame. This function is used temporarily
84 // while the code generator is being transformed. 84 // while the code generator is being transformed.
85 inline void GetValueAndSpill(TypeofState typeof_state); 85 inline void GetValueAndSpill();
86 86
87 // Generate code to store the value on top of the expression stack in the 87 // Generate code to store the value on top of the expression stack in the
88 // reference. The reference is expected to be immediately below the value 88 // reference. The reference is expected to be immediately below the value
89 // on the expression stack. The stored value is left in place (with the 89 // on the expression stack. The stored value is left in place (with the
90 // reference intact below it) to support chained assignments. 90 // reference intact below it) to support chained assignments.
91 void SetValue(InitState init_state); 91 void SetValue(InitState init_state);
92 92
93 private: 93 private:
94 CodeGenerator* cgen_; 94 CodeGenerator* cgen_;
95 Expression* expression_; 95 Expression* expression_;
96 Type type_; 96 Type type_;
97 }; 97 };
98 98
99 99
100 // ------------------------------------------------------------------------- 100 // -------------------------------------------------------------------------
101 // Code generation state 101 // Code generation state
102 102
103 // The state is passed down the AST by the code generator (and back up, in 103 // The state is passed down the AST by the code generator (and back up, in
104 // the form of the state of the label pair). It is threaded through the 104 // the form of the state of the label pair). It is threaded through the
105 // call stack. Constructing a state implicitly pushes it on the owning code 105 // call stack. Constructing a state implicitly pushes it on the owning code
106 // generator's stack of states, and destroying one implicitly pops it. 106 // generator's stack of states, and destroying one implicitly pops it.
107 107
108 class CodeGenState BASE_EMBEDDED { 108 class CodeGenState BASE_EMBEDDED {
109 public: 109 public:
110 // Create an initial code generator state. Destroying the initial state 110 // Create an initial code generator state. Destroying the initial state
111 // leaves the code generator with a NULL state. 111 // leaves the code generator with a NULL state.
112 explicit CodeGenState(CodeGenerator* owner); 112 explicit CodeGenState(CodeGenerator* owner);
113 113
114 // Create a code generator state based on a code generator's current 114 // Create a code generator state based on a code generator's current
115 // state. The new state has its own typeof state and pair of branch 115 // state. The new state has its own pair of branch labels.
116 // labels.
117 CodeGenState(CodeGenerator* owner, 116 CodeGenState(CodeGenerator* owner,
118 TypeofState typeof_state,
119 JumpTarget* true_target, 117 JumpTarget* true_target,
120 JumpTarget* false_target); 118 JumpTarget* false_target);
121 119
122 // Destroy a code generator state and restore the owning code generator's 120 // Destroy a code generator state and restore the owning code generator's
123 // previous state. 121 // previous state.
124 ~CodeGenState(); 122 ~CodeGenState();
125 123
126 TypeofState typeof_state() const { return typeof_state_; }
127 JumpTarget* true_target() const { return true_target_; } 124 JumpTarget* true_target() const { return true_target_; }
128 JumpTarget* false_target() const { return false_target_; } 125 JumpTarget* false_target() const { return false_target_; }
129 126
130 private: 127 private:
131 CodeGenerator* owner_; 128 CodeGenerator* owner_;
132 TypeofState typeof_state_;
133 JumpTarget* true_target_; 129 JumpTarget* true_target_;
134 JumpTarget* false_target_; 130 JumpTarget* false_target_;
135 CodeGenState* previous_; 131 CodeGenState* previous_;
136 }; 132 };
137 133
138 134
139 // ------------------------------------------------------------------------- 135 // -------------------------------------------------------------------------
140 // CodeGenerator 136 // CodeGenerator
141 137
142 class CodeGenerator: public AstVisitor { 138 class CodeGenerator: public AstVisitor {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // Accessors 199 // Accessors
204 Scope* scope() const { return scope_; } 200 Scope* scope() const { return scope_; }
205 201
206 // Generating deferred code. 202 // Generating deferred code.
207 void ProcessDeferred(); 203 void ProcessDeferred();
208 204
209 bool is_eval() { return is_eval_; } 205 bool is_eval() { return is_eval_; }
210 206
211 // State 207 // State
212 bool has_cc() const { return cc_reg_ != al; } 208 bool has_cc() const { return cc_reg_ != al; }
213 TypeofState typeof_state() const { return state_->typeof_state(); }
214 JumpTarget* true_target() const { return state_->true_target(); } 209 JumpTarget* true_target() const { return state_->true_target(); }
215 JumpTarget* false_target() const { return state_->false_target(); } 210 JumpTarget* false_target() const { return state_->false_target(); }
216 211
217 // We don't track loop nesting level on ARM yet. 212 // We don't track loop nesting level on ARM yet.
218 int loop_nesting() const { return 0; } 213 int loop_nesting() const { return 0; }
219 214
220 // Node visitors. 215 // Node visitors.
221 void VisitStatements(ZoneList<Statement*>* statements); 216 void VisitStatements(ZoneList<Statement*>* statements);
222 217
223 #define DEF_VISIT(type) \ 218 #define DEF_VISIT(type) \
(...skipping 28 matching lines...) Expand all
252 Register tmp, 247 Register tmp,
253 Register tmp2, 248 Register tmp2,
254 JumpTarget* slow); 249 JumpTarget* slow);
255 250
256 // Expressions 251 // Expressions
257 static MemOperand GlobalObject() { 252 static MemOperand GlobalObject() {
258 return ContextOperand(cp, Context::GLOBAL_INDEX); 253 return ContextOperand(cp, Context::GLOBAL_INDEX);
259 } 254 }
260 255
261 void LoadCondition(Expression* x, 256 void LoadCondition(Expression* x,
262 TypeofState typeof_state,
263 JumpTarget* true_target, 257 JumpTarget* true_target,
264 JumpTarget* false_target, 258 JumpTarget* false_target,
265 bool force_cc); 259 bool force_cc);
266 void Load(Expression* x, TypeofState typeof_state = NOT_INSIDE_TYPEOF); 260 void Load(Expression* expr);
267 void LoadGlobal(); 261 void LoadGlobal();
268 void LoadGlobalReceiver(Register scratch); 262 void LoadGlobalReceiver(Register scratch);
269 263
270 // Generate code to push the value of an expression on top of the frame 264 // Generate code to push the value of an expression on top of the frame
271 // and then spill the frame fully to memory. This function is used 265 // and then spill the frame fully to memory. This function is used
272 // temporarily while the code generator is being transformed. 266 // temporarily while the code generator is being transformed.
273 inline void LoadAndSpill(Expression* expression, 267 inline void LoadAndSpill(Expression* expression);
274 TypeofState typeof_state = NOT_INSIDE_TYPEOF);
275 268
276 // Call LoadCondition and then spill the virtual frame unless control flow 269 // Call LoadCondition and then spill the virtual frame unless control flow
277 // cannot reach the end of the expression (ie, by emitting only 270 // cannot reach the end of the expression (ie, by emitting only
278 // unconditional jumps to the control targets). 271 // unconditional jumps to the control targets).
279 inline void LoadConditionAndSpill(Expression* expression, 272 inline void LoadConditionAndSpill(Expression* expression,
280 TypeofState typeof_state,
281 JumpTarget* true_target, 273 JumpTarget* true_target,
282 JumpTarget* false_target, 274 JumpTarget* false_target,
283 bool force_control); 275 bool force_control);
284 276
285 // Read a value from a slot and leave it on top of the expression stack. 277 // Read a value from a slot and leave it on top of the expression stack.
286 void LoadFromSlot(Slot* slot, TypeofState typeof_state); 278 void LoadFromSlot(Slot* slot, TypeofState typeof_state);
287 void LoadFromGlobalSlotCheckExtensions(Slot* slot, 279 void LoadFromGlobalSlotCheckExtensions(Slot* slot,
288 TypeofState typeof_state, 280 TypeofState typeof_state,
289 Register tmp, 281 Register tmp,
290 Register tmp2, 282 Register tmp2,
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 constant_rhs_); 532 constant_rhs_);
541 } 533 }
542 } 534 }
543 #endif 535 #endif
544 }; 536 };
545 537
546 538
547 } } // namespace v8::internal 539 } } // namespace v8::internal
548 540
549 #endif // V8_ARM_CODEGEN_ARM_H_ 541 #endif // V8_ARM_CODEGEN_ARM_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698