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

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

Issue 2479463003: DBC: Fix fast-path allocation with type arguments (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | tests/language/language.status » ('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 2784 matching lines...) Expand 10 before | Expand all | Expand 10 after
2795 2795
2796 { 2796 {
2797 BYTECODE(AllocateTOpt, A_D); 2797 BYTECODE(AllocateTOpt, A_D);
2798 const uword tags = Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(rD))); 2798 const uword tags = Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(rD)));
2799 const intptr_t instance_size = RawObject::SizeTag::decode(tags); 2799 const intptr_t instance_size = RawObject::SizeTag::decode(tags);
2800 const uword start = thread->heap()->new_space()->TryAllocate(instance_size); 2800 const uword start = thread->heap()->new_space()->TryAllocate(instance_size);
2801 if (LIKELY(start != 0)) { 2801 if (LIKELY(start != 0)) {
2802 RawObject* type_args = SP[0]; 2802 RawObject* type_args = SP[0];
2803 const intptr_t type_args_offset = Bytecode::DecodeD(*pc); 2803 const intptr_t type_args_offset = Bytecode::DecodeD(*pc);
2804 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags; 2804 *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
2805 *reinterpret_cast<RawObject**>(start + type_args_offset) = type_args;
2806 for (intptr_t current_offset = sizeof(RawInstance); 2805 for (intptr_t current_offset = sizeof(RawInstance);
2807 current_offset < instance_size; 2806 current_offset < instance_size;
2808 current_offset += kWordSize) { 2807 current_offset += kWordSize) {
2809 *reinterpret_cast<RawObject**>(start + current_offset) = null_value; 2808 *reinterpret_cast<RawObject**>(start + current_offset) = null_value;
2810 } 2809 }
2810 *reinterpret_cast<RawObject**>(start + type_args_offset) = type_args;
2811 FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag); 2811 FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag);
2812 SP -= 1; // Consume the type arguments on the stack. 2812 SP -= 1; // Consume the type arguments on the stack.
2813 pc += 4; 2813 pc += 4;
2814 } 2814 }
2815 DISPATCH(); 2815 DISPATCH();
2816 } 2816 }
2817 2817
2818 { 2818 {
2819 BYTECODE(AllocateT, 0); 2819 BYTECODE(AllocateT, 0);
2820 SP[1] = SP[-0]; // Class object. 2820 SP[1] = SP[-0]; // Class object.
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
3754 pc_ = pc; 3754 pc_ = pc;
3755 special_[kExceptionSpecialIndex] = raw_exception; 3755 special_[kExceptionSpecialIndex] = raw_exception;
3756 special_[kStacktraceSpecialIndex] = raw_stacktrace; 3756 special_[kStacktraceSpecialIndex] = raw_stacktrace;
3757 buf->Longjmp(); 3757 buf->Longjmp();
3758 UNREACHABLE(); 3758 UNREACHABLE();
3759 } 3759 }
3760 3760
3761 } // namespace dart 3761 } // namespace dart
3762 3762
3763 #endif // defined TARGET_ARCH_DBC 3763 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698