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

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
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 const PcDescriptors& descriptors =
264 PcDescriptors::Handle(code.pc_descriptors());
265 ICData& ic_data = ICData::Handle();
266 for (intptr_t i = 0; i < descriptors.Length(); i++) {
267 if ((descriptors.DescriptorKind(i) == PcDescriptors::kIcCall) &&
268 (descriptors.DeoptId(i) == deopt_id_)) {
269 ic_data = CodePatcher::GetInstanceCallIcDataAt(descriptors.PC(i));
270 break;
271 }
272 }
srdjan 2012/11/08 21:37:27 This could be: uword pc = code.GetPcForDeoptId(deo
Florian Schneider 2012/11/08 22:03:00 Done.
273 if (!ic_data.IsNull()) {
274 ic_data.set_deopt_reason(deopt_context->deopt_reason());
275 }
259 } 276 }
260 277
261 private: 278 private:
262 static const intptr_t kFieldWidth = kBitsPerWord / 2; 279 static const intptr_t kFieldWidth = kBitsPerWord / 2;
263 class ObjectTableIndex : public BitField<intptr_t, 0, kFieldWidth> { }; 280 class ObjectTableIndex : public BitField<intptr_t, 0, kFieldWidth> { };
264 class DeoptId : public BitField<intptr_t, kFieldWidth, kFieldWidth> { }; 281 class DeoptId : public BitField<intptr_t, kFieldWidth, kFieldWidth> { };
265 282
266 const intptr_t object_table_index_; 283 const intptr_t object_table_index_;
267 const intptr_t deopt_id_; 284 const intptr_t deopt_id_;
268 285
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 Smi* offset, 796 Smi* offset,
780 DeoptInfo* info, 797 DeoptInfo* info,
781 Smi* reason) { 798 Smi* reason) {
782 intptr_t i = index * kEntrySize; 799 intptr_t i = index * kEntrySize;
783 *offset ^= table.At(i); 800 *offset ^= table.At(i);
784 *info ^= table.At(i + 1); 801 *info ^= table.At(i + 1);
785 *reason ^= table.At(i + 2); 802 *reason ^= table.At(i + 2);
786 } 803 }
787 804
788 } // namespace dart 805 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698