| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "vm/kernel_to_il.h" | 7 #include "vm/kernel_to_il.h" |
| 8 | 8 |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/intermediate_language.h" | 10 #include "vm/intermediate_language.h" |
| 11 #include "vm/kernel_binary_flowgraph.h" | 11 #include "vm/kernel_binary_flowgraph.h" |
| 12 #include "vm/kernel_reader.h" | 12 #include "vm/kernel_reader.h" |
| 13 #include "vm/longjump.h" | 13 #include "vm/longjump.h" |
| 14 #include "vm/method_recognizer.h" | 14 #include "vm/method_recognizer.h" |
| 15 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
| 16 #include "vm/report.h" | 16 #include "vm/report.h" |
| 17 #include "vm/resolver.h" | 17 #include "vm/resolver.h" |
| 18 #include "vm/stack_frame.h" | 18 #include "vm/stack_frame.h" |
| 19 | 19 |
| 20 #if !defined(DART_PRECOMPILED_RUNTIME) | 20 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 21 namespace dart { | 21 namespace dart { |
| 22 | 22 |
| 23 DECLARE_FLAG(bool, support_externalizable_strings); | |
| 24 | |
| 25 namespace kernel { | 23 namespace kernel { |
| 26 | 24 |
| 27 #define Z (zone_) | 25 #define Z (zone_) |
| 28 #define H (translation_helper_) | 26 #define H (translation_helper_) |
| 29 #define T (type_translator_) | 27 #define T (type_translator_) |
| 30 #define I Isolate::Current() | 28 #define I Isolate::Current() |
| 31 | 29 |
| 32 Fragment& Fragment::operator+=(const Fragment& other) { | 30 Fragment& Fragment::operator+=(const Fragment& other) { |
| 33 if (entry == NULL) { | 31 if (entry == NULL) { |
| 34 entry = other.entry; | 32 entry = other.entry; |
| (...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 Fragment body; | 1668 Fragment body; |
| 1671 MethodRecognizer::Kind kind = MethodRecognizer::RecognizeKind(function); | 1669 MethodRecognizer::Kind kind = MethodRecognizer::RecognizeKind(function); |
| 1672 switch (kind) { | 1670 switch (kind) { |
| 1673 case MethodRecognizer::kObjectEquals: | 1671 case MethodRecognizer::kObjectEquals: |
| 1674 body += LoadLocal(scopes_->this_variable); | 1672 body += LoadLocal(scopes_->this_variable); |
| 1675 body += LoadLocal(LookupVariable(first_positional_offset)); | 1673 body += LoadLocal(LookupVariable(first_positional_offset)); |
| 1676 body += StrictCompare(Token::kEQ_STRICT); | 1674 body += StrictCompare(Token::kEQ_STRICT); |
| 1677 break; | 1675 break; |
| 1678 case MethodRecognizer::kStringBaseLength: | 1676 case MethodRecognizer::kStringBaseLength: |
| 1679 case MethodRecognizer::kStringBaseIsEmpty: | 1677 case MethodRecognizer::kStringBaseIsEmpty: |
| 1680 // Depending on FLAG_support_externalizable_strings, treat string length | |
| 1681 // loads as mutable so that the class check that precedes them will not be | |
| 1682 // hoisted. This is unsafe because string externalization can change the | |
| 1683 // class. | |
| 1684 body += LoadLocal(scopes_->this_variable); | 1678 body += LoadLocal(scopes_->this_variable); |
| 1685 body += LoadNativeField(MethodRecognizer::kStringBaseLength, | 1679 body += LoadNativeField(MethodRecognizer::kStringBaseLength, |
| 1686 dart::String::length_offset(), | 1680 dart::String::length_offset(), |
| 1687 Type::ZoneHandle(Z, Type::SmiType()), kSmiCid, | 1681 Type::ZoneHandle(Z, Type::SmiType()), kSmiCid, |
| 1688 !FLAG_support_externalizable_strings); | 1682 /* is_immutable = */ true); |
| 1689 if (kind == MethodRecognizer::kStringBaseIsEmpty) { | 1683 if (kind == MethodRecognizer::kStringBaseIsEmpty) { |
| 1690 body += IntConstant(0); | 1684 body += IntConstant(0); |
| 1691 body += StrictCompare(Token::kEQ_STRICT); | 1685 body += StrictCompare(Token::kEQ_STRICT); |
| 1692 } | 1686 } |
| 1693 break; | 1687 break; |
| 1694 case MethodRecognizer::kGrowableArrayLength: | 1688 case MethodRecognizer::kGrowableArrayLength: |
| 1695 body += LoadLocal(scopes_->this_variable); | 1689 body += LoadLocal(scopes_->this_variable); |
| 1696 body += LoadNativeField(kind, GrowableObjectArray::length_offset(), | 1690 body += LoadNativeField(kind, GrowableObjectArray::length_offset(), |
| 1697 Type::ZoneHandle(Z, Type::SmiType()), kSmiCid); | 1691 Type::ZoneHandle(Z, Type::SmiType()), kSmiCid); |
| 1698 break; | 1692 break; |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2415 array_object = AsSortedDuplicateFreeArray(&token_positions); | 2409 array_object = AsSortedDuplicateFreeArray(&token_positions); |
| 2416 script.set_debug_positions(array_object); | 2410 script.set_debug_positions(array_object); |
| 2417 array_object = AsSortedDuplicateFreeArray(&yield_positions); | 2411 array_object = AsSortedDuplicateFreeArray(&yield_positions); |
| 2418 script.set_yield_positions(array_object); | 2412 script.set_yield_positions(array_object); |
| 2419 } | 2413 } |
| 2420 | 2414 |
| 2421 } // namespace kernel | 2415 } // namespace kernel |
| 2422 } // namespace dart | 2416 } // namespace dart |
| 2423 | 2417 |
| 2424 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 2418 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |