OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/code_generator.h" | 5 #include "vm/code_generator.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 while (frame != NULL) { | 1500 while (frame != NULL) { |
1501 optimized_code = frame->LookupDartCode(); | 1501 optimized_code = frame->LookupDartCode(); |
1502 if (optimized_code.is_optimized()) { | 1502 if (optimized_code.is_optimized()) { |
1503 DeoptimizeAt(optimized_code, frame->pc()); | 1503 DeoptimizeAt(optimized_code, frame->pc()); |
1504 } | 1504 } |
1505 frame = iterator.NextFrame(); | 1505 frame = iterator.NextFrame(); |
1506 } | 1506 } |
1507 } | 1507 } |
1508 | 1508 |
1509 | 1509 |
1510 // Returns true if the given array of cids contains the given cid. | |
1511 static bool ContainsCid(const GrowableArray<intptr_t>& cids, intptr_t cid) { | |
1512 for (intptr_t i = 0; i < cids.length(); i++) { | |
1513 if (cids[i] == cid) { | |
1514 return true; | |
1515 } | |
1516 } | |
1517 return false; | |
1518 } | |
1519 | |
1520 | |
1521 // Deoptimize optimized code on stack if its class is in the 'classes' array. | |
1522 void DeoptimizeIfOwner(const GrowableArray<intptr_t>& classes) { | |
1523 DartFrameIterator iterator; | |
1524 StackFrame* frame = iterator.NextFrame(); | |
1525 Code& optimized_code = Code::Handle(); | |
1526 while (frame != NULL) { | |
1527 optimized_code = frame->LookupDartCode(); | |
1528 if (optimized_code.is_optimized()) { | |
1529 const intptr_t owner_cid = Class::Handle(Function::Handle( | |
1530 optimized_code.function()).Owner()).id(); | |
1531 if (ContainsCid(classes, owner_cid)) { | |
1532 DeoptimizeAt(optimized_code, frame->pc()); | |
1533 } | |
1534 } | |
1535 frame = iterator.NextFrame(); | |
1536 } | |
1537 } | |
1538 | |
1539 | |
1540 static void CopySavedRegisters(uword saved_registers_address, | 1510 static void CopySavedRegisters(uword saved_registers_address, |
1541 fpu_register_t** fpu_registers, | 1511 fpu_register_t** fpu_registers, |
1542 intptr_t** cpu_registers) { | 1512 intptr_t** cpu_registers) { |
1543 ASSERT(sizeof(fpu_register_t) == kFpuRegisterSize); | 1513 ASSERT(sizeof(fpu_register_t) == kFpuRegisterSize); |
1544 fpu_register_t* fpu_registers_copy = | 1514 fpu_register_t* fpu_registers_copy = |
1545 new fpu_register_t[kNumberOfFpuRegisters]; | 1515 new fpu_register_t[kNumberOfFpuRegisters]; |
1546 ASSERT(fpu_registers_copy != NULL); | 1516 ASSERT(fpu_registers_copy != NULL); |
1547 for (intptr_t i = 0; i < kNumberOfFpuRegisters; i++) { | 1517 for (intptr_t i = 0; i < kNumberOfFpuRegisters; i++) { |
1548 fpu_registers_copy[i] = | 1518 fpu_registers_copy[i] = |
1549 *reinterpret_cast<fpu_register_t*>(saved_registers_address); | 1519 *reinterpret_cast<fpu_register_t*>(saved_registers_address); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 // of the given value. | 1674 // of the given value. |
1705 // Arg0: Field object; | 1675 // Arg0: Field object; |
1706 // Arg1: Value that is being stored. | 1676 // Arg1: Value that is being stored. |
1707 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1677 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
1708 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1678 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
1709 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1679 const Object& value = Object::Handle(arguments.ArgAt(1)); |
1710 field.UpdateGuardedCidAndLength(value); | 1680 field.UpdateGuardedCidAndLength(value); |
1711 } | 1681 } |
1712 | 1682 |
1713 } // namespace dart | 1683 } // namespace dart |
OLD | NEW |