Chromium Code Reviews| 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/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/become.h" | 10 #include "vm/become.h" |
| (...skipping 12540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12551 } | 12551 } |
| 12552 | 12552 |
| 12553 | 12553 |
| 12554 void ICData::AddDeoptReason(DeoptReasonId reason) const { | 12554 void ICData::AddDeoptReason(DeoptReasonId reason) const { |
| 12555 if (reason <= kLastRecordedDeoptReason) { | 12555 if (reason <= kLastRecordedDeoptReason) { |
| 12556 SetDeoptReasons(DeoptReasons() | (1 << reason)); | 12556 SetDeoptReasons(DeoptReasons() | (1 << reason)); |
| 12557 } | 12557 } |
| 12558 } | 12558 } |
| 12559 | 12559 |
| 12560 | 12560 |
| 12561 void ICData::SetIsStaticCall(bool static_call) const { | |
| 12562 StoreNonPointer(&raw_ptr()->state_bits_, | |
| 12563 StaticCallBit::update(static_call, raw_ptr()->state_bits_)); | |
| 12564 } | |
| 12565 | |
| 12566 | |
| 12567 bool ICData::is_static_call() const { | |
| 12568 return StaticCallBit::decode(raw_ptr()->state_bits_); | |
| 12569 } | |
| 12570 | |
| 12571 | |
| 12561 void ICData::set_state_bits(uint32_t bits) const { | 12572 void ICData::set_state_bits(uint32_t bits) const { |
| 12562 StoreNonPointer(&raw_ptr()->state_bits_, bits); | 12573 StoreNonPointer(&raw_ptr()->state_bits_, bits); |
| 12563 } | 12574 } |
| 12564 | 12575 |
| 12565 | 12576 |
| 12566 intptr_t ICData::TestEntryLengthFor(intptr_t num_args) { | 12577 intptr_t ICData::TestEntryLengthFor(intptr_t num_args) { |
| 12567 return num_args + 1 /* target function*/ + 1 /* frequency */; | 12578 return num_args + 1 /* target function*/ + 1 /* frequency */; |
| 12568 } | 12579 } |
| 12569 | 12580 |
| 12570 | 12581 |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13430 result.set_tag(-1); | 13441 result.set_tag(-1); |
| 13431 #endif | 13442 #endif |
| 13432 return result.raw(); | 13443 return result.raw(); |
| 13433 } | 13444 } |
| 13434 | 13445 |
| 13435 | 13446 |
| 13436 RawICData* ICData::New(const Function& owner, | 13447 RawICData* ICData::New(const Function& owner, |
| 13437 const String& target_name, | 13448 const String& target_name, |
| 13438 const Array& arguments_descriptor, | 13449 const Array& arguments_descriptor, |
| 13439 intptr_t deopt_id, | 13450 intptr_t deopt_id, |
| 13440 intptr_t num_args_tested) { | 13451 intptr_t num_args_tested) { |
|
rmacnak
2016/06/08 22:10:36
There are more places in flow_graph_inliner, jit_o
Cutch
2016/06/08 23:33:53
Done.
| |
| 13441 Zone* zone = Thread::Current()->zone(); | 13452 Zone* zone = Thread::Current()->zone(); |
| 13442 const ICData& result = ICData::Handle(zone, | 13453 const ICData& result = ICData::Handle(zone, |
| 13443 NewDescriptor(zone, | 13454 NewDescriptor(zone, |
| 13444 owner, | 13455 owner, |
| 13445 target_name, | 13456 target_name, |
| 13446 arguments_descriptor, | 13457 arguments_descriptor, |
| 13447 deopt_id, | 13458 deopt_id, |
| 13448 num_args_tested)); | 13459 num_args_tested)); |
| 13449 result.set_ic_data_array( | 13460 result.set_ic_data_array( |
| 13450 Array::Handle(zone, NewEmptyICDataArray(num_args_tested))); | 13461 Array::Handle(zone, NewEmptyICDataArray(num_args_tested))); |
| 13451 return result.raw(); | 13462 return result.raw(); |
| 13452 } | 13463 } |
| 13453 | 13464 |
| 13454 | 13465 |
| 13455 RawICData* ICData::NewFrom(const ICData& from, intptr_t num_args_tested) { | 13466 RawICData* ICData::NewFrom(const ICData& from, intptr_t num_args_tested) { |
| 13456 const ICData& result = ICData::Handle(ICData::New( | 13467 const ICData& result = ICData::Handle(ICData::New( |
| 13457 Function::Handle(from.Owner()), | 13468 Function::Handle(from.Owner()), |
| 13458 String::Handle(from.target_name()), | 13469 String::Handle(from.target_name()), |
| 13459 Array::Handle(from.arguments_descriptor()), | 13470 Array::Handle(from.arguments_descriptor()), |
| 13460 from.deopt_id(), | 13471 from.deopt_id(), |
| 13461 num_args_tested)); | 13472 num_args_tested)); |
| 13462 // Copy deoptimization reasons. | 13473 // Copy deoptimization reasons. |
| 13463 result.SetDeoptReasons(from.DeoptReasons()); | 13474 result.SetDeoptReasons(from.DeoptReasons()); |
| 13475 // Copy whether or not this is a static call. | |
| 13476 result.SetIsStaticCall(from.is_static_call()); | |
| 13464 return result.raw(); | 13477 return result.raw(); |
| 13465 } | 13478 } |
| 13466 | 13479 |
| 13467 | 13480 |
| 13468 RawICData* ICData::Clone(const ICData& from) { | 13481 RawICData* ICData::Clone(const ICData& from) { |
| 13469 Zone* zone = Thread::Current()->zone(); | 13482 Zone* zone = Thread::Current()->zone(); |
| 13470 const ICData& result = ICData::Handle(ICData::NewDescriptor( | 13483 const ICData& result = ICData::Handle(ICData::NewDescriptor( |
| 13471 zone, | 13484 zone, |
| 13472 Function::Handle(zone, from.Owner()), | 13485 Function::Handle(zone, from.Owner()), |
| 13473 String::Handle(zone, from.target_name()), | 13486 String::Handle(zone, from.target_name()), |
| 13474 Array::Handle(zone, from.arguments_descriptor()), | 13487 Array::Handle(zone, from.arguments_descriptor()), |
| 13475 from.deopt_id(), | 13488 from.deopt_id(), |
| 13476 from.NumArgsTested())); | 13489 from.NumArgsTested())); |
| 13477 // Clone entry array. | 13490 // Clone entry array. |
| 13478 const Array& from_array = Array::Handle(zone, from.ic_data()); | 13491 const Array& from_array = Array::Handle(zone, from.ic_data()); |
| 13479 const intptr_t len = from_array.Length(); | 13492 const intptr_t len = from_array.Length(); |
| 13480 const Array& cloned_array = | 13493 const Array& cloned_array = |
| 13481 Array::Handle(zone, Array::New(len, Heap::kOld)); | 13494 Array::Handle(zone, Array::New(len, Heap::kOld)); |
| 13482 Object& obj = Object::Handle(zone); | 13495 Object& obj = Object::Handle(zone); |
| 13483 for (intptr_t i = 0; i < len; i++) { | 13496 for (intptr_t i = 0; i < len; i++) { |
| 13484 obj = from_array.At(i); | 13497 obj = from_array.At(i); |
| 13485 cloned_array.SetAt(i, obj); | 13498 cloned_array.SetAt(i, obj); |
| 13486 } | 13499 } |
| 13500 result.SetIsStaticCall(from.is_static_call()); | |
| 13487 result.set_ic_data_array(cloned_array); | 13501 result.set_ic_data_array(cloned_array); |
| 13488 // Copy deoptimization reasons. | 13502 // Copy deoptimization reasons. |
| 13489 result.SetDeoptReasons(from.DeoptReasons()); | 13503 result.SetDeoptReasons(from.DeoptReasons()); |
| 13490 return result.raw(); | 13504 return result.raw(); |
| 13491 } | 13505 } |
| 13492 | 13506 |
| 13493 | 13507 |
| 13494 static Token::Kind RecognizeArithmeticOp(const String& name) { | 13508 static Token::Kind RecognizeArithmeticOp(const String& name) { |
| 13495 ASSERT(name.IsSymbol()); | 13509 ASSERT(name.IsSymbol()); |
| 13496 if (name.raw() == Symbols::Plus().raw()) { | 13510 if (name.raw() == Symbols::Plus().raw()) { |
| (...skipping 9140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 22637 return UserTag::null(); | 22651 return UserTag::null(); |
| 22638 } | 22652 } |
| 22639 | 22653 |
| 22640 | 22654 |
| 22641 const char* UserTag::ToCString() const { | 22655 const char* UserTag::ToCString() const { |
| 22642 const String& tag_label = String::Handle(label()); | 22656 const String& tag_label = String::Handle(label()); |
| 22643 return tag_label.ToCString(); | 22657 return tag_label.ToCString(); |
| 22644 } | 22658 } |
| 22645 | 22659 |
| 22646 } // namespace dart | 22660 } // namespace dart |
| OLD | NEW |