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

Side by Side Diff: runtime/lib/integers.cc

Issue 23480005: Change Bool::Get to return a handle instead of a pointer to a raw object. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
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 "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/native_entry.h" 10 #include "vm/native_entry.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 DEFINE_NATIVE_ENTRY(Integer_greaterThanFromInteger, 2) { 159 DEFINE_NATIVE_ENTRY(Integer_greaterThanFromInteger, 2) {
160 const Integer& right = Integer::CheckedHandle(arguments->NativeArgAt(0)); 160 const Integer& right = Integer::CheckedHandle(arguments->NativeArgAt(0));
161 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1)); 161 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1));
162 ASSERT(CheckInteger(right)); 162 ASSERT(CheckInteger(right));
163 ASSERT(CheckInteger(left)); 163 ASSERT(CheckInteger(left));
164 if (FLAG_trace_intrinsified_natives) { 164 if (FLAG_trace_intrinsified_natives) {
165 OS::Print("Integer_greaterThanFromInteger %s > %s\n", 165 OS::Print("Integer_greaterThanFromInteger %s > %s\n",
166 left.ToCString(), right.ToCString()); 166 left.ToCString(), right.ToCString());
167 } 167 }
168 return Bool::Get(left.CompareWith(right) == 1); 168 return Bool::Get(left.CompareWith(right) == 1).raw();
169 } 169 }
170 170
171 171
172 DEFINE_NATIVE_ENTRY(Integer_equalToInteger, 2) { 172 DEFINE_NATIVE_ENTRY(Integer_equalToInteger, 2) {
173 const Integer& left = Integer::CheckedHandle(arguments->NativeArgAt(0)); 173 const Integer& left = Integer::CheckedHandle(arguments->NativeArgAt(0));
174 GET_NON_NULL_NATIVE_ARGUMENT(Integer, right, arguments->NativeArgAt(1)); 174 GET_NON_NULL_NATIVE_ARGUMENT(Integer, right, arguments->NativeArgAt(1));
175 ASSERT(CheckInteger(left)); 175 ASSERT(CheckInteger(left));
176 ASSERT(CheckInteger(right)); 176 ASSERT(CheckInteger(right));
177 if (FLAG_trace_intrinsified_natives) { 177 if (FLAG_trace_intrinsified_natives) {
178 OS::Print("Integer_equalToInteger %s == %s\n", 178 OS::Print("Integer_equalToInteger %s == %s\n",
179 left.ToCString(), right.ToCString()); 179 left.ToCString(), right.ToCString());
180 } 180 }
181 return Bool::Get(left.CompareWith(right) == 0); 181 return Bool::Get(left.CompareWith(right) == 0).raw();
182 } 182 }
183 183
184 184
185 DEFINE_NATIVE_ENTRY(Integer_parse, 1) { 185 DEFINE_NATIVE_ENTRY(Integer_parse, 1) {
186 GET_NON_NULL_NATIVE_ARGUMENT(String, value, arguments->NativeArgAt(0)); 186 GET_NON_NULL_NATIVE_ARGUMENT(String, value, arguments->NativeArgAt(0));
187 if (value.IsOneByteString()) { 187 if (value.IsOneByteString()) {
188 // Quick conversion for unpadded integers in strings. 188 // Quick conversion for unpadded integers in strings.
189 const intptr_t len = value.Length(); 189 const intptr_t len = value.Length();
190 if (len > 0) { 190 if (len > 0) {
191 const char* cstr = value.ToCString(); 191 const char* cstr = value.ToCString();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 // Use the preallocated out of memory exception to avoid calling 369 // Use the preallocated out of memory exception to avoid calling
370 // into dart code or allocating any code. 370 // into dart code or allocating any code.
371 const Instance& exception = 371 const Instance& exception =
372 Instance::Handle(isolate->object_store()->out_of_memory()); 372 Instance::Handle(isolate->object_store()->out_of_memory());
373 Exceptions::Throw(exception); 373 Exceptions::Throw(exception);
374 UNREACHABLE(); 374 UNREACHABLE();
375 return 0; 375 return 0;
376 } 376 }
377 377
378 } // namespace dart 378 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/identical.cc ('k') | runtime/lib/mirrors.cc » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698