Chromium Code Reviews| 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 "vm/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
| 10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 | 32 |
| 33 | 33 |
| 34 DEFINE_NATIVE_ENTRY(Object_equals, 1) { | 34 DEFINE_NATIVE_ENTRY(Object_equals, 1) { |
| 35 // Implemented in the flow graph builder. | 35 // Implemented in the flow graph builder. |
| 36 UNREACHABLE(); | 36 UNREACHABLE(); |
| 37 return Object::null(); | 37 return Object::null(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 | 40 |
| 41 DEFINE_NATIVE_ENTRY(Object_getHash, 1) { | 41 DEFINE_NATIVE_ENTRY(Object_getHash, 1) { |
| 42 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); | 42 // Please note that no handle is created for the argument. |
| 43 // This is safe since the argument is only used in a tail call. | |
| 44 // The performance benefit is more than 5% when using hashCode. | |
|
siva
2016/07/08 22:12:10
Maybe add:
ASSERT(arguments->NativeArgAt(0)->IsDa
bakster
2016/07/08 22:15:11
Done.
| |
| 43 Heap* heap = isolate->heap(); | 45 Heap* heap = isolate->heap(); |
| 44 return Smi::New(heap->GetHash(instance.raw())); | 46 return Smi::New(heap->GetHash(arguments->NativeArgAt(0))); |
| 45 } | 47 } |
| 46 | 48 |
| 47 | 49 |
| 48 DEFINE_NATIVE_ENTRY(Object_setHash, 2) { | 50 DEFINE_NATIVE_ENTRY(Object_setHash, 2) { |
| 49 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); | 51 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
| 50 GET_NON_NULL_NATIVE_ARGUMENT(Smi, hash, arguments->NativeArgAt(1)); | 52 GET_NON_NULL_NATIVE_ARGUMENT(Smi, hash, arguments->NativeArgAt(1)); |
| 51 Heap* heap = isolate->heap(); | 53 Heap* heap = isolate->heap(); |
| 52 heap->SetHash(instance.raw(), hash.Value()); | 54 heap->SetHash(instance.raw(), hash.Value()); |
| 53 return Object::null(); | 55 return Object::null(); |
| 54 } | 56 } |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 | 331 |
| 330 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { | 332 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { |
| 331 #if defined(ARCH_IS_64_BIT) | 333 #if defined(ARCH_IS_64_BIT) |
| 332 return Bool::True().raw(); | 334 return Bool::True().raw(); |
| 333 #else | 335 #else |
| 334 return Bool::False().raw(); | 336 return Bool::False().raw(); |
| 335 #endif // defined(ARCH_IS_64_BIT) | 337 #endif // defined(ARCH_IS_64_BIT) |
| 336 } | 338 } |
| 337 | 339 |
| 338 } // namespace dart | 340 } // namespace dart |
| OLD | NEW |