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

Side by Side Diff: runtime/vm/simulator_dbc.cc

Issue 2953753002: Revert "Inline instance object hash code into object header on 64 bit." (Closed)
Patch Set: Created 3 years, 6 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 | « runtime/vm/simulator_arm64.cc ('k') | runtime/vm/snapshot.h » ('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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 <setjmp.h> // NOLINT 5 #include <setjmp.h> // NOLINT
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #if defined(TARGET_ARCH_DBC) 9 #if defined(TARGET_ARCH_DBC)
10 10
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 return true; 315 return true;
316 } 316 }
317 317
318 static RawObject* AllocateDouble(Thread* thread, double value) { 318 static RawObject* AllocateDouble(Thread* thread, double value) {
319 const intptr_t instance_size = Double::InstanceSize(); 319 const intptr_t instance_size = Double::InstanceSize();
320 const uword start = thread->heap()->new_space()->TryAllocate(instance_size); 320 const uword start = thread->heap()->new_space()->TryAllocate(instance_size);
321 if (LIKELY(start != 0)) { 321 if (LIKELY(start != 0)) {
322 uword tags = 0; 322 uword tags = 0;
323 tags = RawObject::ClassIdTag::update(kDoubleCid, tags); 323 tags = RawObject::ClassIdTag::update(kDoubleCid, tags);
324 tags = RawObject::SizeTag::update(instance_size, tags); 324 tags = RawObject::SizeTag::update(instance_size, tags);
325 // Also writes zero in the hash_ field.
326 *reinterpret_cast<uword*>(start + Double::tags_offset()) = tags; 325 *reinterpret_cast<uword*>(start + Double::tags_offset()) = tags;
327 *reinterpret_cast<double*>(start + Double::value_offset()) = value; 326 *reinterpret_cast<double*>(start + Double::value_offset()) = value;
328 return reinterpret_cast<RawObject*>(start + kHeapObjectTag); 327 return reinterpret_cast<RawObject*>(start + kHeapObjectTag);
329 } 328 }
330 return NULL; 329 return NULL;
331 } 330 }
332 331
333 static bool Double_add(Thread* thread, RawObject** FP, RawObject** result) { 332 static bool Double_add(Thread* thread, RawObject** FP, RawObject** result) {
334 double d1, d2; 333 double d1, d2;
335 if (!GetDoubleOperands(FrameArguments(FP, 2), &d1, &d2)) { 334 if (!GetDoubleOperands(FrameArguments(FP, 2), &d1, &d2)) {
(...skipping 2513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2849 } 2848 }
2850 2849
2851 // TODO(vegorov) allocation bytecodes can benefit from the new-space 2850 // TODO(vegorov) allocation bytecodes can benefit from the new-space
2852 // allocation fast-path that does not transition into the runtime system. 2851 // allocation fast-path that does not transition into the runtime system.
2853 { 2852 {
2854 BYTECODE(AllocateUninitializedContext, A_D); 2853 BYTECODE(AllocateUninitializedContext, A_D);
2855 const uint16_t num_context_variables = rD; 2854 const uint16_t num_context_variables = rD;
2856 const intptr_t instance_size = Context::InstanceSize(num_context_variables); 2855 const intptr_t instance_size = Context::InstanceSize(num_context_variables);
2857 const uword start = thread->heap()->new_space()->TryAllocate(instance_size); 2856 const uword start = thread->heap()->new_space()->TryAllocate(instance_size);
2858 if (LIKELY(start != 0)) { 2857 if (LIKELY(start != 0)) {
2859 uint32_t tags = 0; 2858 uword tags = 0;
2860 tags = RawObject::ClassIdTag::update(kContextCid, tags); 2859 tags = RawObject::ClassIdTag::update(kContextCid, tags);
2861 tags = RawObject::SizeTag::update(instance_size, tags); 2860 tags = RawObject::SizeTag::update(instance_size, tags);
2862 // Also writes 0 in the hash_ field of the header.
2863 *reinterpret_cast<uword*>(start + Array::tags_offset()) = tags; 2861 *reinterpret_cast<uword*>(start + Array::tags_offset()) = tags;
2864 *reinterpret_cast<uword*>(start + Context::num_variables_offset()) = 2862 *reinterpret_cast<uword*>(start + Context::num_variables_offset()) =
2865 num_context_variables; 2863 num_context_variables;
2866 FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag); 2864 FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag);
2867 pc += 2; 2865 pc += 2;
2868 } 2866 }
2869 DISPATCH(); 2867 DISPATCH();
2870 } 2868 }
2871 2869
2872 { 2870 {
(...skipping 20 matching lines...) Expand all
2893 DISPATCH(); 2891 DISPATCH();
2894 } 2892 }
2895 2893
2896 { 2894 {
2897 BYTECODE(AllocateOpt, A_D); 2895 BYTECODE(AllocateOpt, A_D);
2898 const uword tags = 2896 const uword tags =
2899 static_cast<uword>(Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(rD)))); 2897 static_cast<uword>(Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(rD))));
2900 const intptr_t instance_size = RawObject::SizeTag::decode(tags); 2898 const intptr_t instance_size = RawObject::SizeTag::decode(tags);
2901 const uword start = thread->heap()->new_space()->TryAllocate(instance_size); 2899 const uword start = thread->heap()->new_space()->TryAllocate(instance_size);
2902 if (LIKELY(start != 0)) { 2900 if (LIKELY(start != 0)) {
2903 // Writes both the tags and the initial identity hash on 64 bit platforms.
2904 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags; 2901 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
2905 for (intptr_t current_offset = sizeof(RawInstance); 2902 for (intptr_t current_offset = sizeof(RawInstance);
2906 current_offset < instance_size; current_offset += kWordSize) { 2903 current_offset < instance_size; current_offset += kWordSize) {
2907 *reinterpret_cast<RawObject**>(start + current_offset) = null_value; 2904 *reinterpret_cast<RawObject**>(start + current_offset) = null_value;
2908 } 2905 }
2909 FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag); 2906 FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag);
2910 pc += 2; 2907 pc += 2;
2911 } 2908 }
2912 DISPATCH(); 2909 DISPATCH();
2913 } 2910 }
(...skipping 11 matching lines...) Expand all
2925 } 2922 }
2926 2923
2927 { 2924 {
2928 BYTECODE(AllocateTOpt, A_D); 2925 BYTECODE(AllocateTOpt, A_D);
2929 const uword tags = Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(rD))); 2926 const uword tags = Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(rD)));
2930 const intptr_t instance_size = RawObject::SizeTag::decode(tags); 2927 const intptr_t instance_size = RawObject::SizeTag::decode(tags);
2931 const uword start = thread->heap()->new_space()->TryAllocate(instance_size); 2928 const uword start = thread->heap()->new_space()->TryAllocate(instance_size);
2932 if (LIKELY(start != 0)) { 2929 if (LIKELY(start != 0)) {
2933 RawObject* type_args = SP[0]; 2930 RawObject* type_args = SP[0];
2934 const intptr_t type_args_offset = Bytecode::DecodeD(*pc); 2931 const intptr_t type_args_offset = Bytecode::DecodeD(*pc);
2935 // Writes both the tags and the initial identity hash on 64 bit platforms.
2936 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags; 2932 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
2937 for (intptr_t current_offset = sizeof(RawInstance); 2933 for (intptr_t current_offset = sizeof(RawInstance);
2938 current_offset < instance_size; current_offset += kWordSize) { 2934 current_offset < instance_size; current_offset += kWordSize) {
2939 *reinterpret_cast<RawObject**>(start + current_offset) = null_value; 2935 *reinterpret_cast<RawObject**>(start + current_offset) = null_value;
2940 } 2936 }
2941 *reinterpret_cast<RawObject**>(start + type_args_offset) = type_args; 2937 *reinterpret_cast<RawObject**>(start + type_args_offset) = type_args;
2942 FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag); 2938 FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag);
2943 SP -= 1; // Consume the type arguments on the stack. 2939 SP -= 1; // Consume the type arguments on the stack.
2944 pc += 4; 2940 pc += 4;
2945 } 2941 }
(...skipping 23 matching lines...) Expand all
2969 ~(kObjectAlignment - 1); 2965 ~(kObjectAlignment - 1);
2970 const uword start = 2966 const uword start =
2971 thread->heap()->new_space()->TryAllocate(instance_size); 2967 thread->heap()->new_space()->TryAllocate(instance_size);
2972 if (LIKELY(start != 0)) { 2968 if (LIKELY(start != 0)) {
2973 const intptr_t cid = kArrayCid; 2969 const intptr_t cid = kArrayCid;
2974 uword tags = 0; 2970 uword tags = 0;
2975 if (LIKELY(instance_size <= RawObject::SizeTag::kMaxSizeTag)) { 2971 if (LIKELY(instance_size <= RawObject::SizeTag::kMaxSizeTag)) {
2976 tags = RawObject::SizeTag::update(instance_size, tags); 2972 tags = RawObject::SizeTag::update(instance_size, tags);
2977 } 2973 }
2978 tags = RawObject::ClassIdTag::update(cid, tags); 2974 tags = RawObject::ClassIdTag::update(cid, tags);
2979 // Writes both the tags and the initial identity hash on 64 bit
2980 // platforms.
2981 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags; 2975 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
2982 *reinterpret_cast<RawObject**>(start + Array::length_offset()) = 2976 *reinterpret_cast<RawObject**>(start + Array::length_offset()) =
2983 FP[rB]; 2977 FP[rB];
2984 *reinterpret_cast<RawObject**>( 2978 *reinterpret_cast<RawObject**>(
2985 start + Array::type_arguments_offset()) = FP[rC]; 2979 start + Array::type_arguments_offset()) = FP[rC];
2986 RawObject** data = 2980 RawObject** data =
2987 reinterpret_cast<RawObject**>(start + Array::data_offset()); 2981 reinterpret_cast<RawObject**>(start + Array::data_offset());
2988 for (intptr_t i = 0; i < length; i++) { 2982 for (intptr_t i = 0; i < length; i++) {
2989 data[i] = null_value; 2983 data[i] = null_value;
2990 } 2984 }
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
3906 pc_ = pc; 3900 pc_ = pc;
3907 } 3901 }
3908 3902
3909 buf->Longjmp(); 3903 buf->Longjmp();
3910 UNREACHABLE(); 3904 UNREACHABLE();
3911 } 3905 }
3912 3906
3913 } // namespace dart 3907 } // namespace dart
3914 3908
3915 #endif // defined TARGET_ARCH_DBC 3909 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/simulator_arm64.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698