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

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

Issue 1073173003: Eliminate object table and use regular object pool for deoptimization infos. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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/deopt_instructions.h ('k') | runtime/vm/flow_graph_compiler.h » ('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 #include "vm/deopt_instructions.h" 5 #include "vm/deopt_instructions.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/intermediate_language.h" 10 #include "vm/intermediate_language.h"
11 #include "vm/locations.h" 11 #include "vm/locations.h"
12 #include "vm/parser.h" 12 #include "vm/parser.h"
13 #include "vm/stack_frame.h" 13 #include "vm/stack_frame.h"
14 #include "vm/thread.h" 14 #include "vm/thread.h"
15 15
16 namespace dart { 16 namespace dart {
17 17
18 DEFINE_FLAG(bool, compress_deopt_info, true, 18 DEFINE_FLAG(bool, compress_deopt_info, true,
19 "Compress the size of the deoptimization info for optimized code."); 19 "Compress the size of the deoptimization info for optimized code.");
20 DECLARE_FLAG(bool, trace_deoptimization); 20 DECLARE_FLAG(bool, trace_deoptimization);
21 DECLARE_FLAG(bool, trace_deoptimization_verbose); 21 DECLARE_FLAG(bool, trace_deoptimization_verbose);
22 22
23 23
24 DeoptContext::DeoptContext(const StackFrame* frame, 24 DeoptContext::DeoptContext(const StackFrame* frame,
25 const Code& code, 25 const Code& code,
26 DestFrameOptions dest_options, 26 DestFrameOptions dest_options,
27 fpu_register_t* fpu_registers, 27 fpu_register_t* fpu_registers,
28 intptr_t* cpu_registers) 28 intptr_t* cpu_registers)
29 : code_(code.raw()), 29 : code_(code.raw()),
30 object_table_(code.object_table()), 30 object_pool_(code.ObjectPool()),
31 deopt_info_(TypedData::null()), 31 deopt_info_(TypedData::null()),
32 dest_frame_is_allocated_(false), 32 dest_frame_is_allocated_(false),
33 dest_frame_(NULL), 33 dest_frame_(NULL),
34 dest_frame_size_(0), 34 dest_frame_size_(0),
35 source_frame_is_allocated_(false), 35 source_frame_is_allocated_(false),
36 source_frame_(NULL), 36 source_frame_(NULL),
37 source_frame_size_(0), 37 source_frame_size_(0),
38 cpu_registers_(cpu_registers), 38 cpu_registers_(cpu_registers),
39 fpu_registers_(fpu_registers), 39 fpu_registers_(fpu_registers),
40 num_args_(0), 40 num_args_(0),
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 for (intptr_t i = 0; i < deferred_objects_count_; i++) { 123 for (intptr_t i = 0; i < deferred_objects_count_; i++) {
124 delete deferred_objects_[i]; 124 delete deferred_objects_[i];
125 } 125 }
126 delete[] deferred_objects_; 126 delete[] deferred_objects_;
127 deferred_objects_ = NULL; 127 deferred_objects_ = NULL;
128 deferred_objects_count_ = 0; 128 deferred_objects_count_ = 0;
129 } 129 }
130 130
131 131
132 void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) { 132 void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) {
133 visitor->VisitPointer(reinterpret_cast<RawObject**>(&object_table_)); 133 visitor->VisitPointer(reinterpret_cast<RawObject**>(&object_pool_));
134 visitor->VisitPointer(reinterpret_cast<RawObject**>(&deopt_info_)); 134 visitor->VisitPointer(reinterpret_cast<RawObject**>(&deopt_info_));
135 135
136 // Visit any object pointers on the destination stack. 136 // Visit any object pointers on the destination stack.
137 if (dest_frame_is_allocated_) { 137 if (dest_frame_is_allocated_) {
138 for (intptr_t i = 0; i < dest_frame_size_; i++) { 138 for (intptr_t i = 0; i < dest_frame_size_; i++) {
139 if (dest_frame_[i] != 0) { 139 if (dest_frame_[i] != 0) {
140 visitor->VisitPointer(reinterpret_cast<RawObject**>(&dest_frame_[i])); 140 visitor->VisitPointer(reinterpret_cast<RawObject**>(&dest_frame_[i]));
141 } 141 }
142 } 142 }
143 } 143 }
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 } 909 }
910 910
911 private: 911 private:
912 const DeoptInstr* instruction_; // Instruction that was written. 912 const DeoptInstr* instruction_; // Instruction that was written.
913 const intptr_t info_number_; // Index of the deopt info it was written to. 913 const intptr_t info_number_; // Index of the deopt info it was written to.
914 914
915 GrowableArray<TrieNode*> children_; 915 GrowableArray<TrieNode*> children_;
916 }; 916 };
917 917
918 918
919 DeoptInfoBuilder::DeoptInfoBuilder(Zone* zone, const intptr_t num_args) 919 DeoptInfoBuilder::DeoptInfoBuilder(Zone* zone,
920 const intptr_t num_args,
921 Assembler* assembler)
920 : zone_(zone), 922 : zone_(zone),
921 instructions_(), 923 instructions_(),
922 object_table_(GrowableObjectArray::Handle(
923 GrowableObjectArray::New(Heap::kOld))),
924 num_args_(num_args), 924 num_args_(num_args),
925 assembler_(assembler),
925 trie_root_(new(zone) TrieNode()), 926 trie_root_(new(zone) TrieNode()),
926 current_info_number_(0), 927 current_info_number_(0),
927 frame_start_(-1), 928 frame_start_(-1),
928 materializations_() { 929 materializations_() {
929 } 930 }
930 931
931 932
932 intptr_t DeoptInfoBuilder::FindOrAddObjectInTable(const Object& obj) const { 933 intptr_t DeoptInfoBuilder::FindOrAddObjectInTable(const Object& obj) const {
933 for (intptr_t i = 0; i < object_table_.Length(); i++) { 934 return assembler_->object_pool().FindObject(obj, kNotPatchable);
934 if (object_table_.At(i) == obj.raw()) {
935 return i;
936 }
937 }
938 // Add object.
939 const intptr_t result = object_table_.Length();
940 object_table_.Add(obj, Heap::kOld);
941 return result;
942 } 935 }
943 936
944 937
945 intptr_t DeoptInfoBuilder::CalculateStackIndex( 938 intptr_t DeoptInfoBuilder::CalculateStackIndex(
946 const Location& source_loc) const { 939 const Location& source_loc) const {
947 return source_loc.stack_index() < 0 ? 940 return source_loc.stack_index() < 0 ?
948 source_loc.stack_index() + num_args_ : 941 source_loc.stack_index() + num_args_ :
949 source_loc.stack_index() + num_args_ + kDartFrameFixedSize; 942 source_loc.stack_index() + num_args_ + kDartFrameFixedSize;
950 } 943 }
951 944
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 Smi* offset, 1254 Smi* offset,
1262 TypedData* info, 1255 TypedData* info,
1263 Smi* reason) { 1256 Smi* reason) {
1264 intptr_t i = index * kEntrySize; 1257 intptr_t i = index * kEntrySize;
1265 *offset ^= table.At(i); 1258 *offset ^= table.At(i);
1266 *info ^= table.At(i + 1); 1259 *info ^= table.At(i + 1);
1267 *reason ^= table.At(i + 2); 1260 *reason ^= table.At(i + 2);
1268 } 1261 }
1269 1262
1270 } // namespace dart 1263 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/deopt_instructions.h ('k') | runtime/vm/flow_graph_compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698