Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1358)

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 10915015: Make fewer assumptions about the layout of api handles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl.h ('k') | runtime/vm/dart_api_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ApiState* state = isolate->api_state(); 123 ApiState* state = isolate->api_state();
124 ASSERT(state != NULL); 124 ASSERT(state != NULL);
125 ASSERT(state->IsValidLocalHandle(object) || 125 ASSERT(state->IsValidLocalHandle(object) ||
126 state->IsValidPersistentHandle(object) || 126 state->IsValidPersistentHandle(object) ||
127 state->IsValidWeakPersistentHandle(object) || 127 state->IsValidWeakPersistentHandle(object) ||
128 state->IsValidPrologueWeakPersistentHandle(object)); 128 state->IsValidPrologueWeakPersistentHandle(object));
129 ASSERT(FinalizablePersistentHandle::raw_offset() == 0 && 129 ASSERT(FinalizablePersistentHandle::raw_offset() == 0 &&
130 PersistentHandle::raw_offset() == 0 && 130 PersistentHandle::raw_offset() == 0 &&
131 LocalHandle::raw_offset() == 0); 131 LocalHandle::raw_offset() == 0);
132 #endif 132 #endif
133 return *(reinterpret_cast<RawObject**>(object)); 133 return (reinterpret_cast<LocalHandle*>(object))->raw();
134 } 134 }
135 135
136 #define DEFINE_UNWRAP(type) \ 136 #define DEFINE_UNWRAP(type) \
137 const type& Api::Unwrap##type##Handle(Isolate* iso, \ 137 const type& Api::Unwrap##type##Handle(Isolate* iso, \
138 Dart_Handle dart_handle) { \ 138 Dart_Handle dart_handle) { \
139 const Object& obj = Object::Handle(iso, Api::UnwrapHandle(dart_handle)); \ 139 const Object& obj = Object::Handle(iso, Api::UnwrapHandle(dart_handle)); \
140 if (obj.Is##type()) { \ 140 if (obj.Is##type()) { \
141 return type::Cast(obj); \ 141 return type::Cast(obj); \
142 } \ 142 } \
143 return type::Handle(iso); \ 143 return type::Handle(iso); \
(...skipping 4042 matching lines...) Expand 10 before | Expand all | Expand 10 after
4186 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) { 4186 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) {
4187 Dart::set_perf_events_writer(function); 4187 Dart::set_perf_events_writer(function);
4188 } 4188 }
4189 4189
4190 4190
4191 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) { 4191 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) {
4192 Dart::set_flow_graph_writer(function); 4192 Dart::set_flow_graph_writer(function);
4193 } 4193 }
4194 4194
4195 } // namespace dart 4195 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.h ('k') | runtime/vm/dart_api_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698