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

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

Issue 10823131: Add deopt info to code object and print it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
11 #include "vm/ast_printer.h" 11 #include "vm/ast_printer.h"
12 #include "vm/il_printer.h" 12 #include "vm/il_printer.h"
13 #include "vm/locations.h" 13 #include "vm/locations.h"
14 #include "vm/object_store.h" 14 #include "vm/object_store.h"
15 #include "vm/parser.h" 15 #include "vm/parser.h"
16 #include "vm/stub_code.h" 16 #include "vm/stub_code.h"
17 #include "vm/symbols.h" 17 #include "vm/symbols.h"
18 18
19 namespace dart { 19 namespace dart {
20 20
21 DECLARE_FLAG(bool, enable_type_checks); 21 DECLARE_FLAG(bool, enable_type_checks);
22 DECLARE_FLAG(bool, print_ast); 22 DECLARE_FLAG(bool, print_ast);
23 DECLARE_FLAG(bool, print_scopes); 23 DECLARE_FLAG(bool, print_scopes);
24 DECLARE_FLAG(bool, trace_functions); 24 DECLARE_FLAG(bool, trace_functions);
25 25
26 26
27 void DeoptimizationStub::GenerateCode(FlowGraphCompiler* compiler) { 27 void DeoptimizationStub::GenerateCode(FlowGraphCompiler* compiler,
28 intptr_t stub_ix) {
28 Assembler* assem = compiler->assembler(); 29 Assembler* assem = compiler->assembler();
29 #define __ assem-> 30 #define __ assem->
30 __ Comment("Deopt stub for id %d", deopt_id_); 31 __ Comment("Deopt stub for id %d", deopt_id_);
31 __ Bind(entry_label()); 32 __ Bind(entry_label());
32 33
33 if (deoptimization_env_ == NULL) { 34 if (deoptimization_env_ == NULL) {
34 for (intptr_t i = 0; i < registers_.length(); i++) { 35 for (intptr_t i = 0; i < registers_.length(); i++) {
35 if (registers_[i] != kNoRegister) { 36 if (registers_[i] != kNoRegister) {
36 __ pushq(registers_[i]); 37 __ pushq(registers_[i]);
37 } 38 }
(...skipping 19 matching lines...) Expand all
57 if (source.IsInvalid()) { 58 if (source.IsInvalid()) {
58 ASSERT(values[i]->IsConstant()); 59 ASSERT(values[i]->IsConstant());
59 source = Location::Constant(values[i]->AsConstant()->value()); 60 source = Location::Constant(values[i]->AsConstant()->value());
60 } 61 }
61 move->AddMove(destination, source); 62 move->AddMove(destination, source);
62 } 63 }
63 compiler->parallel_move_resolver()->EmitNativeCode(move); 64 compiler->parallel_move_resolver()->EmitNativeCode(move);
64 } 65 }
65 66
66 if (compiler->IsLeaf()) { 67 if (compiler->IsLeaf()) {
68 __ Comment("Leaf method, lazy PC marker setup");
67 Label L; 69 Label L;
68 __ call(&L); 70 __ call(&L);
69 const intptr_t offset = assem->CodeSize(); 71 const intptr_t offset = assem->CodeSize();
70 __ Bind(&L); 72 __ Bind(&L);
71 __ popq(RAX); 73 __ popq(RAX);
72 __ subq(RAX, 74 __ subq(RAX,
73 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint)); 75 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint));
74 __ movq(Address(RBP, -kWordSize), RAX); 76 __ movq(Address(RBP, -kWordSize), RAX);
75 } 77 }
76 __ movq(RAX, Immediate(Smi::RawValue(reason_))); 78 __ movq(RAX, Immediate(Smi::RawValue(reason_)));
77 __ call(&StubCode::DeoptimizeLabel()); 79 __ call(&StubCode::DeoptimizeLabel());
78 compiler->AddCurrentDescriptor(PcDescriptors::kOther, 80 const intptr_t deopt_info_index = stub_ix;
79 deopt_id_, 81 compiler->pc_descriptors_list()-> AddDeoptInfo(
80 deopt_token_pos_, 82 compiler->assembler()->CodeSize(),
81 try_index_); 83 deopt_id_,
84 deopt_token_pos_,
85 deopt_info_index);
86 __ int3();
82 #undef __ 87 #undef __
83 } 88 }
84 89
85 90
86 #define __ assembler()-> 91 #define __ assembler()->
87 92
88 93
89 // Fall through if bool_register contains null. 94 // Fall through if bool_register contains null.
90 void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, 95 void FlowGraphCompiler::GenerateBoolToJump(Register bool_register,
91 Label* is_true, 96 Label* is_true,
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { 1231 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) {
1227 __ Exchange(mem1, mem2); 1232 __ Exchange(mem1, mem2);
1228 } 1233 }
1229 1234
1230 1235
1231 #undef __ 1236 #undef __
1232 1237
1233 } // namespace dart 1238 } // namespace dart
1234 1239
1235 #endif // defined TARGET_ARCH_X64 1240 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698