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 "vm/compiler.h" | 7 #include "vm/compiler.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 25 matching lines...) Expand all Loading... |
36 ASSERT(!other.IsNull()); | 36 ASSERT(!other.IsNull()); |
37 if (receiver.raw() == other.raw()) return Bool::True().raw(); | 37 if (receiver.raw() == other.raw()) return Bool::True().raw(); |
38 if (other.IsClosure()) { | 38 if (other.IsClosure()) { |
39 const Function& func_a = Function::Handle(Closure::function(receiver)); | 39 const Function& func_a = Function::Handle(Closure::function(receiver)); |
40 const Function& func_b = Function::Handle(Closure::function(other)); | 40 const Function& func_b = Function::Handle(Closure::function(other)); |
41 if (func_a.raw() == func_b.raw()) { | 41 if (func_a.raw() == func_b.raw()) { |
42 ASSERT(!func_a.IsImplicitStaticClosureFunction()); | 42 ASSERT(!func_a.IsImplicitStaticClosureFunction()); |
43 if (func_a.IsImplicitInstanceClosureFunction()) { | 43 if (func_a.IsImplicitInstanceClosureFunction()) { |
44 const Context& context_a = Context::Handle(Closure::context(receiver)); | 44 const Context& context_a = Context::Handle(Closure::context(receiver)); |
45 const Context& context_b = Context::Handle(Closure::context(other)); | 45 const Context& context_b = Context::Handle(Closure::context(other)); |
46 const Instance& receiver_a = Instance::Handle(context_a.At(0)); | 46 const Object& receiver_a = Object::Handle(context_a.At(0)); |
47 const Instance& receiver_b = Instance::Handle(context_b.At(0)); | 47 const Object& receiver_b = Object::Handle(context_b.At(0)); |
48 if (receiver_a.raw() == receiver_b.raw()) return Bool::True().raw(); | 48 if (receiver_a.raw() == receiver_b.raw()) return Bool::True().raw(); |
49 } | 49 } |
50 } | 50 } |
51 } | 51 } |
52 return Bool::False().raw(); | 52 return Bool::False().raw(); |
53 } | 53 } |
54 | 54 |
55 | 55 |
56 DEFINE_NATIVE_ENTRY(FunctionImpl_hashCode, 1) { | 56 DEFINE_NATIVE_ENTRY(FunctionImpl_hashCode, 1) { |
57 const Instance& receiver = Instance::CheckedHandle( | 57 const Instance& receiver = Instance::CheckedHandle( |
(...skipping 10 matching lines...) Expand all Loading... |
68 result ^= result >> 11; | 68 result ^= result >> 11; |
69 result += result << 15; | 69 result += result << 15; |
70 result &= ((static_cast<intptr_t>(1) << String::kHashBits) - 1); | 70 result &= ((static_cast<intptr_t>(1) << String::kHashBits) - 1); |
71 return Smi::New(result); | 71 return Smi::New(result); |
72 } | 72 } |
73 UNREACHABLE(); | 73 UNREACHABLE(); |
74 return Object::null(); | 74 return Object::null(); |
75 } | 75 } |
76 | 76 |
77 } // namespace dart | 77 } // namespace dart |
OLD | NEW |