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/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 GET_NON_NULL_NATIVE_ARGUMENT(String, value, arguments->NativeArgAt(0)); | 230 GET_NON_NULL_NATIVE_ARGUMENT(String, value, arguments->NativeArgAt(0)); |
231 return ParseInteger(value); | 231 return ParseInteger(value); |
232 } | 232 } |
233 | 233 |
234 | 234 |
235 DEFINE_NATIVE_ENTRY(Integer_fromEnvironment, 3) { | 235 DEFINE_NATIVE_ENTRY(Integer_fromEnvironment, 3) { |
236 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(1)); | 236 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(1)); |
237 GET_NATIVE_ARGUMENT(Integer, default_value, arguments->NativeArgAt(2)); | 237 GET_NATIVE_ARGUMENT(Integer, default_value, arguments->NativeArgAt(2)); |
238 // Call the embedder to supply us with the environment. | 238 // Call the embedder to supply us with the environment. |
239 const String& env_value = | 239 const String& env_value = |
240 String::Handle(Api::CallEnvironmentCallback(isolate, name)); | 240 String::Handle(Api::CallEnvironmentCallback(thread, name)); |
241 if (!env_value.IsNull()) { | 241 if (!env_value.IsNull()) { |
242 const Integer& result = Integer::Handle(ParseInteger(env_value)); | 242 const Integer& result = Integer::Handle(ParseInteger(env_value)); |
243 if (!result.IsNull()) { | 243 if (!result.IsNull()) { |
244 if (result.IsSmi()) { | 244 if (result.IsSmi()) { |
245 return result.raw(); | 245 return result.raw(); |
246 } | 246 } |
247 return result.CheckAndCanonicalize(NULL); | 247 return result.CheckAndCanonicalize(NULL); |
248 } | 248 } |
249 } | 249 } |
250 return default_value.raw(); | 250 return default_value.raw(); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { | 426 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { |
427 // First arg is null type arguments, since class Bigint is not parameterized. | 427 // First arg is null type arguments, since class Bigint is not parameterized. |
428 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); | 428 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); |
429 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); | 429 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); |
430 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); | 430 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); |
431 ASSERT(!digits.IsNull()); | 431 ASSERT(!digits.IsNull()); |
432 return Bigint::New(neg.value(), used.Value(), digits); | 432 return Bigint::New(neg.value(), used.Value(), digits); |
433 } | 433 } |
434 | 434 |
435 } // namespace dart | 435 } // namespace dart |
OLD | NEW |