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

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

Powered by Google App Engine
This is Rietveld 408576698