| OLD | NEW |
| 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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/locations.h" | 9 #include "vm/locations.h" |
| 10 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 intptr_t object_table_index = FindOrAddObjectInTable(from_loc.constant()); | 313 intptr_t object_table_index = FindOrAddObjectInTable(from_loc.constant()); |
| 314 deopt_instr = new DeoptConstantInstr(object_table_index); | 314 deopt_instr = new DeoptConstantInstr(object_table_index); |
| 315 } else if (from_loc.IsRegister()) { | 315 } else if (from_loc.IsRegister()) { |
| 316 deopt_instr = new DeoptRegisterInstr(from_loc.reg()); | 316 deopt_instr = new DeoptRegisterInstr(from_loc.reg()); |
| 317 } else if (from_loc.IsStackSlot()) { | 317 } else if (from_loc.IsStackSlot()) { |
| 318 intptr_t from_index = (from_loc.stack_index() < 0) ? | 318 intptr_t from_index = (from_loc.stack_index() < 0) ? |
| 319 from_loc.stack_index() + num_args_ : | 319 from_loc.stack_index() + num_args_ : |
| 320 from_loc.stack_index() + num_args_ - | 320 from_loc.stack_index() + num_args_ - |
| 321 ParsedFunction::kFirstLocalSlotIndex + 1; | 321 ParsedFunction::kFirstLocalSlotIndex + 1; |
| 322 deopt_instr = new DeoptStackSlotInstr(from_index); | 322 deopt_instr = new DeoptStackSlotInstr(from_index); |
| 323 } else if (from_loc.IsInvalid()) { | |
| 324 ASSERT(from_value.IsConstant()); | |
| 325 const Object& obj = from_value.AsConstant()->value(); | |
| 326 intptr_t object_table_index = FindOrAddObjectInTable(obj); | |
| 327 deopt_instr = new DeoptConstantInstr(object_table_index); | |
| 328 } else { | 323 } else { |
| 329 UNREACHABLE(); | 324 UNREACHABLE(); |
| 330 } | 325 } |
| 331 ASSERT(to_index == instructions_.length()); | 326 ASSERT(to_index == instructions_.length()); |
| 332 instructions_.Add(deopt_instr); | 327 instructions_.Add(deopt_instr); |
| 333 } | 328 } |
| 334 | 329 |
| 335 | 330 |
| 336 void DeoptInfoBuilder::AddCallerFp(intptr_t to_index) { | 331 void DeoptInfoBuilder::AddCallerFp(intptr_t to_index) { |
| 337 ASSERT(to_index == instructions_.length()); | 332 ASSERT(to_index == instructions_.length()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 349 const intptr_t len = instructions_.length(); | 344 const intptr_t len = instructions_.length(); |
| 350 const DeoptInfo& deopt_info = DeoptInfo::Handle(DeoptInfo::New(len)); | 345 const DeoptInfo& deopt_info = DeoptInfo::Handle(DeoptInfo::New(len)); |
| 351 for (intptr_t i = 0; i < len; i++) { | 346 for (intptr_t i = 0; i < len; i++) { |
| 352 DeoptInstr* instr = instructions_[i]; | 347 DeoptInstr* instr = instructions_[i]; |
| 353 deopt_info.SetAt(i, instr->kind(), instr->from_index()); | 348 deopt_info.SetAt(i, instr->kind(), instr->from_index()); |
| 354 } | 349 } |
| 355 return deopt_info.raw(); | 350 return deopt_info.raw(); |
| 356 } | 351 } |
| 357 | 352 |
| 358 } // namespace dart | 353 } // namespace dart |
| OLD | NEW |