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

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

Issue 2962543002: Revert "VM: Reland Inline instance object hash code into object header on 64bit." (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « pkg/front_end/testcases/shaker/empty_program.dart.shaker ('k') | runtime/lib/object_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
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 // Please note that no handle is created for the argument. 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. 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. 44 // The performance benefit is more than 5% when using hashCode.
45 #if defined(HASH_IN_OBJECT_HEADER)
46 return Smi::New(Object::GetCachedHash(arguments->NativeArgAt(0)));
47 #else
48 Heap* heap = isolate->heap(); 45 Heap* heap = isolate->heap();
49 ASSERT(arguments->NativeArgAt(0)->IsDartInstance()); 46 ASSERT(arguments->NativeArgAt(0)->IsDartInstance());
50 return Smi::New(heap->GetHash(arguments->NativeArgAt(0))); 47 return Smi::New(heap->GetHash(arguments->NativeArgAt(0)));
51 #endif
52 } 48 }
53 49
54 50
55 DEFINE_NATIVE_ENTRY(Object_setHash, 2) { 51 DEFINE_NATIVE_ENTRY(Object_setHash, 2) {
52 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
56 GET_NON_NULL_NATIVE_ARGUMENT(Smi, hash, arguments->NativeArgAt(1)); 53 GET_NON_NULL_NATIVE_ARGUMENT(Smi, hash, arguments->NativeArgAt(1));
57 #if defined(HASH_IN_OBJECT_HEADER)
58 Object::SetCachedHash(arguments->NativeArgAt(0), hash.Value());
59 #else
60 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
61 Heap* heap = isolate->heap(); 54 Heap* heap = isolate->heap();
62 heap->SetHash(instance.raw(), hash.Value()); 55 heap->SetHash(instance.raw(), hash.Value());
63 #endif
64 return Object::null(); 56 return Object::null();
65 } 57 }
66 58
67 59
68 DEFINE_NATIVE_ENTRY(Object_toString, 1) { 60 DEFINE_NATIVE_ENTRY(Object_toString, 1) {
69 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); 61 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
70 if (instance.IsString()) { 62 if (instance.IsString()) {
71 return instance.raw(); 63 return instance.raw();
72 } 64 }
73 const char* c_str = instance.ToCString(); 65 const char* c_str = instance.ToCString();
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 for (intptr_t i = split; i < len; i++) { 385 for (intptr_t i = split; i < len; i++) {
394 type = function_type_arguments.IsNull() 386 type = function_type_arguments.IsNull()
395 ? Type::DynamicType() 387 ? Type::DynamicType()
396 : function_type_arguments.TypeAt(i - split); 388 : function_type_arguments.TypeAt(i - split);
397 result.SetTypeAt(i, type); 389 result.SetTypeAt(i, type);
398 } 390 }
399 return result.Canonicalize(); 391 return result.Canonicalize();
400 } 392 }
401 393
402 } // namespace dart 394 } // namespace dart
OLDNEW
« no previous file with comments | « pkg/front_end/testcases/shaker/empty_program.dart.shaker ('k') | runtime/lib/object_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698