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

Side by Side Diff: vm/intermediate_language.h

Issue 10412043: Make it less verbose to declare instructions that use LocationSummary-based code generation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: addressed comments Created 8 years, 7 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 | « no previous file | vm/intermediate_language_ia32.cc » ('j') | vm/intermediate_language_x64.cc » ('J')
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"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 // Forward declarations. 73 // Forward declarations.
74 class BufferFormatter; 74 class BufferFormatter;
75 class Value; 75 class Value;
76 76
77 77
78 class Computation : public ZoneAllocated { 78 class Computation : public ZoneAllocated {
79 public: 79 public:
80 static const int kNoCid = -1; 80 static const int kNoCid = -1;
81 81
82 Computation() : cid_(-1), ic_data_(NULL) { 82 Computation() : cid_(-1), ic_data_(NULL), locs_(NULL) {
83 Isolate* isolate = Isolate::Current(); 83 Isolate* isolate = Isolate::Current();
84 cid_ = GetNextCid(isolate); 84 cid_ = GetNextCid(isolate);
85 ic_data_ = GetICDataForCid(cid_, isolate); 85 ic_data_ = GetICDataForCid(cid_, isolate);
86 } 86 }
87 87
88 // Unique computation/instruction id, used for deoptimization. 88 // Unique computation/instruction id, used for deoptimization.
89 intptr_t cid() const { return cid_; } 89 intptr_t cid() const { return cid_; }
90 90
91 const ICData* ic_data() const { return ic_data_; } 91 const ICData* ic_data() const { return ic_data_; }
92 92
(...skipping 12 matching lines...) Expand all
105 105
106 virtual const char* DebugName() const = 0; 106 virtual const char* DebugName() const = 0;
107 107
108 // Printing support. These functions are sometimes overridden for custom 108 // Printing support. These functions are sometimes overridden for custom
109 // formatting. Otherwise, it prints in the format "opcode(op1, op2, op3)". 109 // formatting. Otherwise, it prints in the format "opcode(op1, op2, op3)".
110 virtual void PrintTo(BufferFormatter* f) const; 110 virtual void PrintTo(BufferFormatter* f) const;
111 virtual void PrintOperandsTo(BufferFormatter* f) const; 111 virtual void PrintOperandsTo(BufferFormatter* f) const;
112 112
113 // Returns structure describing location constraints required 113 // Returns structure describing location constraints required
114 // to emit native code for this computation. 114 // to emit native code for this computation.
115 virtual LocationSummary* locs() const { 115 LocationSummary* locs() {
116 // TODO(vegorov): This should be pure virtual method. 116 if (locs_ == NULL) locs_ = MakeLocationSummary();
Ivan Posva 2012/05/22 23:36:07 Where are the {}s?
Florian Schneider 2012/05/23 00:02:01 Done.
117 // However we are temporary using NULL for instructions that 117 return locs_;
118 // were not converted to the location based code generation yet.
119 return NULL;
120 } 118 }
121 119
122 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 120 // Create a location summary for this computation.
123 UNIMPLEMENTED(); 121 // TODO(fschneider): Temporarily returns NULL for instructions
124 } 122 // that are not yet converted to the location based code generation.
123 virtual LocationSummary* MakeLocationSummary() const = 0;
124
125 virtual void EmitNativeCode(FlowGraphCompiler* compiler) = 0;
Ivan Posva 2012/05/22 23:36:07 Can this be const?
Florian Schneider 2012/05/23 00:02:01 Not yet. locs() needs to be const as well for that
125 126
126 private: 127 private:
127 friend class Instruction; 128 friend class Instruction;
128 static intptr_t GetNextCid(Isolate* isolate) { 129 static intptr_t GetNextCid(Isolate* isolate) {
129 intptr_t tmp = isolate->computation_id(); 130 intptr_t tmp = isolate->computation_id();
130 isolate->set_computation_id(tmp + 1); 131 isolate->set_computation_id(tmp + 1);
131 return tmp; 132 return tmp;
132 } 133 }
133 static ICData* GetICDataForCid(intptr_t cid, Isolate* isolate) { 134 static ICData* GetICDataForCid(intptr_t cid, Isolate* isolate) {
134 if (isolate->ic_data_array() == Array::null()) { 135 if (isolate->ic_data_array() == Array::null()) {
135 return NULL; 136 return NULL;
136 } else { 137 } else {
137 const Array& array_handle = Array::Handle(isolate->ic_data_array()); 138 const Array& array_handle = Array::Handle(isolate->ic_data_array());
138 ICData& ic_data_handle = ICData::ZoneHandle(); 139 ICData& ic_data_handle = ICData::ZoneHandle();
139 if (cid < array_handle.Length()) { 140 if (cid < array_handle.Length()) {
140 ic_data_handle ^= array_handle.At(cid); 141 ic_data_handle ^= array_handle.At(cid);
141 } 142 }
142 return &ic_data_handle; 143 return &ic_data_handle;
143 } 144 }
144 } 145 }
145 146
146 intptr_t cid_; 147 intptr_t cid_;
147 ICData* ic_data_; 148 ICData* ic_data_;
149 LocationSummary* locs_;
148 150
149 DISALLOW_COPY_AND_ASSIGN(Computation); 151 DISALLOW_COPY_AND_ASSIGN(Computation);
150 }; 152 };
151 153
152 154
153 // An embedded container with N elements of type T. Used (with partial 155 // An embedded container with N elements of type T. Used (with partial
154 // specialization for N=0) because embedded arrays cannot have size 0. 156 // specialization for N=0) because embedded arrays cannot have size 0.
155 template<typename T, intptr_t N> 157 template<typename T, intptr_t N>
156 class EmbeddedArray { 158 class EmbeddedArray {
157 public: 159 public:
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 227
226 private: 228 private:
227 DISALLOW_COPY_AND_ASSIGN(Value); 229 DISALLOW_COPY_AND_ASSIGN(Value);
228 }; 230 };
229 231
230 232
231 // Functions defined in all concrete computation classes. 233 // Functions defined in all concrete computation classes.
232 #define DECLARE_COMPUTATION(ShortName) \ 234 #define DECLARE_COMPUTATION(ShortName) \
233 virtual void Accept(FlowGraphVisitor* visitor); \ 235 virtual void Accept(FlowGraphVisitor* visitor); \
234 virtual const char* DebugName() const { return #ShortName; } \ 236 virtual const char* DebugName() const { return #ShortName; } \
235 virtual RawAbstractType* StaticType() const; 237 virtual RawAbstractType* StaticType() const; \
238 virtual LocationSummary* MakeLocationSummary() const; \
239 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
236 240
237 // Functions defined in all concrete value classes. 241 // Functions defined in all concrete value classes.
238 #define DECLARE_VALUE(ShortName) \ 242 #define DECLARE_VALUE(ShortName) \
239 DECLARE_COMPUTATION(ShortName) \ 243 DECLARE_COMPUTATION(ShortName) \
240 virtual ShortName##Val* As##ShortName() { return this; } \ 244 virtual ShortName##Val* As##ShortName() { return this; } \
241 virtual void PrintTo(BufferFormatter* f) const; 245 virtual void PrintTo(BufferFormatter* f) const;
242 246
243 247
244 // Definitions and uses are mutually recursive. 248 // Definitions and uses are mutually recursive.
245 class Definition; 249 class Definition;
246 250
247 class UseVal : public Value { 251 class UseVal : public Value {
248 public: 252 public:
249 explicit UseVal(Definition* definition) : definition_(definition) { } 253 explicit UseVal(Definition* definition) : definition_(definition) { }
250 254
251 DECLARE_VALUE(Use) 255 DECLARE_VALUE(Use)
252 256
253 Definition* definition() const { return definition_; } 257 Definition* definition() const { return definition_; }
254 258
255 private: 259 private:
256 Definition* const definition_; 260 Definition* const definition_;
257 261
258 DISALLOW_COPY_AND_ASSIGN(UseVal); 262 DISALLOW_COPY_AND_ASSIGN(UseVal);
259 }; 263 };
260 264
261 265
262 class ConstantVal: public Value { 266 class ConstantVal: public Value {
263 public: 267 public:
264 explicit ConstantVal(const Object& value) 268 explicit ConstantVal(const Object& value)
265 : value_(value), 269 : value_(value) {
266 location_summary_(MakeLocationSummary()) {
267 ASSERT(value.IsZoneHandle()); 270 ASSERT(value.IsZoneHandle());
268 } 271 }
269 272
270 DECLARE_VALUE(Constant) 273 DECLARE_VALUE(Constant)
271 274
272 const Object& value() const { return value_; } 275 const Object& value() const { return value_; }
273 276
274 virtual LocationSummary* locs() const {
275 return location_summary_;
276 }
277
278 // Platform specific summary factory for this instruction.
279 LocationSummary* MakeLocationSummary();
280
281 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
282
283 private: 277 private:
284 const Object& value_; 278 const Object& value_;
285 LocationSummary* location_summary_;
286 279
287 DISALLOW_COPY_AND_ASSIGN(ConstantVal); 280 DISALLOW_COPY_AND_ASSIGN(ConstantVal);
288 }; 281 };
289 282
290 #undef DECLARE_VALUE 283 #undef DECLARE_VALUE
291 284
292 285
293 class AssertAssignableComp : public Computation { 286 class AssertAssignableComp : public Computation {
294 public: 287 public:
295 AssertAssignableComp(intptr_t token_index, 288 AssertAssignableComp(intptr_t token_index,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 const intptr_t try_index_; 360 const intptr_t try_index_;
368 361
369 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); 362 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp);
370 }; 363 };
371 364
372 365
373 // Denotes the current context, normally held in a register. This is 366 // Denotes the current context, normally held in a register. This is
374 // a computation, not a value, because it's mutable. 367 // a computation, not a value, because it's mutable.
375 class CurrentContextComp : public TemplateComputation<0> { 368 class CurrentContextComp : public TemplateComputation<0> {
376 public: 369 public:
377 CurrentContextComp() : location_summary_(MakeLocationSummary()) { } 370 CurrentContextComp() { }
378 371
379 DECLARE_COMPUTATION(CurrentContext) 372 DECLARE_COMPUTATION(CurrentContext)
380 373
381 virtual LocationSummary* locs() const {
382 return location_summary_;
383 }
384
385 static LocationSummary* MakeLocationSummary();
386
387 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
388
389 private: 374 private:
390 LocationSummary* location_summary_;
391 DISALLOW_COPY_AND_ASSIGN(CurrentContextComp); 375 DISALLOW_COPY_AND_ASSIGN(CurrentContextComp);
392 }; 376 };
393 377
394 378
395 class StoreContextComp : public TemplateComputation<1> { 379 class StoreContextComp : public TemplateComputation<1> {
396 public: 380 public:
397 explicit StoreContextComp(Value* value) 381 explicit StoreContextComp(Value* value) {
398 : location_summary_(MakeLocationSummary()) {
399 ASSERT(value != NULL); 382 ASSERT(value != NULL);
400 inputs_[0] = value; 383 inputs_[0] = value;
401 } 384 }
402 385
403 DECLARE_COMPUTATION(StoreContext); 386 DECLARE_COMPUTATION(StoreContext);
404 387
405 virtual LocationSummary* locs() const {
406 return location_summary_;
407 }
408
409 static LocationSummary* MakeLocationSummary();
410
411 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
412
413 Value* value() const { return inputs_[0]; } 388 Value* value() const { return inputs_[0]; }
414 389
415 private: 390 private:
416 LocationSummary* location_summary_;
417 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); 391 DISALLOW_COPY_AND_ASSIGN(StoreContextComp);
418 }; 392 };
419 393
420 394
421 class ClosureCallComp : public Computation { 395 class ClosureCallComp : public Computation {
422 public: 396 public:
423 ClosureCallComp(ClosureCallNode* node, 397 ClosureCallComp(ClosureCallNode* node,
424 intptr_t try_index, 398 intptr_t try_index,
425 ZoneGrowableArray<Value*>* arguments) 399 ZoneGrowableArray<Value*>* arguments)
426 : ast_node_(*node), 400 : ast_node_(*node),
427 try_index_(try_index), 401 try_index_(try_index),
428 arguments_(arguments), 402 arguments_(arguments) { }
429 location_summary_(MakeLocationSummary()) { }
430 403
431 DECLARE_COMPUTATION(ClosureCall) 404 DECLARE_COMPUTATION(ClosureCall)
432 405
433 const Array& argument_names() const { return ast_node_.arguments()->names(); } 406 const Array& argument_names() const { return ast_node_.arguments()->names(); }
434 intptr_t token_index() const { return ast_node_.token_index(); } 407 intptr_t token_index() const { return ast_node_.token_index(); }
435 intptr_t try_index() const { return try_index_; } 408 intptr_t try_index() const { return try_index_; }
436 409
437 intptr_t ArgumentCount() const { return arguments_->length(); } 410 intptr_t ArgumentCount() const { return arguments_->length(); }
438 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } 411 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; }
439 412
440 virtual intptr_t InputCount() const; 413 virtual intptr_t InputCount() const;
441 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } 414 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); }
442 415
443 virtual void PrintOperandsTo(BufferFormatter* f) const; 416 virtual void PrintOperandsTo(BufferFormatter* f) const;
444 417
445 virtual LocationSummary* locs() const {
446 return location_summary_;
447 }
448
449 // Platform specific summary factory for this instruction.
450 LocationSummary* MakeLocationSummary();
451
452 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
453
454 private: 418 private:
455 const ClosureCallNode& ast_node_; 419 const ClosureCallNode& ast_node_;
456 const intptr_t try_index_; 420 const intptr_t try_index_;
457 ZoneGrowableArray<Value*>* arguments_; 421 ZoneGrowableArray<Value*>* arguments_;
458 LocationSummary* location_summary_;
459 422
460 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); 423 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp);
461 }; 424 };
462 425
463 426
464 class InstanceCallComp : public Computation { 427 class InstanceCallComp : public Computation {
465 public: 428 public:
466 InstanceCallComp(intptr_t token_index, 429 InstanceCallComp(intptr_t token_index,
467 intptr_t try_index, 430 intptr_t try_index,
468 const String& function_name, 431 const String& function_name,
469 ZoneGrowableArray<Value*>* arguments, 432 ZoneGrowableArray<Value*>* arguments,
470 const Array& argument_names, 433 const Array& argument_names,
471 intptr_t checked_argument_count) 434 intptr_t checked_argument_count)
472 : token_index_(token_index), 435 : token_index_(token_index),
473 try_index_(try_index), 436 try_index_(try_index),
474 function_name_(function_name), 437 function_name_(function_name),
475 arguments_(arguments), 438 arguments_(arguments),
476 argument_names_(argument_names), 439 argument_names_(argument_names),
477 checked_argument_count_(checked_argument_count), 440 checked_argument_count_(checked_argument_count) {
478 location_summary_(MakeLocationSummary()) {
479 ASSERT(function_name.IsZoneHandle()); 441 ASSERT(function_name.IsZoneHandle());
480 ASSERT(!arguments->is_empty()); 442 ASSERT(!arguments->is_empty());
481 ASSERT(argument_names.IsZoneHandle()); 443 ASSERT(argument_names.IsZoneHandle());
482 } 444 }
483 445
484 DECLARE_COMPUTATION(InstanceCall) 446 DECLARE_COMPUTATION(InstanceCall)
485 447
486 intptr_t token_index() const { return token_index_; } 448 intptr_t token_index() const { return token_index_; }
487 intptr_t try_index() const { return try_index_; } 449 intptr_t try_index() const { return try_index_; }
488 const String& function_name() const { return function_name_; } 450 const String& function_name() const { return function_name_; }
489 intptr_t ArgumentCount() const { return arguments_->length(); } 451 intptr_t ArgumentCount() const { return arguments_->length(); }
490 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } 452 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; }
491 const Array& argument_names() const { return argument_names_; } 453 const Array& argument_names() const { return argument_names_; }
492 intptr_t checked_argument_count() const { return checked_argument_count_; } 454 intptr_t checked_argument_count() const { return checked_argument_count_; }
493 455
494 virtual intptr_t InputCount() const; 456 virtual intptr_t InputCount() const;
495 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } 457 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); }
496 458
497 virtual void PrintOperandsTo(BufferFormatter* f) const; 459 virtual void PrintOperandsTo(BufferFormatter* f) const;
498 460
499 virtual LocationSummary* locs() const {
500 return location_summary_;
501 }
502
503 // Platform specific summary factory for this instruction.
504 LocationSummary* MakeLocationSummary();
505
506 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
507
508 private: 461 private:
509 const intptr_t token_index_; 462 const intptr_t token_index_;
510 const intptr_t try_index_; 463 const intptr_t try_index_;
511 const String& function_name_; 464 const String& function_name_;
512 ZoneGrowableArray<Value*>* const arguments_; 465 ZoneGrowableArray<Value*>* const arguments_;
513 const Array& argument_names_; 466 const Array& argument_names_;
514 const intptr_t checked_argument_count_; 467 const intptr_t checked_argument_count_;
515 LocationSummary* location_summary_;
516 468
517 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); 469 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp);
518 }; 470 };
519 471
520 472
521 class StrictCompareComp : public TemplateComputation<2> { 473 class StrictCompareComp : public TemplateComputation<2> {
522 public: 474 public:
523 StrictCompareComp(Token::Kind kind, Value* left, Value* right) 475 StrictCompareComp(Token::Kind kind, Value* left, Value* right)
524 : kind_(kind) { 476 : kind_(kind) {
525 ASSERT((kind_ == Token::kEQ_STRICT) || (kind_ == Token::kNE_STRICT)); 477 ASSERT((kind_ == Token::kEQ_STRICT) || (kind_ == Token::kNE_STRICT));
526 inputs_[0] = left; 478 inputs_[0] = left;
527 inputs_[1] = right; 479 inputs_[1] = right;
528 location_summary_ = MakeLocationSummary();
529 } 480 }
530 481
531 DECLARE_COMPUTATION(StrictCompare) 482 DECLARE_COMPUTATION(StrictCompare)
532 483
533 Token::Kind kind() const { return kind_; } 484 Token::Kind kind() const { return kind_; }
534 Value* left() const { return inputs_[0]; } 485 Value* left() const { return inputs_[0]; }
535 Value* right() const { return inputs_[1]; } 486 Value* right() const { return inputs_[1]; }
536 487
537 virtual void PrintOperandsTo(BufferFormatter* f) const; 488 virtual void PrintOperandsTo(BufferFormatter* f) const;
538 489
539 virtual LocationSummary* locs() const {
540 return location_summary_;
541 }
542
543 // Platform specific summary factory for this instruction.
544 LocationSummary* MakeLocationSummary();
545
546 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
547
548 private: 490 private:
549 const Token::Kind kind_; 491 const Token::Kind kind_;
550 492
551 LocationSummary* location_summary_;
552
553 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp); 493 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp);
554 }; 494 };
555 495
556 496
557 class EqualityCompareComp : public TemplateComputation<2> { 497 class EqualityCompareComp : public TemplateComputation<2> {
558 public: 498 public:
559 EqualityCompareComp(intptr_t token_index, 499 EqualityCompareComp(intptr_t token_index,
560 intptr_t try_index, 500 intptr_t try_index,
561 Value* left, 501 Value* left,
562 Value* right) 502 Value* right)
(...skipping 26 matching lines...) Expand all
589 public: 529 public:
590 StaticCallComp(intptr_t token_index, 530 StaticCallComp(intptr_t token_index,
591 intptr_t try_index, 531 intptr_t try_index,
592 const Function& function, 532 const Function& function,
593 const Array& argument_names, 533 const Array& argument_names,
594 ZoneGrowableArray<Value*>* arguments) 534 ZoneGrowableArray<Value*>* arguments)
595 : token_index_(token_index), 535 : token_index_(token_index),
596 try_index_(try_index), 536 try_index_(try_index),
597 function_(function), 537 function_(function),
598 argument_names_(argument_names), 538 argument_names_(argument_names),
599 arguments_(arguments), 539 arguments_(arguments) {
600 location_summary_(MakeLocationSummary()) {
601 ASSERT(function.IsZoneHandle()); 540 ASSERT(function.IsZoneHandle());
602 ASSERT(argument_names.IsZoneHandle()); 541 ASSERT(argument_names.IsZoneHandle());
603 } 542 }
604 543
605 DECLARE_COMPUTATION(StaticCall) 544 DECLARE_COMPUTATION(StaticCall)
606 545
607 // Accessors forwarded to the AST node. 546 // Accessors forwarded to the AST node.
608 const Function& function() const { return function_; } 547 const Function& function() const { return function_; }
609 const Array& argument_names() const { return argument_names_; } 548 const Array& argument_names() const { return argument_names_; }
610 intptr_t token_index() const { return token_index_; } 549 intptr_t token_index() const { return token_index_; }
611 intptr_t try_index() const { return try_index_; } 550 intptr_t try_index() const { return try_index_; }
612 551
613 intptr_t ArgumentCount() const { return arguments_->length(); } 552 intptr_t ArgumentCount() const { return arguments_->length(); }
614 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } 553 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; }
615 554
616 virtual intptr_t InputCount() const; 555 virtual intptr_t InputCount() const;
617 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } 556 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); }
618 557
619 virtual void PrintOperandsTo(BufferFormatter* f) const; 558 virtual void PrintOperandsTo(BufferFormatter* f) const;
620 559
621 virtual LocationSummary* locs() const {
622 return location_summary_;
623 }
624
625 // Platform specific summary factory for this instruction.
626 LocationSummary* MakeLocationSummary();
627
628 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
629
630 private: 560 private:
631 const intptr_t token_index_; 561 const intptr_t token_index_;
632 const intptr_t try_index_; 562 const intptr_t try_index_;
633 const Function& function_; 563 const Function& function_;
634 const Array& argument_names_; 564 const Array& argument_names_;
635 ZoneGrowableArray<Value*>* arguments_; 565 ZoneGrowableArray<Value*>* arguments_;
636 LocationSummary* location_summary_;
637 566
638 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); 567 DISALLOW_COPY_AND_ASSIGN(StaticCallComp);
639 }; 568 };
640 569
641 570
642 class LoadLocalComp : public TemplateComputation<0> { 571 class LoadLocalComp : public TemplateComputation<0> {
643 public: 572 public:
644 LoadLocalComp(const LocalVariable& local, intptr_t context_level) 573 LoadLocalComp(const LocalVariable& local, intptr_t context_level)
645 : local_(local), 574 : local_(local),
646 context_level_(context_level), 575 context_level_(context_level) { }
647 location_summary_(MakeLocationSummary()) { }
648 576
649 DECLARE_COMPUTATION(LoadLocal) 577 DECLARE_COMPUTATION(LoadLocal)
650 578
651 const LocalVariable& local() const { return local_; } 579 const LocalVariable& local() const { return local_; }
652 intptr_t context_level() const { return context_level_; } 580 intptr_t context_level() const { return context_level_; }
653 581
654 virtual void PrintOperandsTo(BufferFormatter* f) const; 582 virtual void PrintOperandsTo(BufferFormatter* f) const;
655 583
656 virtual LocationSummary* locs() const {
657 return location_summary_;
658 }
659
660 // Platform specific summary factory for this instruction.
661 LocationSummary* MakeLocationSummary();
662
663 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
664
665 private: 584 private:
666 const LocalVariable& local_; 585 const LocalVariable& local_;
667 const intptr_t context_level_; 586 const intptr_t context_level_;
668 LocationSummary* location_summary_;
669 587
670 DISALLOW_COPY_AND_ASSIGN(LoadLocalComp); 588 DISALLOW_COPY_AND_ASSIGN(LoadLocalComp);
671 }; 589 };
672 590
673 591
674 class StoreLocalComp : public TemplateComputation<1> { 592 class StoreLocalComp : public TemplateComputation<1> {
675 public: 593 public:
676 StoreLocalComp(const LocalVariable& local, 594 StoreLocalComp(const LocalVariable& local,
677 Value* value, 595 Value* value,
678 intptr_t context_level) 596 intptr_t context_level)
679 : local_(local), 597 : local_(local),
680 context_level_(context_level), 598 context_level_(context_level) {
681 location_summary_(MakeLocationSummary()) {
682 inputs_[0] = value; 599 inputs_[0] = value;
683 } 600 }
684 601
685 DECLARE_COMPUTATION(StoreLocal) 602 DECLARE_COMPUTATION(StoreLocal)
686 603
687 const LocalVariable& local() const { return local_; } 604 const LocalVariable& local() const { return local_; }
688 Value* value() const { return inputs_[0]; } 605 Value* value() const { return inputs_[0]; }
689 intptr_t context_level() const { return context_level_; } 606 intptr_t context_level() const { return context_level_; }
690 607
691 virtual void RecordAssignedVars(BitVector* assigned_vars); 608 virtual void RecordAssignedVars(BitVector* assigned_vars);
692 609
693 virtual void PrintOperandsTo(BufferFormatter* f) const; 610 virtual void PrintOperandsTo(BufferFormatter* f) const;
694 611
695 virtual LocationSummary* locs() const {
696 return location_summary_;
697 }
698
699 // Platform specific summary factory for this instruction.
700 LocationSummary* MakeLocationSummary();
701
702 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
703
704 private: 612 private:
705 const LocalVariable& local_; 613 const LocalVariable& local_;
706 const intptr_t context_level_; 614 const intptr_t context_level_;
707 LocationSummary* location_summary_;
708 615
709 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp); 616 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp);
710 }; 617 };
711 618
712 619
713 class NativeCallComp : public TemplateComputation<0> { 620 class NativeCallComp : public TemplateComputation<0> {
714 public: 621 public:
715 NativeCallComp(NativeBodyNode* node, intptr_t try_index) 622 NativeCallComp(NativeBodyNode* node, intptr_t try_index)
716 : ast_node_(*node), try_index_(try_index) {} 623 : ast_node_(*node), try_index_(try_index) {}
717 624
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 const GrowableArray<BlockEntryInstr*>& block_order_; 1861 const GrowableArray<BlockEntryInstr*>& block_order_;
1955 1862
1956 private: 1863 private:
1957 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1864 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
1958 }; 1865 };
1959 1866
1960 1867
1961 } // namespace dart 1868 } // namespace dart
1962 1869
1963 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1870 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « no previous file | vm/intermediate_language_ia32.cc » ('j') | vm/intermediate_language_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698