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

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

Issue 11363141: Improve smi shift operations and avoid repeated deoptimizations. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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_optimizer.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 #include "vm/deopt_instructions.h" 5 #include "vm/deopt_instructions.h"
6 6
7 #include "vm/assembler_macros.h" 7 #include "vm/assembler_macros.h"
8 #include "vm/code_patcher.h"
8 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
9 #include "vm/locations.h" 10 #include "vm/locations.h"
10 #include "vm/parser.h" 11 #include "vm/parser.h"
11 12
12 namespace dart { 13 namespace dart {
13 14
14 DEFINE_FLAG(bool, compress_deopt_info, true, 15 DEFINE_FLAG(bool, compress_deopt_info, true,
15 "Compress the size of the deoptimization info for optimized code."); 16 "Compress the size of the deoptimization info for optimized code.");
16 17
17 DeoptimizationContext::DeoptimizationContext(intptr_t* to_frame_start, 18 DeoptimizationContext::DeoptimizationContext(intptr_t* to_frame_start,
18 intptr_t to_frame_size, 19 intptr_t to_frame_size,
19 const Array& object_table, 20 const Array& object_table,
20 intptr_t num_args) 21 intptr_t num_args,
22 DeoptReasonId deopt_reason)
21 : object_table_(object_table), 23 : object_table_(object_table),
22 to_frame_(to_frame_start), 24 to_frame_(to_frame_start),
23 to_frame_size_(to_frame_size), 25 to_frame_size_(to_frame_size),
24 from_frame_(NULL), 26 from_frame_(NULL),
25 from_frame_size_(0), 27 from_frame_size_(0),
26 registers_copy_(NULL), 28 registers_copy_(NULL),
27 xmm_registers_copy_(NULL), 29 xmm_registers_copy_(NULL),
28 num_args_(num_args), 30 num_args_(num_args),
31 deopt_reason_(deopt_reason),
29 isolate_(Isolate::Current()) { 32 isolate_(Isolate::Current()) {
30 from_frame_ = isolate_->deopt_frame_copy(); 33 from_frame_ = isolate_->deopt_frame_copy();
31 from_frame_size_ = isolate_->deopt_frame_copy_size(); 34 from_frame_size_ = isolate_->deopt_frame_copy_size();
32 registers_copy_ = isolate_->deopt_cpu_registers_copy(); 35 registers_copy_ = isolate_->deopt_cpu_registers_copy();
33 xmm_registers_copy_ = isolate_->deopt_xmm_registers_copy(); 36 xmm_registers_copy_ = isolate_->deopt_xmm_registers_copy();
34 caller_fp_ = GetFromFp(); 37 caller_fp_ = GetFromFp();
35 } 38 }
36 39
37 40
38 intptr_t DeoptimizationContext::GetFromFp() const { 41 intptr_t DeoptimizationContext::GetFromFp() const {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 252 }
250 253
251 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) { 254 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) {
252 Function& function = Function::Handle(deopt_context->isolate()); 255 Function& function = Function::Handle(deopt_context->isolate());
253 function ^= deopt_context->ObjectAt(object_table_index_); 256 function ^= deopt_context->ObjectAt(object_table_index_);
254 const Code& code = 257 const Code& code =
255 Code::Handle(deopt_context->isolate(), function.unoptimized_code()); 258 Code::Handle(deopt_context->isolate(), function.unoptimized_code());
256 uword continue_at_pc = code.GetDeoptBeforePcAtDeoptId(deopt_id_); 259 uword continue_at_pc = code.GetDeoptBeforePcAtDeoptId(deopt_id_);
257 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index); 260 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index);
258 *to_addr = continue_at_pc; 261 *to_addr = continue_at_pc;
262
263 uword pc = code.GetPcForDeoptId(deopt_id_, PcDescriptors::kIcCall);
264 const ICData& ic_data = CodePatcher::GetInstanceCallIcData(pc);
265 if (!ic_data.IsNull()) {
266 ic_data.set_deopt_reason(deopt_context->deopt_reason());
267 }
259 } 268 }
260 269
261 private: 270 private:
262 static const intptr_t kFieldWidth = kBitsPerWord / 2; 271 static const intptr_t kFieldWidth = kBitsPerWord / 2;
263 class ObjectTableIndex : public BitField<intptr_t, 0, kFieldWidth> { }; 272 class ObjectTableIndex : public BitField<intptr_t, 0, kFieldWidth> { };
264 class DeoptId : public BitField<intptr_t, kFieldWidth, kFieldWidth> { }; 273 class DeoptId : public BitField<intptr_t, kFieldWidth, kFieldWidth> { };
265 274
266 const intptr_t object_table_index_; 275 const intptr_t object_table_index_;
267 const intptr_t deopt_id_; 276 const intptr_t deopt_id_;
268 277
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 Smi* offset, 788 Smi* offset,
780 DeoptInfo* info, 789 DeoptInfo* info,
781 Smi* reason) { 790 Smi* reason) {
782 intptr_t i = index * kEntrySize; 791 intptr_t i = index * kEntrySize;
783 *offset ^= table.At(i); 792 *offset ^= table.At(i);
784 *info ^= table.At(i + 1); 793 *info ^= table.At(i + 1);
785 *reason ^= table.At(i + 2); 794 *reason ^= table.At(i + 2);
786 } 795 }
787 796
788 } // namespace dart 797 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/deopt_instructions.h ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698