| 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 7032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7043 // This code is used only during iterating frames during a GC and hence | 7043 // This code is used only during iterating frames during a GC and hence |
| 7044 // it should not in turn start a GC. | 7044 // it should not in turn start a GC. |
| 7045 NoGCScope no_gc; | 7045 NoGCScope no_gc; |
| 7046 if (stackmaps() == Array::null()) { | 7046 if (stackmaps() == Array::null()) { |
| 7047 // No stack maps are present in the code object which means this | 7047 // No stack maps are present in the code object which means this |
| 7048 // frame relies on tagged pointers. | 7048 // frame relies on tagged pointers. |
| 7049 return Stackmap::null(); | 7049 return Stackmap::null(); |
| 7050 } | 7050 } |
| 7051 // A stack map is present in the code object, use the stack map to visit | 7051 // A stack map is present in the code object, use the stack map to visit |
| 7052 // frame slots which are marked as having objects. | 7052 // frame slots which are marked as having objects. |
| 7053 RawStackmap* previous_map = Stackmap::null(); | |
| 7054 *maps = stackmaps(); | 7053 *maps = stackmaps(); |
| 7055 *map = Stackmap::null(); | 7054 *map = Stackmap::null(); |
| 7056 for (intptr_t i = 0; i < maps->Length(); i++) { | 7055 for (intptr_t i = 0; i < maps->Length(); i++) { |
| 7057 *map ^= maps->At(i); | 7056 *map ^= maps->At(i); |
| 7058 ASSERT(!map->IsNull()); | 7057 ASSERT(!map->IsNull()); |
| 7059 if (map->PC() == pc) { | 7058 if (map->PC() == pc) { |
| 7060 break; // We found a stack map for this frame. | 7059 return map->raw(); // We found a stack map for this frame. |
| 7061 } | 7060 } |
| 7062 if (map->PC() > pc) { | |
| 7063 // We have not found a stackmap corresponding to the PC of this frame, | |
| 7064 // we will use the closest previous stack map. | |
| 7065 *map = previous_map; | |
| 7066 break; | |
| 7067 } | |
| 7068 previous_map = map->raw(); | |
| 7069 } | 7061 } |
| 7070 return map->raw(); | 7062 // If the code has stackmaps, it must have them for all safepoints. |
| 7063 UNREACHABLE(); |
| 7064 return Stackmap::null(); |
| 7071 } | 7065 } |
| 7072 | 7066 |
| 7073 | 7067 |
| 7074 RawContext* Context::New(intptr_t num_variables, Heap::Space space) { | 7068 RawContext* Context::New(intptr_t num_variables, Heap::Space space) { |
| 7075 ASSERT(num_variables >= 0); | 7069 ASSERT(num_variables >= 0); |
| 7076 ASSERT(Object::context_class() != Class::null()); | 7070 ASSERT(Object::context_class() != Class::null()); |
| 7077 | 7071 |
| 7078 Context& result = Context::Handle(); | 7072 Context& result = Context::Handle(); |
| 7079 { | 7073 { |
| 7080 RawObject* raw = Object::Allocate(Context::kInstanceKind, | 7074 RawObject* raw = Object::Allocate(Context::kInstanceKind, |
| (...skipping 3703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10784 const String& str = String::Handle(pattern()); | 10778 const String& str = String::Handle(pattern()); |
| 10785 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10779 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10786 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10780 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10787 char* chars = reinterpret_cast<char*>( | 10781 char* chars = reinterpret_cast<char*>( |
| 10788 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10782 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10789 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10783 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10790 return chars; | 10784 return chars; |
| 10791 } | 10785 } |
| 10792 | 10786 |
| 10793 } // namespace dart | 10787 } // namespace dart |
| OLD | NEW |