| 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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 3617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3628 | 3628 |
| 3629 | 3629 |
| 3630 void Function::SetCode(const Code& value) const { | 3630 void Function::SetCode(const Code& value) const { |
| 3631 StorePointer(&raw_ptr()->code_, value.raw()); | 3631 StorePointer(&raw_ptr()->code_, value.raw()); |
| 3632 ASSERT(Function::Handle(value.function()).IsNull() || | 3632 ASSERT(Function::Handle(value.function()).IsNull() || |
| 3633 (value.function() == this->raw())); | 3633 (value.function() == this->raw())); |
| 3634 value.set_function(*this); | 3634 value.set_function(*this); |
| 3635 } | 3635 } |
| 3636 | 3636 |
| 3637 | 3637 |
| 3638 void Function::SwitchToUnoptimizedCode() const { |
| 3639 ASSERT(HasOptimizedCode()); |
| 3640 // Patch entry of the optimized code. |
| 3641 CodePatcher::PatchEntry(Code::Handle(CurrentCode())); |
| 3642 // Use previously compiled unoptimized code. |
| 3643 SetCode(Code::Handle(unoptimized_code())); |
| 3644 CodePatcher::RestoreEntry(Code::Handle(unoptimized_code())); |
| 3645 } |
| 3646 |
| 3647 |
| 3638 void Function::set_unoptimized_code(const Code& value) const { | 3648 void Function::set_unoptimized_code(const Code& value) const { |
| 3639 StorePointer(&raw_ptr()->unoptimized_code_, value.raw()); | 3649 StorePointer(&raw_ptr()->unoptimized_code_, value.raw()); |
| 3640 } | 3650 } |
| 3641 | 3651 |
| 3642 | 3652 |
| 3643 void Function::set_context_scope(const ContextScope& value) const { | 3653 void Function::set_context_scope(const ContextScope& value) const { |
| 3644 StorePointer(&raw_ptr()->context_scope_, value.raw()); | 3654 StorePointer(&raw_ptr()->context_scope_, value.raw()); |
| 3645 } | 3655 } |
| 3646 | 3656 |
| 3647 | 3657 |
| (...skipping 7213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10861 const String& str = String::Handle(pattern()); | 10871 const String& str = String::Handle(pattern()); |
| 10862 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10872 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10863 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10873 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10864 char* chars = reinterpret_cast<char*>( | 10874 char* chars = reinterpret_cast<char*>( |
| 10865 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10875 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10866 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10876 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10867 return chars; | 10877 return chars; |
| 10868 } | 10878 } |
| 10869 | 10879 |
| 10870 } // namespace dart | 10880 } // namespace dart |
| OLD | NEW |