| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 "Trace disabling optimized code."); | 48 "Trace disabling optimized code."); |
| 49 DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000, | 49 DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000, |
| 50 "Huge method cutoff in tokens: Disables optimizations for huge methods."); | 50 "Huge method cutoff in tokens: Disables optimizations for huge methods."); |
| 51 DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000, | 51 DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000, |
| 52 "Huge method cutoff in unoptimized code size (in bytes)."); | 52 "Huge method cutoff in unoptimized code size (in bytes)."); |
| 53 DEFINE_FLAG(bool, throw_on_javascript_int_overflow, false, | 53 DEFINE_FLAG(bool, throw_on_javascript_int_overflow, false, |
| 54 "Throw an exception when integer arithmetic exceeds 53 bits."); | 54 "Throw an exception when integer arithmetic exceeds 53 bits."); |
| 55 DECLARE_FLAG(bool, trace_compiler); | 55 DECLARE_FLAG(bool, trace_compiler); |
| 56 DECLARE_FLAG(bool, eliminate_type_checks); | 56 DECLARE_FLAG(bool, eliminate_type_checks); |
| 57 DECLARE_FLAG(bool, enable_type_checks); | 57 DECLARE_FLAG(bool, enable_type_checks); |
| 58 DECLARE_FLAG(int, deoptimization_counter_threshold); | |
| 59 | 58 |
| 60 static const char* kGetterPrefix = "get:"; | 59 static const char* kGetterPrefix = "get:"; |
| 61 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); | 60 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); |
| 62 static const char* kSetterPrefix = "set:"; | 61 static const char* kSetterPrefix = "set:"; |
| 63 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); | 62 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); |
| 64 | 63 |
| 65 cpp_vtable Object::handle_vtable_ = 0; | 64 cpp_vtable Object::handle_vtable_ = 0; |
| 66 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; | 65 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; |
| 67 cpp_vtable Smi::handle_vtable_ = 0; | 66 cpp_vtable Smi::handle_vtable_ = 0; |
| 68 | 67 |
| (...skipping 3370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3439 SetCode(Code::Handle(unoptimized_code())); | 3438 SetCode(Code::Handle(unoptimized_code())); |
| 3440 CodePatcher::RestoreEntry(Code::Handle(unoptimized_code())); | 3439 CodePatcher::RestoreEntry(Code::Handle(unoptimized_code())); |
| 3441 } | 3440 } |
| 3442 | 3441 |
| 3443 | 3442 |
| 3444 void Function::set_unoptimized_code(const Code& value) const { | 3443 void Function::set_unoptimized_code(const Code& value) const { |
| 3445 StorePointer(&raw_ptr()->unoptimized_code_, value.raw()); | 3444 StorePointer(&raw_ptr()->unoptimized_code_, value.raw()); |
| 3446 } | 3445 } |
| 3447 | 3446 |
| 3448 | 3447 |
| 3449 void Function::set_deopt_history(const Array& value) const { | |
| 3450 StorePointer(&raw_ptr()->deopt_history_, value.raw()); | |
| 3451 } | |
| 3452 | |
| 3453 | |
| 3454 void Function::EnsureDeoptHistory() const { | |
| 3455 Array& array = Array::Handle(deopt_history()); | |
| 3456 if (array.IsNull()) { | |
| 3457 array = Array::New(FLAG_deoptimization_counter_threshold); | |
| 3458 set_deopt_history(array); | |
| 3459 } | |
| 3460 } | |
| 3461 | |
| 3462 | |
| 3463 RawContextScope* Function::context_scope() const { | 3448 RawContextScope* Function::context_scope() const { |
| 3464 if (IsClosureFunction()) { | 3449 if (IsClosureFunction()) { |
| 3465 const Object& obj = Object::Handle(raw_ptr()->data_); | 3450 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 3466 ASSERT(!obj.IsNull()); | 3451 ASSERT(!obj.IsNull()); |
| 3467 return ClosureData::Cast(obj).context_scope(); | 3452 return ClosureData::Cast(obj).context_scope(); |
| 3468 } | 3453 } |
| 3469 return ContextScope::null(); | 3454 return ContextScope::null(); |
| 3470 } | 3455 } |
| 3471 | 3456 |
| 3472 | 3457 |
| (...skipping 10073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13546 space); | 13531 space); |
| 13547 return reinterpret_cast<RawWeakProperty*>(raw); | 13532 return reinterpret_cast<RawWeakProperty*>(raw); |
| 13548 } | 13533 } |
| 13549 | 13534 |
| 13550 | 13535 |
| 13551 const char* WeakProperty::ToCString() const { | 13536 const char* WeakProperty::ToCString() const { |
| 13552 return "_WeakProperty"; | 13537 return "_WeakProperty"; |
| 13553 } | 13538 } |
| 13554 | 13539 |
| 13555 } // namespace dart | 13540 } // namespace dart |
| OLD | NEW |