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

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

Issue 619903002: Generalize bounds checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
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 VM_DEOPT_INSTRUCTIONS_H_ 5 #ifndef VM_DEOPT_INSTRUCTIONS_H_
6 #define VM_DEOPT_INSTRUCTIONS_H_ 6 #define 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_generator.h" 10 #include "vm/code_generator.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 Isolate* isolate() const { return isolate_; } 87 Isolate* isolate() const { return isolate_; }
88 88
89 intptr_t source_frame_size() const { return source_frame_size_; } 89 intptr_t source_frame_size() const { return source_frame_size_; }
90 intptr_t dest_frame_size() const { return dest_frame_size_; } 90 intptr_t dest_frame_size() const { return dest_frame_size_; }
91 91
92 RawCode* code() const { return code_; } 92 RawCode* code() const { return code_; }
93 93
94 ICData::DeoptReasonId deopt_reason() const { return deopt_reason_; } 94 ICData::DeoptReasonId deopt_reason() const { return deopt_reason_; }
95 bool HasDeoptFlag(ICData::DeoptFlags flag) {
96 return (deopt_flags_ & flag) != 0;
97 }
95 98
96 RawDeoptInfo* deopt_info() const { return deopt_info_; } 99 RawDeoptInfo* deopt_info() const { return deopt_info_; }
97 100
98 // Fills the destination frame but defers materialization of 101 // Fills the destination frame but defers materialization of
99 // objects. 102 // objects.
100 void FillDestFrame(); 103 void FillDestFrame();
101 104
102 // Materializes all deferred objects. Returns the total number of 105 // Materializes all deferred objects. Returns the total number of
103 // artificial arguments used during deoptimization. 106 // artificial arguments used during deoptimization.
104 intptr_t MaterializeDeferredObjects(); 107 intptr_t MaterializeDeferredObjects();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 bool dest_frame_is_allocated_; 187 bool dest_frame_is_allocated_;
185 intptr_t* dest_frame_; 188 intptr_t* dest_frame_;
186 intptr_t dest_frame_size_; 189 intptr_t dest_frame_size_;
187 bool source_frame_is_allocated_; 190 bool source_frame_is_allocated_;
188 intptr_t* source_frame_; 191 intptr_t* source_frame_;
189 intptr_t source_frame_size_; 192 intptr_t source_frame_size_;
190 intptr_t* cpu_registers_; 193 intptr_t* cpu_registers_;
191 fpu_register_t* fpu_registers_; 194 fpu_register_t* fpu_registers_;
192 intptr_t num_args_; 195 intptr_t num_args_;
193 ICData::DeoptReasonId deopt_reason_; 196 ICData::DeoptReasonId deopt_reason_;
197 uint32_t deopt_flags_;
194 intptr_t caller_fp_; 198 intptr_t caller_fp_;
195 Isolate* isolate_; 199 Isolate* isolate_;
196 200
197 DeferredSlot* deferred_slots_; 201 DeferredSlot* deferred_slots_;
198 202
199 intptr_t deferred_objects_count_; 203 intptr_t deferred_objects_count_;
200 DeferredObject** deferred_objects_; 204 DeferredObject** deferred_objects_;
201 205
202 DISALLOW_COPY_AND_ASSIGN(DeoptContext); 206 DISALLOW_COPY_AND_ASSIGN(DeoptContext);
203 }; 207 };
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 class DeoptTable : public AllStatic { 483 class DeoptTable : public AllStatic {
480 public: 484 public:
481 // Return the array size in elements for a given number of table entries. 485 // Return the array size in elements for a given number of table entries.
482 static intptr_t SizeFor(intptr_t length); 486 static intptr_t SizeFor(intptr_t length);
483 487
484 // Set the entry at the given index into the table (not an array index). 488 // Set the entry at the given index into the table (not an array index).
485 static void SetEntry(const Array& table, 489 static void SetEntry(const Array& table,
486 intptr_t index, 490 intptr_t index,
487 const Smi& offset, 491 const Smi& offset,
488 const DeoptInfo& info, 492 const DeoptInfo& info,
489 const Smi& reason); 493 const Smi& reason_and_flags);
490 494
491 // Return the length of the table in entries. 495 // Return the length of the table in entries.
492 static intptr_t GetLength(const Array& table); 496 static intptr_t GetLength(const Array& table);
493 497
494 // Set the output parameters (offset, info, reason) to the entry values at 498 // Set the output parameters (offset, info, reason) to the entry values at
495 // the index into the table (not an array index). 499 // the index into the table (not an array index).
496 static void GetEntry(const Array& table, 500 static void GetEntry(const Array& table,
497 intptr_t index, 501 intptr_t index,
498 Smi* offset, 502 Smi* offset,
499 DeoptInfo* info, 503 DeoptInfo* info,
500 Smi* reason); 504 Smi* reason_and_flags);
505
506 static RawSmi* EncodeReasonAndFlags(ICData::DeoptReasonId reason,
507 uint32_t flags) {
508 return Smi::New(ReasonField::encode(reason) |
509 FlagsField::encode(flags));
510 }
511
512 class ReasonField : public BitField<ICData::DeoptReasonId, 0, 8> { };
513 class FlagsField : public BitField<uint32_t, 8, 8> { };
501 514
502 private: 515 private:
503 static const intptr_t kEntrySize = 3; 516 static const intptr_t kEntrySize = 3;
504 }; 517 };
505 518
506 } // namespace dart 519 } // namespace dart
507 520
508 #endif // VM_DEOPT_INSTRUCTIONS_H_ 521 #endif // VM_DEOPT_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698