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

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

Issue 447793003: VM: Micro-optimization of inline array allocation code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 // Set the length field. 1929 // Set the length field.
1930 __ StoreIntoObjectNoBarrier(RAX, 1930 __ StoreIntoObjectNoBarrier(RAX,
1931 FieldAddress(RAX, Array::length_offset()), 1931 FieldAddress(RAX, Array::length_offset()),
1932 kLengthReg); 1932 kLengthReg);
1933 1933
1934 // Initialize all array elements to raw_null. 1934 // Initialize all array elements to raw_null.
1935 // RAX: new object start as a tagged pointer. 1935 // RAX: new object start as a tagged pointer.
1936 // RCX: new object end address. 1936 // RCX: new object end address.
1937 // RDI: iterator which initially points to the start of the variable 1937 // RDI: iterator which initially points to the start of the variable
1938 // data area to be initialized. 1938 // data area to be initialized.
1939 __ LoadObject(R12, Object::null_object(), PP); 1939 if (num_elements > 0) {
1940 __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray))); 1940 __ LoadObject(R12, Object::null_object(), PP);
1941 Label init_loop; 1941 __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray)));
1942 __ Bind(&init_loop); 1942 Label init_loop;
1943 __ cmpq(RDI, RCX); 1943 __ Bind(&init_loop);
1944 __ j(ABOVE_EQUAL, done, Assembler::kNearJump); 1944 __ movq(Address(RDI, 0), R12);
1945 __ movq(Address(RDI, 0), R12); 1945 __ addq(RDI, Immediate(kWordSize));
1946 __ addq(RDI, Immediate(kWordSize)); 1946 __ cmpq(RDI, RCX);
1947 __ jmp(&init_loop, Assembler::kNearJump); 1947 __ j(BELOW, &init_loop, Assembler::kNearJump);
1948 }
1949 __ jmp(done, Assembler::kNearJump);
1948 } 1950 }
1949 1951
1950 1952
1951 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1953 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1952 // Allocate the array. R10 = length, RBX = element type. 1954 // Allocate the array. R10 = length, RBX = element type.
1953 const Register kLengthReg = R10; 1955 const Register kLengthReg = R10;
1954 const Register kElemTypeReg = RBX; 1956 const Register kElemTypeReg = RBX;
1955 const Register kResultReg = RAX; 1957 const Register kResultReg = RAX;
1956 ASSERT(locs()->in(0).reg() == kElemTypeReg); 1958 ASSERT(locs()->in(0).reg() == kElemTypeReg);
1957 ASSERT(locs()->in(1).reg() == kLengthReg); 1959 ASSERT(locs()->in(1).reg() == kLengthReg);
(...skipping 3811 matching lines...) Expand 10 before | Expand all | Expand 10 after
5769 __ movq(R10, Immediate(kInvalidObjectPointer)); 5771 __ movq(R10, Immediate(kInvalidObjectPointer));
5770 __ movq(RBX, Immediate(kInvalidObjectPointer)); 5772 __ movq(RBX, Immediate(kInvalidObjectPointer));
5771 #endif 5773 #endif
5772 } 5774 }
5773 5775
5774 } // namespace dart 5776 } // namespace dart
5775 5777
5776 #undef __ 5778 #undef __
5777 5779
5778 #endif // defined TARGET_ARCH_X64 5780 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698