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

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

Issue 16693006: Initial implementation of on-stack replacement (OSR). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up for review. Created 7 years, 6 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) 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
11 #include "vm/bigint_operations.h" 11 #include "vm/bigint_operations.h"
12 #include "vm/bootstrap.h" 12 #include "vm/bootstrap.h"
13 #include "vm/class_finalizer.h" 13 #include "vm/class_finalizer.h"
14 #include "vm/code_generator.h" 14 #include "vm/code_generator.h"
15 #include "vm/code_observers.h" 15 #include "vm/code_observers.h"
16 #include "vm/code_patcher.h" 16 #include "vm/code_patcher.h"
17 #include "vm/compiler.h" 17 #include "vm/compiler.h"
18 #include "vm/compiler_stats.h" 18 #include "vm/compiler_stats.h"
19 #include "vm/dart.h" 19 #include "vm/dart.h"
20 #include "vm/dart_api_state.h" 20 #include "vm/dart_api_state.h"
21 #include "vm/dart_entry.h" 21 #include "vm/dart_entry.h"
22 #include "vm/datastream.h" 22 #include "vm/datastream.h"
23 #include "vm/debugger.h" 23 #include "vm/debugger.h"
24 #include "vm/deopt_instructions.h" 24 #include "vm/deopt_instructions.h"
25 #include "vm/disassembler.h"
25 #include "vm/double_conversion.h" 26 #include "vm/double_conversion.h"
26 #include "vm/exceptions.h" 27 #include "vm/exceptions.h"
27 #include "vm/flow_graph_builder.h" 28 #include "vm/flow_graph_builder.h"
28 #include "vm/growable_array.h" 29 #include "vm/growable_array.h"
29 #include "vm/heap.h" 30 #include "vm/heap.h"
30 #include "vm/intermediate_language.h" 31 #include "vm/intermediate_language.h"
31 #include "vm/intrinsifier.h" 32 #include "vm/intrinsifier.h"
32 #include "vm/longjump.h" 33 #include "vm/longjump.h"
33 #include "vm/object_store.h" 34 #include "vm/object_store.h"
34 #include "vm/parser.h" 35 #include "vm/parser.h"
(...skipping 7141 matching lines...) Expand 10 before | Expand all | Expand 10 after
7176 switch (DescriptorKind(index)) { 7177 switch (DescriptorKind(index)) {
7177 case PcDescriptors::kDeopt: return "deopt "; 7178 case PcDescriptors::kDeopt: return "deopt ";
7178 case PcDescriptors::kEntryPatch: return "entry-patch "; 7179 case PcDescriptors::kEntryPatch: return "entry-patch ";
7179 case PcDescriptors::kPatchCode: return "patch "; 7180 case PcDescriptors::kPatchCode: return "patch ";
7180 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt "; 7181 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt ";
7181 case PcDescriptors::kIcCall: return "ic-call "; 7182 case PcDescriptors::kIcCall: return "ic-call ";
7182 case PcDescriptors::kFuncCall: return "fn-call "; 7183 case PcDescriptors::kFuncCall: return "fn-call ";
7183 case PcDescriptors::kClosureCall: return "closure-call "; 7184 case PcDescriptors::kClosureCall: return "closure-call ";
7184 case PcDescriptors::kReturn: return "return "; 7185 case PcDescriptors::kReturn: return "return ";
7185 case PcDescriptors::kRuntimeCall: return "runtime-call "; 7186 case PcDescriptors::kRuntimeCall: return "runtime-call ";
7187 case PcDescriptors::kOsrEntry: return "osr-entry ";
7186 case PcDescriptors::kOther: return "other "; 7188 case PcDescriptors::kOther: return "other ";
7187 } 7189 }
7188 UNREACHABLE(); 7190 UNREACHABLE();
7189 return ""; 7191 return "";
7190 } 7192 }
7191 7193
7192 7194
7193 void PcDescriptors::PrintHeaderString() { 7195 void PcDescriptors::PrintHeaderString() {
7194 // 4 bits per hex digit + 2 for "0x". 7196 // 4 bits per hex digit + 2 for "0x".
7195 const int addr_width = (kBitsPerWord / 4) + 2; 7197 const int addr_width = (kBitsPerWord / 4) + 2;
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
7883 const intptr_t i = BinarySearchInSCallTable(pc); 7885 const intptr_t i = BinarySearchInSCallTable(pc);
7884 ASSERT(i >= 0); 7886 ASSERT(i >= 0);
7885 const Array& array = 7887 const Array& array =
7886 Array::Handle(raw_ptr()->static_calls_target_table_); 7888 Array::Handle(raw_ptr()->static_calls_target_table_);
7887 ASSERT(code.IsNull() || 7889 ASSERT(code.IsNull() ||
7888 (code.function() == array.At(i + kSCallTableFunctionEntry))); 7890 (code.function() == array.At(i + kSCallTableFunctionEntry)));
7889 array.SetAt(i + kSCallTableCodeEntry, code); 7891 array.SetAt(i + kSCallTableCodeEntry, code);
7890 } 7892 }
7891 7893
7892 7894
7895 void Code::Disassemble() const {
7896 const Instructions& instr = Instructions::Handle(instructions());
7897 uword start = instr.EntryPoint();
7898 Disassembler::Disassemble(start, start + instr.size(), comments());
7899 }
7900
7901
7893 const Code::Comments& Code::comments() const { 7902 const Code::Comments& Code::comments() const {
7894 Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments_)); 7903 Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments_));
7895 return *comments; 7904 return *comments;
7896 } 7905 }
7897 7906
7898 7907
7899 void Code::set_comments(const Code::Comments& comments) const { 7908 void Code::set_comments(const Code::Comments& comments) const {
7900 StorePointer(&raw_ptr()->comments_, comments.comments_.raw()); 7909 StorePointer(&raw_ptr()->comments_, comments.comments_.raw());
7901 } 7910 }
7902 7911
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
8035 (descriptors.DescriptorKind(i) == kind)) { 8044 (descriptors.DescriptorKind(i) == kind)) {
8036 uword pc = descriptors.PC(i); 8045 uword pc = descriptors.PC(i);
8037 ASSERT(ContainsInstructionAt(pc)); 8046 ASSERT(ContainsInstructionAt(pc));
8038 return pc; 8047 return pc;
8039 } 8048 }
8040 } 8049 }
8041 return 0; 8050 return 0;
8042 } 8051 }
8043 8052
8044 8053
8054 intptr_t Code::GetDeoptIdForOsr(uword pc) const {
8055 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
8056 for (intptr_t i = 0; i < descriptors.Length(); ++i) {
8057 if ((descriptors.PC(i) == pc) &&
8058 (descriptors.DescriptorKind(i) == PcDescriptors::kOsrEntry)) {
8059 return descriptors.DeoptId(i);
8060 }
8061 }
8062 return Isolate::kNoDeoptId;
8063 }
8064
8065
8045 const char* Code::ToCString() const { 8066 const char* Code::ToCString() const {
8046 const char* kFormat = "Code entry:%p"; 8067 const char* kFormat = "Code entry:%p";
8047 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; 8068 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1;
8048 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 8069 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
8049 OS::SNPrint(chars, len, kFormat, EntryPoint()); 8070 OS::SNPrint(chars, len, kFormat, EntryPoint());
8050 return chars; 8071 return chars;
8051 } 8072 }
8052 8073
8053 8074
8054 uword Code::GetPatchCodePc() const { 8075 uword Code::GetPatchCodePc() const {
(...skipping 5347 matching lines...) Expand 10 before | Expand all | Expand 10 after
13402 space); 13423 space);
13403 return reinterpret_cast<RawWeakProperty*>(raw); 13424 return reinterpret_cast<RawWeakProperty*>(raw);
13404 } 13425 }
13405 13426
13406 13427
13407 const char* WeakProperty::ToCString() const { 13428 const char* WeakProperty::ToCString() const {
13408 return "_WeakProperty"; 13429 return "_WeakProperty";
13409 } 13430 }
13410 13431
13411 } // namespace dart 13432 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698