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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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
« no previous file with comments | « runtime/vm/deferred_objects.cc ('k') | runtime/vm/deopt_instructions.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 RUNTIME_VM_DEOPT_INSTRUCTIONS_H_ 5 #ifndef RUNTIME_VM_DEOPT_INSTRUCTIONS_H_
6 #define RUNTIME_VM_DEOPT_INSTRUCTIONS_H_ 6 #define RUNTIME_VM_DEOPT_INSTRUCTIONS_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/code_descriptors.h" 10 #include "vm/code_descriptors.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 virtual intptr_t source_index() const = 0; 366 virtual intptr_t source_index() const = 0;
367 367
368 virtual const char* ArgumentsToCString() const { return NULL; } 368 virtual const char* ArgumentsToCString() const { return NULL; }
369 369
370 private: 370 private:
371 static const char* KindToCString(Kind kind); 371 static const char* KindToCString(Kind kind);
372 372
373 DISALLOW_COPY_AND_ASSIGN(DeoptInstr); 373 DISALLOW_COPY_AND_ASSIGN(DeoptInstr);
374 }; 374 };
375 375
376
377 // Helper class that allows to read a value of the given register from 376 // Helper class that allows to read a value of the given register from
378 // the DeoptContext as the specified type. 377 // the DeoptContext as the specified type.
379 // It calls different method depending on which kind of register (cpu/fpu) and 378 // It calls different method depending on which kind of register (cpu/fpu) and
380 // destination types are specified. 379 // destination types are specified.
381 template <typename RegisterType, typename DestinationType> 380 template <typename RegisterType, typename DestinationType>
382 struct RegisterReader; 381 struct RegisterReader;
383 382
384 template <typename T> 383 template <typename T>
385 struct RegisterReader<Register, T> { 384 struct RegisterReader<Register, T> {
386 static intptr_t Read(DeoptContext* context, Register reg) { 385 static intptr_t Read(DeoptContext* context, Register reg) {
387 return context->RegisterValue(reg); 386 return context->RegisterValue(reg);
388 } 387 }
389 }; 388 };
390 389
391 template <> 390 template <>
392 struct RegisterReader<FpuRegister, double> { 391 struct RegisterReader<FpuRegister, double> {
393 static double Read(DeoptContext* context, FpuRegister reg) { 392 static double Read(DeoptContext* context, FpuRegister reg) {
394 return context->FpuRegisterValue(reg); 393 return context->FpuRegisterValue(reg);
395 } 394 }
396 }; 395 };
397 396
398
399 template <> 397 template <>
400 struct RegisterReader<FpuRegister, simd128_value_t> { 398 struct RegisterReader<FpuRegister, simd128_value_t> {
401 static simd128_value_t Read(DeoptContext* context, FpuRegister reg) { 399 static simd128_value_t Read(DeoptContext* context, FpuRegister reg) {
402 return context->FpuRegisterValueAsSimd128(reg); 400 return context->FpuRegisterValueAsSimd128(reg);
403 } 401 }
404 }; 402 };
405 403
406
407 // Class that encapsulates reading and writing of values that were either in 404 // Class that encapsulates reading and writing of values that were either in
408 // the registers in the optimized code or were spilled from those registers 405 // the registers in the optimized code or were spilled from those registers
409 // to the stack. 406 // to the stack.
410 template <typename RegisterType> 407 template <typename RegisterType>
411 class RegisterSource { 408 class RegisterSource {
412 public: 409 public:
413 enum Kind { 410 enum Kind {
414 // Spilled register source represented as its spill slot. 411 // Spilled register source represented as its spill slot.
415 kStackSlot = 0, 412 kStackSlot = 0,
416 // Register source represented as its register index. 413 // Register source represented as its register index.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 463
467 static const char* Name(Register reg) { return Assembler::RegisterName(reg); } 464 static const char* Name(Register reg) { return Assembler::RegisterName(reg); }
468 465
469 static const char* Name(FpuRegister fpu_reg) { 466 static const char* Name(FpuRegister fpu_reg) {
470 return Assembler::FpuRegisterName(fpu_reg); 467 return Assembler::FpuRegisterName(fpu_reg);
471 } 468 }
472 469
473 const intptr_t source_index_; 470 const intptr_t source_index_;
474 }; 471 };
475 472
476
477 typedef RegisterSource<Register> CpuRegisterSource; 473 typedef RegisterSource<Register> CpuRegisterSource;
478 typedef RegisterSource<FpuRegister> FpuRegisterSource; 474 typedef RegisterSource<FpuRegister> FpuRegisterSource;
479 475
480
481 // Builds a deoptimization info table, one DeoptInfo at a time. Call AddXXX 476 // Builds a deoptimization info table, one DeoptInfo at a time. Call AddXXX
482 // methods in the order of their target, starting wih deoptimized code 477 // methods in the order of their target, starting wih deoptimized code
483 // continuation pc and ending with the first argument of the deoptimized 478 // continuation pc and ending with the first argument of the deoptimized
484 // code. Call CreateDeoptInfo to write the accumulated instructions into 479 // code. Call CreateDeoptInfo to write the accumulated instructions into
485 // the heap and reset the builder's internal state for the next DeoptInfo. 480 // the heap and reset the builder's internal state for the next DeoptInfo.
486 class DeoptInfoBuilder : public ValueObject { 481 class DeoptInfoBuilder : public ValueObject {
487 public: 482 public:
488 DeoptInfoBuilder(Zone* zone, const intptr_t num_args, Assembler* assembler); 483 DeoptInfoBuilder(Zone* zone, const intptr_t num_args, Assembler* assembler);
489 484
490 // Return address before instruction. 485 // Return address before instruction.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 // Used to compress entries by sharing suffixes. 552 // Used to compress entries by sharing suffixes.
558 TrieNode* trie_root_; 553 TrieNode* trie_root_;
559 intptr_t current_info_number_; 554 intptr_t current_info_number_;
560 555
561 intptr_t frame_start_; 556 intptr_t frame_start_;
562 GrowableArray<MaterializeObjectInstr*> materializations_; 557 GrowableArray<MaterializeObjectInstr*> materializations_;
563 558
564 DISALLOW_COPY_AND_ASSIGN(DeoptInfoBuilder); 559 DISALLOW_COPY_AND_ASSIGN(DeoptInfoBuilder);
565 }; 560 };
566 561
567
568 // Utilities for managing the deopt table and its entries. The table is 562 // Utilities for managing the deopt table and its entries. The table is
569 // stored in an Array in the heap. It consists of triples of (PC offset, 563 // stored in an Array in the heap. It consists of triples of (PC offset,
570 // info, reason). Elements of each entry are stored consecutively in the 564 // info, reason). Elements of each entry are stored consecutively in the
571 // array. 565 // array.
572 // TODO(vegorov): consider compressing the whole table into a single TypedData 566 // TODO(vegorov): consider compressing the whole table into a single TypedData
573 // object. 567 // object.
574 class DeoptTable : public AllStatic { 568 class DeoptTable : public AllStatic {
575 public: 569 public:
576 // Return the array size in elements for a given number of table entries. 570 // Return the array size in elements for a given number of table entries.
577 static intptr_t SizeFor(intptr_t length); 571 static intptr_t SizeFor(intptr_t length);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 private: 641 private:
648 static void UnpackInto(const Array& table, 642 static void UnpackInto(const Array& table,
649 const TypedData& packed, 643 const TypedData& packed,
650 GrowableArray<DeoptInstr*>* instructions, 644 GrowableArray<DeoptInstr*>* instructions,
651 intptr_t length); 645 intptr_t length);
652 }; 646 };
653 647
654 } // namespace dart 648 } // namespace dart
655 649
656 #endif // RUNTIME_VM_DEOPT_INSTRUCTIONS_H_ 650 #endif // RUNTIME_VM_DEOPT_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « runtime/vm/deferred_objects.cc ('k') | runtime/vm/deopt_instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698