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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 9588001: Remove an unneeded temp in instance setters and indexed stores. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
11 #include "vm/handles_impl.h" 11 #include "vm/handles_impl.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 class FlowGraphVisitor; 16 class FlowGraphVisitor;
17 class LocalVariable; 17 class LocalVariable;
18 18
19 // Computations and values. 19 // Computations and values.
20 // 20 //
21 // <Computation> ::= 21 // <Computation> ::=
22 // <Value> 22 // <Value>
23 // | AssertAssignable <Value> <AbstractType> 23 // | AssertAssignable <Value> <AbstractType>
24 // | InstanceCall <AstNode> <String> <Value> ... 24 // | InstanceCall <AstNode> <String> <Value> ...
25 // | StaticCall <StaticCallNode> <Value> ... 25 // | StaticCall <StaticCallNode> <Value> ...
26 // | LoadLocal <LocalVariable> 26 // | LoadLocal <LocalVariable>
27 // | StoreLocal <LocalVariable> <Value> 27 // | StoreLocal <LocalVariable> <Value>
28 // | StoreIndexed <Value> <Value> <Value> <Value>
29 // | StrictCompare <Token::kind> <Value> <Value> 28 // | StrictCompare <Token::kind> <Value> <Value>
30 // | NativeCall <NativeBodyNode> 29 // | NativeCall <NativeBodyNode>
30 // | StoreIndexed <StoreIndexedNode> <Value> <Value> <Value>
31 // | InstanceSetter <InstanceSetterNode> <Value> <Value>
31 // 32 //
32 // <Value> ::= 33 // <Value> ::=
33 // Temp <int> 34 // Temp <int>
34 // | Constant <Instance> 35 // | Constant <Instance>
35 36
36 // M is a two argument macro. It is applied to each concrete value's 37 // M is a two argument macro. It is applied to each concrete value's
37 // typename and classname. 38 // typename and classname.
38 #define FOR_EACH_VALUE(M) \ 39 #define FOR_EACH_VALUE(M) \
39 M(Temp, TempVal) \ 40 M(Temp, TempVal) \
40 M(Constant, ConstantVal) \ 41 M(Constant, ConstantVal) \
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 279 }
279 280
280 private: 281 private:
281 const NativeBodyNode& ast_node_; 282 const NativeBodyNode& ast_node_;
282 283
283 DISALLOW_COPY_AND_ASSIGN(NativeCallComp); 284 DISALLOW_COPY_AND_ASSIGN(NativeCallComp);
284 }; 285 };
285 286
286 287
287 // Not simply an InstanceCall because it has somewhat more complicated 288 // Not simply an InstanceCall because it has somewhat more complicated
288 // semantics: the value operand is preserved in a placeholder (the first 289 // semantics: the value operand is preserved before the call.
289 // operand is a preallocated slot that can be used).
290 class StoreIndexedComp : public Computation { 290 class StoreIndexedComp : public Computation {
291 public: 291 public:
292 StoreIndexedComp(StoreIndexedNode* node, 292 StoreIndexedComp(StoreIndexedNode* node,
293 Value* placeholder,
294 Value* array, 293 Value* array,
295 Value* index, 294 Value* index,
296 Value* value) 295 Value* value)
297 : ast_node_(*node), 296 : ast_node_(*node),
298 placeholder_(placeholder),
299 array_(array), 297 array_(array),
300 index_(index), 298 index_(index),
301 value_(value) { } 299 value_(value) { }
302 300
303 DECLARE_COMPUTATION(StoreIndexed) 301 DECLARE_COMPUTATION(StoreIndexed)
304 302
305 // Accessors forwarded to the AST node. 303 // Accessors forwarded to the AST node.
306 intptr_t node_id() const { return ast_node_.id(); } 304 intptr_t node_id() const { return ast_node_.id(); }
307 intptr_t token_index() const { return ast_node_.token_index(); } 305 intptr_t token_index() const { return ast_node_.token_index(); }
308 306
309 Value* placeholder() const { return placeholder_; }
310 Value* array() const { return array_; } 307 Value* array() const { return array_; }
311 Value* index() const { return index_; } 308 Value* index() const { return index_; }
312 Value* value() const { return value_; } 309 Value* value() const { return value_; }
313 310
314 private: 311 private:
315 const StoreIndexedNode& ast_node_; 312 const StoreIndexedNode& ast_node_;
316 Value* placeholder_;
317 Value* array_; 313 Value* array_;
318 Value* index_; 314 Value* index_;
319 Value* value_; 315 Value* value_;
320 316
321 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp); 317 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp);
322 }; 318 };
323 319
324 320
325 // Not simply an InstanceCall because it has somewhat more complicated 321 // Not simply an InstanceCall because it has somewhat more complicated
326 // semantics: the value operand is preserved in a placeholder (the first 322 // semantics: the value operand is preserved before the call.
327 // operand is a preallocate slot that can be used).
328 class InstanceSetterComp : public Computation { 323 class InstanceSetterComp : public Computation {
329 public: 324 public:
330 InstanceSetterComp(InstanceSetterNode* node, 325 InstanceSetterComp(InstanceSetterNode* node,
331 Value* placeholder,
332 Value* receiver, 326 Value* receiver,
333 Value* value) 327 Value* value)
334 : ast_node_(*node), 328 : ast_node_(*node),
335 placeholder_(placeholder),
336 receiver_(receiver), 329 receiver_(receiver),
337 value_(value) { } 330 value_(value) { }
338 331
339 DECLARE_COMPUTATION(InstanceSetter) 332 DECLARE_COMPUTATION(InstanceSetter)
340 333
341 // Accessors forwarded to the AST node. 334 // Accessors forwarded to the AST node.
342 intptr_t node_id() const { return ast_node_.id(); } 335 intptr_t node_id() const { return ast_node_.id(); }
343 intptr_t token_index() const { return ast_node_.token_index(); } 336 intptr_t token_index() const { return ast_node_.token_index(); }
344 const String& field_name() const { return ast_node_.field_name(); } 337 const String& field_name() const { return ast_node_.field_name(); }
345 338
346 Value* placeholder() const { return placeholder_; }
347 Value* receiver() const { return receiver_; } 339 Value* receiver() const { return receiver_; }
348 Value* value() const { return value_; } 340 Value* value() const { return value_; }
349 341
350 private: 342 private:
351 const InstanceSetterNode& ast_node_; 343 const InstanceSetterNode& ast_node_;
352 Value* placeholder_;
353 Value* receiver_; 344 Value* receiver_;
354 Value* value_; 345 Value* value_;
355 346
356 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp); 347 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp);
357 }; 348 };
358 349
359 350
360 #undef DECLARE_COMPUTATION 351 #undef DECLARE_COMPUTATION
361 352
362 353
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 #undef DECLARE_VISIT_INSTRUCTION 619 #undef DECLARE_VISIT_INSTRUCTION
629 620
630 private: 621 private:
631 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 622 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
632 }; 623 };
633 624
634 625
635 } // namespace dart 626 } // namespace dart
636 627
637 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 628 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698