| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 if (!instance.IsNull()) { | 1397 if (!instance.IsNull()) { |
| 1398 String& name = String::Handle(String::New("[]")); | 1398 String& name = String::Handle(String::New("[]")); |
| 1399 const Function& function = Function::Handle( | 1399 const Function& function = Function::Handle( |
| 1400 Resolver::ResolveDynamic(instance, name, 2, 0)); | 1400 Resolver::ResolveDynamic(instance, name, 2, 0)); |
| 1401 if (!function.IsNull()) { | 1401 if (!function.IsNull()) { |
| 1402 Object& element = Object::Handle(); | 1402 Object& element = Object::Handle(); |
| 1403 Integer& indexobj = Integer::Handle(); | 1403 Integer& indexobj = Integer::Handle(); |
| 1404 Dart_Handle result; | 1404 Dart_Handle result; |
| 1405 indexobj = Integer::New(index); | 1405 indexobj = Integer::New(index); |
| 1406 element = GetListAt(isolate, instance, indexobj, function, &result); | 1406 element = GetListAt(isolate, instance, indexobj, function, &result); |
| 1407 if (Dart_IsError(result)) { | 1407 if (::Dart_IsError(result)) { |
| 1408 return result; // Error condition. | 1408 return result; // Error condition. |
| 1409 } | 1409 } |
| 1410 return Api::NewLocalHandle(element); | 1410 return Api::NewLocalHandle(element); |
| 1411 } | 1411 } |
| 1412 } | 1412 } |
| 1413 return Api::Error("Object does not implement the 'List' interface"); | 1413 return Api::Error("Object does not implement the 'List' interface"); |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 | 1416 |
| 1417 static void SetListAt(Isolate* isolate, | 1417 static void SetListAt(Isolate* isolate, |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 String& name = String::Handle(String::New("[]")); | 1521 String& name = String::Handle(String::New("[]")); |
| 1522 const Function& function = Function::Handle( | 1522 const Function& function = Function::Handle( |
| 1523 Resolver::ResolveDynamic(instance, name, 2, 0)); | 1523 Resolver::ResolveDynamic(instance, name, 2, 0)); |
| 1524 if (!function.IsNull()) { | 1524 if (!function.IsNull()) { |
| 1525 Object& element = Object::Handle(); | 1525 Object& element = Object::Handle(); |
| 1526 Integer& intobj = Integer::Handle(); | 1526 Integer& intobj = Integer::Handle(); |
| 1527 Dart_Handle result; | 1527 Dart_Handle result; |
| 1528 for (int i = 0; i < length; i++) { | 1528 for (int i = 0; i < length; i++) { |
| 1529 intobj = Integer::New(offset + i); | 1529 intobj = Integer::New(offset + i); |
| 1530 element = GetListAt(isolate, instance, intobj, function, &result); | 1530 element = GetListAt(isolate, instance, intobj, function, &result); |
| 1531 if (Dart_IsError(result)) { | 1531 if (::Dart_IsError(result)) { |
| 1532 return result; // Error condition. | 1532 return result; // Error condition. |
| 1533 } | 1533 } |
| 1534 if (!element.IsInteger()) { | 1534 if (!element.IsInteger()) { |
| 1535 return Api::Error("%s expects the argument 'list' to be " | 1535 return Api::Error("%s expects the argument 'list' to be " |
| 1536 "a List of int", CURRENT_FUNC); | 1536 "a List of int", CURRENT_FUNC); |
| 1537 } | 1537 } |
| 1538 intobj ^= element.raw(); | 1538 intobj ^= element.raw(); |
| 1539 ASSERT(intobj.AsInt64Value() <= 0xff); | 1539 ASSERT(intobj.AsInt64Value() <= 0xff); |
| 1540 // TODO(hpayer): value should always be smaller then 0xff. Add error | 1540 // TODO(hpayer): value should always be smaller then 0xff. Add error |
| 1541 // handling. | 1541 // handling. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 const Function& function = Function::Handle( | 1579 const Function& function = Function::Handle( |
| 1580 Resolver::ResolveDynamic(instance, name, 3, 0)); | 1580 Resolver::ResolveDynamic(instance, name, 3, 0)); |
| 1581 if (!function.IsNull()) { | 1581 if (!function.IsNull()) { |
| 1582 Integer& indexobj = Integer::Handle(); | 1582 Integer& indexobj = Integer::Handle(); |
| 1583 Integer& valueobj = Integer::Handle(); | 1583 Integer& valueobj = Integer::Handle(); |
| 1584 Dart_Handle result; | 1584 Dart_Handle result; |
| 1585 for (int i = 0; i < length; i++) { | 1585 for (int i = 0; i < length; i++) { |
| 1586 indexobj = Integer::New(offset + i); | 1586 indexobj = Integer::New(offset + i); |
| 1587 valueobj = Integer::New(native_array[i]); | 1587 valueobj = Integer::New(native_array[i]); |
| 1588 SetListAt(isolate, instance, indexobj, valueobj, function, &result); | 1588 SetListAt(isolate, instance, indexobj, valueobj, function, &result); |
| 1589 if (Dart_IsError(result)) { | 1589 if (::Dart_IsError(result)) { |
| 1590 return result; // Error condition. | 1590 return result; // Error condition. |
| 1591 } | 1591 } |
| 1592 } | 1592 } |
| 1593 return Api::Success(); | 1593 return Api::Success(); |
| 1594 } | 1594 } |
| 1595 } | 1595 } |
| 1596 return Api::Error("Object does not implement the 'List' interface"); | 1596 return Api::Error("Object does not implement the 'List' interface"); |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 | 1599 |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 } | 2372 } |
| 2373 delete debug_region; | 2373 delete debug_region; |
| 2374 } else { | 2374 } else { |
| 2375 *buffer = NULL; | 2375 *buffer = NULL; |
| 2376 *buffer_size = 0; | 2376 *buffer_size = 0; |
| 2377 } | 2377 } |
| 2378 } | 2378 } |
| 2379 | 2379 |
| 2380 | 2380 |
| 2381 } // namespace dart | 2381 } // namespace dart |
| OLD | NEW |