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

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

Issue 2900963008: Reapply "Shuffle around deopt id allocation... (Closed)
Patch Set: . Created 3 years, 7 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
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 2937 matching lines...) Expand 10 before | Expand all | Expand 10 after
2948 SP[2] = SP[-1]; // Type arguments 2948 SP[2] = SP[-1]; // Type arguments
2949 Exit(thread, FP, SP + 3, pc); 2949 Exit(thread, FP, SP + 3, pc);
2950 NativeArguments args(thread, 2, SP + 1, SP - 1); 2950 NativeArguments args(thread, 2, SP + 1, SP - 1);
2951 INVOKE_RUNTIME(DRT_AllocateObject, args); 2951 INVOKE_RUNTIME(DRT_AllocateObject, args);
2952 SP -= 1; // Result is in SP - 1. 2952 SP -= 1; // Result is in SP - 1.
2953 DISPATCH(); 2953 DISPATCH();
2954 } 2954 }
2955 2955
2956 { 2956 {
2957 BYTECODE(CreateArrayOpt, A_B_C); 2957 BYTECODE(CreateArrayOpt, A_B_C);
2958 const intptr_t length = Smi::Value(RAW_CAST(Smi, FP[rB])); 2958 if (LIKELY(!FP[rB]->IsHeapObject())) {
2959 if (LIKELY(static_cast<uintptr_t>(length) <= Array::kMaxElements)) { 2959 const intptr_t length = Smi::Value(RAW_CAST(Smi, FP[rB]));
2960 const intptr_t fixed_size_plus_alignment_padding = 2960 if (LIKELY(static_cast<uintptr_t>(length) <= Array::kMaxElements)) {
2961 sizeof(RawArray) + kObjectAlignment - 1; 2961 const intptr_t fixed_size_plus_alignment_padding =
2962 const intptr_t instance_size = 2962 sizeof(RawArray) + kObjectAlignment - 1;
2963 (fixed_size_plus_alignment_padding + length * kWordSize) & 2963 const intptr_t instance_size =
2964 ~(kObjectAlignment - 1); 2964 (fixed_size_plus_alignment_padding + length * kWordSize) &
2965 const uword start = 2965 ~(kObjectAlignment - 1);
2966 thread->heap()->new_space()->TryAllocate(instance_size); 2966 const uword start =
2967 if (LIKELY(start != 0)) { 2967 thread->heap()->new_space()->TryAllocate(instance_size);
2968 const intptr_t cid = kArrayCid; 2968 if (LIKELY(start != 0)) {
2969 uword tags = 0; 2969 const intptr_t cid = kArrayCid;
2970 if (LIKELY(instance_size <= RawObject::SizeTag::kMaxSizeTag)) { 2970 uword tags = 0;
2971 tags = RawObject::SizeTag::update(instance_size, tags); 2971 if (LIKELY(instance_size <= RawObject::SizeTag::kMaxSizeTag)) {
2972 tags = RawObject::SizeTag::update(instance_size, tags);
2973 }
2974 tags = RawObject::ClassIdTag::update(cid, tags);
2975 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
2976 *reinterpret_cast<RawObject**>(start + Array::length_offset()) =
2977 FP[rB];
2978 *reinterpret_cast<RawObject**>(
2979 start + Array::type_arguments_offset()) = FP[rC];
2980 RawObject** data =
2981 reinterpret_cast<RawObject**>(start + Array::data_offset());
2982 for (intptr_t i = 0; i < length; i++) {
2983 data[i] = null_value;
2984 }
2985 FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag);
2986 pc += 4;
2972 } 2987 }
2973 tags = RawObject::ClassIdTag::update(cid, tags);
2974 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
2975 *reinterpret_cast<RawObject**>(start + Array::length_offset()) = FP[rB];
2976 *reinterpret_cast<RawObject**>(start + Array::type_arguments_offset()) =
2977 FP[rC];
2978 RawObject** data =
2979 reinterpret_cast<RawObject**>(start + Array::data_offset());
2980 for (intptr_t i = 0; i < length; i++) {
2981 data[i] = null_value;
2982 }
2983 FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag);
2984 pc += 4;
2985 } 2988 }
2986 } 2989 }
2987 DISPATCH(); 2990 DISPATCH();
2988 } 2991 }
2989 2992
2990 { 2993 {
2991 BYTECODE(CreateArrayTOS, 0); 2994 BYTECODE(CreateArrayTOS, 0);
2992 SP[1] = SP[-0]; // Length. 2995 SP[1] = SP[-0]; // Length.
2993 SP[2] = SP[-1]; // Type. 2996 SP[2] = SP[-1]; // Type.
2994 Exit(thread, FP, SP + 3, pc); 2997 Exit(thread, FP, SP + 3, pc);
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
3897 pc_ = pc; 3900 pc_ = pc;
3898 } 3901 }
3899 3902
3900 buf->Longjmp(); 3903 buf->Longjmp();
3901 UNREACHABLE(); 3904 UNREACHABLE();
3902 } 3905 }
3903 3906
3904 } // namespace dart 3907 } // namespace dart
3905 3908
3906 #endif // defined TARGET_ARCH_DBC 3909 #endif // defined TARGET_ARCH_DBC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698